NexusFi: Find Your Edge


Home Menu

 





Problem with OnMarketData()


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one ratfink with 11 posts (7 thanks)
    2. looks_two ketron82 with 9 posts (2 thanks)
    3. looks_3 artemiso with 5 posts (8 thanks)
    4. looks_4 Big Mike with 4 posts (3 thanks)
      Best Posters
    1. looks_one artemiso with 1.6 thanks per post
    2. looks_two Big Mike with 0.8 thanks per post
    3. looks_3 rleplae with 0.7 thanks per post
    4. looks_4 ratfink with 0.6 thanks per post
    1. trending_up 9,803 views
    2. thumb_up 24 thanks given
    3. group 4 followers
    1. forum 35 posts
    2. attach_file 0 attachments




 
Search this Thread

Problem with OnMarketData()

  #21 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


rleplae View Post
Hello @ratfink

I am on IQfeed

Is there any risk that data comes in, that is back-fill data ?
I thought there was a mechanism, during a spike, when too much data comes, that IQfeed will try to catch
up with the most recent and then later fill in the gap ?

The code seems to build on the fact that data always comes in sequential

IQFeed always delivers ticks in sequence. It's also over TCP, so guaranteed delivery. Other broker type feeds like Rithmic for example don't guarantee in-sequence ticks, and also use UDP. That particular feed also routinely drops Level 2 updates, sacrificing quality for speed (since it is a broker execution feed, not a data feed).

There should never be a "spike" with "too much data". I've documented elsewhere on the forum that even running 200 concurrent symbols will still use minimal bandwidth, IIRC it was less than 1 Mbps. Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:

Can you help answer these questions
from other members on NexusFi?
REcommedations for programming help
Sierra Chart
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
29 thanks
Just another trading journal: PA, Wyckoff & Trends
24 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
21 thanks
GFIs1 1 DAX trade per day journal
17 thanks
  #22 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,395


Big Mike View Post
IQFeed always delivers ticks in sequence. It's also over TCP, so guaranteed delivery. Other broker type feeds like Rithmic for example don't guarantee in-sequence ticks, and also use UDP. That particular feed also routinely drops Level 2 updates, sacrificing quality for speed (since it is a broker execution feed, not a data feed).

There should never be a "spike" with "too much data". I've documented elsewhere on the forum that even running 200 concurrent symbols will still use minimal bandwidth, IIRC it was less than 1 Mbps. Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Mike

@Big Mike,

Were you subscribed to the L2 data for all 200 symbols or just the L1?

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
  #23 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


Hi Ron, @rleplae

Just in case this is causing any confusion it is worth a mention/reminder of the stupid timestamping issue in Ninja, remember that Ninja time-based bar series get timestamped with a *future* timestamp. This is annoying, to say nothing of being inconsistent with both it's own other bar types and the real world.

So, for example, the first tick of a new bar in a 15 minute series opening at 16:00 will be timestamped 16:15:00, and that timestamp will not change for any subsequent ticks in that same bar. In the meantime the first tick of a new bar in a 5 minute series will get 16:05:00 and same for subsequent, the first and subsequent ticks for the new 1 minute series will get 16:01:00, the first tick of a 12 second series will get 16:00:12, the first tick of it's next bar will get 16:00:24, etc, etc. So you can appear to be getting backfilling data across different series, but you aren't, tedious isn't it, but at least easy to handle/correct for the external world once you know.

The 'apparent' time of other bar type series events is also not guaranteed or consistent either, e.g. a 200 volume series can appear to open before a 1 or 5 volume series, so assume nothing and be not disappointed. Likewise order of bar processing across charts is not preseved across Ninja saves/restores, so again, make no assumptions.

Cheers

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #24 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425

Hi Ron @rleplae,

This is my current adjustment I use with a dynamically allocated array system I use to talk elsewhere with:

 
Code
	DateTime t = Bars.GetTime(CurrentBar);
					
	// correct for Ninja's stupid use of future timestamps on time based series, other's are ok
	if (BarsPeriod.BasePeriodType == PeriodType.Minute)
	{
		t = t.AddMinutes(-BarsPeriod.BasePeriodValue);
	}
	else if (BarsPeriod.BasePeriodType == PeriodType.Second)
	{
		t = t.AddSeconds(-BarsPeriod.BasePeriodValue);
	}
There are other smarter ways I'm sure, but I need simple.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #25 (permalink)
 
ratfink's Avatar
 ratfink 
Birmingham UK
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: TST/Rithmic
Trading: YM/Gold
Posts: 3,633 since Dec 2012
Thanks Given: 17,423
Thanks Received: 8,425


NJAMC View Post
... but with the Data/Depth tick data. The problem only occurs when you have MTF with the same instrument with different time periods. The BIP will not be updated properly on these calls.

Thanks for the heads-up, that's also irksome.

Travel Well
Visit my NexusFi Trade Journal Reply With Quote
  #26 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,442 since Jun 2009
Thanks Given: 33,215
Thanks Received: 101,603


NJAMC View Post
@Big Mike,

Were you subscribed to the L2 data for all 200 symbols or just the L1?

L2

Sent from my phone

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #27 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685

TCP guarantees in-order delivery, so it is true.

Reply With Quote
  #28 (permalink)
 
rleplae's Avatar
 rleplae 
Gits (Hooglede) Belgium
Legendary Market Wizard
 
Experience: Master
Platform: NinjaTrader, Proprietary,
Broker: Ninjabrokerage/IQfeed + Synthetic datafeed
Trading: 6A, 6B, 6C, 6E, 6J, 6S, ES, NQ, YM, AEX, CL, NG, ZB, ZN, ZC, ZS, GC
Posts: 3,003 since Sep 2013
Thanks Given: 2,442
Thanks Received: 5,863


artemiso View Post
If I understand your questions correctly, it is really three-fold: (1) You are asking if the "live" data is mixed with "historical data", and (2) if it is not mixed, you want to know if the "live" data is guaranteed to be in correct sequence. (3) Regardless of the order of data, you want to know if a "spike of data" is an issue.

Regarding (1), historical backfill and L1/L2 subscription are treated as different requests, so you will never receive a mix of historical and "live" data. In a C++ implementation:

 
Code
void IQLevel1Controller::subscribeToSymbol(const string &symbol) {
    boost::format formatter("w%1%\r\n");
    string message = str(formatter % symbol);
    tcpClient->write(message);
}


 
Code
void IQHistoricalLookupController::getHistoricalTickDataForSymbol(const string &symbol) {
    boost::format formatter("HTT,%1%,%2%,%3%,,,,1,%4%\r\n");
    string message = str(formatter % symbol % beginTimeString % endTimeString % DATA_MESSAGE_PREFIX);
    tcpClient->write(message);
}


Regarding (2), TCP has a handshake mechanism that guarantees in-order delivery, so it is true that the data always comes in a stream in the same sequence as it was sent to you.



Thanks Artisimo

I was aware about IQfeed back-fill capability (that was the reason for me to take IQfeed,
because of OFA indicator, that seemed to work best with that data stream), but have not
been coding it low level enough.

You clearly explain how it works.... as another stream

I did not run into any issue, but because i knew back is possible, but didn't know how it
worked i was just checking if my work would still work in live.
The answer is clearly yes from all sides

regards,
Ron

Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #29 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685


Big Mike View Post
Now, if your platform is not threading correctly or is delayed by bad code (indicator) then of course it just means things will get slow, but the issue is definitely not with IQFeed in this case.

Also, just to clarify, there's very little that your program can do to optimize this further.

Reply With Quote
Thanked by:
  #30 (permalink)
 artemiso 
New York, NY
 
Experience: Beginner
Platform: Vanguard 401k
Broker: Yahoo Finance
Trading: Mutual funds
Posts: 1,152 since Jul 2012
Thanks Given: 784
Thanks Received: 2,685


@rleplae You're welcome.

Reply With Quote
Thanked by:




Last Updated on March 28, 2015


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts