Join the 80,000 other DTN customers who enjoy the fastest, most reliable data available. There is no better value than DTN!

(Move your cursor to this area to pause scrolling)




"If someone needs the best quality data and backfill beyond what their broker provides at a rate that is the best in the industry, I highly recommend IQFeed." - Comment from Josh via Public Forum
"I have to tell you though that using the IQFeed API is about the easiest and cleanest I have seen for some time." - Comment from Jim
"Thanks for following up with me. You guys do a great job in tech support." - Comment from Phelps
"I use IQ Feed, Great stuff as far as data analysis information, storage and retrieval is concerned." - Comment from Public Forum
"You have an excellent feed. Very few spikes for Spot Forex." - Comment from Public Forum Post
"I just wanted to say how happy I am with your service. I was able to download the API docs last week and I was able to replicate Interactive Brokers historical bar queries and realtime bar queries over the weekend. That was about one of the fastest integrations that I've ever done and it works perfectly!!!!" - Comment from Jason via Email
"I had always used ******* but for the past 2 weeks have been trying DTN IQFeed. Customer support has been extraordinary. They call just to make sure your problem hasn't recurred." - Comment from Public Forum
"Everything is working amazing now. I'm already impressed with the true-tick feed of IQFeed and it's ability to support my 480 symbol layout." - Comment from Tyler via Email
"IQ feed works very well, does not have all of the normal interruptions I have grown used to on *******" - Comment from Mark
"Interactive Brokers tick data was inconsistent, so I have switched to using DTN exclusively. It is great to no longer have to worry about my datafeed all day long." - Comment from Philippe
Home  Search  Register  Login  Blogs Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTN_IQFeed on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »IQFeed Developer »IQFeed Developer Support »Decoding Timestamps in Update Messages.
Author Topic: Decoding Timestamps in Update Messages. (11 messages, Page 1 of 1)

Craig
-DTN Evangelist-
Posts: 219
Joined: Apr 16, 2010


Posted: Sep 20, 2017 05:59 PM          Msg. 1 of 11
I've switched to using the timestamps in the feed as opposed to local timestamps.
But I'm now getting out of order times. My algorithm is as follows...

* If the "Message Contents" contains "C" use the last trade time.
* else if the "Message Contents" contains "b" use the bid time.
* else if the "Message Contents" contains "a" use the ask time.

This seems straight forward, but is obviously incorrect.
Could I receive a "Message Contents" with a "C" where the Bid or Ask time is after the trade time?
...or an "Message Contents" with a "b" but the ask time is greater than the bid time?

How should I use the "Message Contents" in general to figure out what timestamp to assign a quote?

DTN_Tim Walter
-DTN Guru-
Posts: 1204
Joined: Apr 25, 2006


Posted: Sep 21, 2017 11:46 AM          Msg. 2 of 11
Ok, 2 assumptions up front, if either of these is not true, just let me know.
You are using "Last Trade Time" and not "Most Recent Trade Time"
You are only comparing messages of a single symbol.

Assuming both of those things, the logic you are using makes sense to me. Can you just send me an example and I will take a look? If you could include which protocol you are using and what your field order is that would certainly help.

Tim

Craig
-DTN Evangelist-
Posts: 219
Joined: Apr 16, 2010


Posted: Sep 21, 2017 02:05 PM          Msg. 3 of 11
Hi Tim,

1) I'm using "Last Time"
2) Yep, only one symbol.

Today I've logged the L1 data, so I'll be comparing what I've recorded.
Please let me know if 1) is correct.

Craig
-DTN Evangelist-
Posts: 219
Joined: Apr 16, 2010


Posted: Sep 21, 2017 03:14 PM          Msg. 4 of 11
OK, here is an example: My field set is Symbol,Last,Bid,Ask,Most Recent Trade Size,Message Contents,Most Recent Trade Market Center,Bid Size,Ask Size,Last Time,Bid Time,Ask Time. The symbol is SPY.

Here is my recorded data:
27 2017-09-21 09:30:00.559 249.9000 249.89 249.90 12100 3000 100 25 FALSE
28 2017-09-21 09:30:00.559 249.9000 249.89 249.90 12100 1000 100 25 FALSE
29 2017-09-21 09:30:00.559 249.9000 249.89 249.91 12100 1100 100 25 FALSE
30 2017-09-21 09:30:00.559 249.9000 249.89 249.90 12100 100 100 25 FALSE
31 2017-09-21 09:30:00.559 249.9000 249.89 249.90 12700 100 100 25 FALSE
32 2017-09-21 09:30:00.559 249.9000 249.89 249.90 13200 100 100 25 FALSE
33 2017-09-21 09:30:00.559 249.9000 249.89 249.90 17100 100 100 25 FALSE
34 2017-09-21 09:30:00.565 249.9000 249.89 249.90 13200 100 100 25 FALSE
35 2017-09-21 09:30:00.565 249.9000 249.89 249.90 13100 100 100 25 FALSE
36 2017-09-21 09:30:00.565 249.9000 249.89 249.90 10500 100 100 25 FALSE

---> Timestamp jumps back.

37 2017-09-21 09:30:00.556 249.8975 249.89 249.90 10500 100 100 19 TRUE
38 2017-09-21 09:30:00.559 249.8800 249.89 249.90 10500 100 500 11 TRUE
39 2017-09-21 09:30:00.559 249.8950 249.89 249.90 10500 100 200 11 TRUE

Now the L1 data from IQFeed.

Q,SPY,249.9000,249.8900,249.9000,100,ba,25,12100,3000,09:30:00.545301,09:30:00.559047,09:30:00.559047,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,12100,1000,09:30:00.545301,09:30:00.559077,09:30:00.559077,
Q,SPY,249.9000,249.8900,249.9100,100,ba,25,12100,1100,09:30:00.545301,09:30:00.559107,09:30:00.559107,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,12100,100,09:30:00.545301,09:30:00.559261,09:30:00.559261,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,12700,100,09:30:00.545301,09:30:00.559797,09:30:00.559797,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,13200,100,09:30:00.545301,09:30:00.559954,09:30:00.559954,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,17100,100,09:30:00.545301,09:30:00.560185,09:30:00.560185,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,13200,100,09:30:00.545301,09:30:00.566021,09:30:00.566021,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,13100,100,09:30:00.545301,09:30:00.566318,09:30:00.566318,
Q,SPY,249.9000,249.8900,249.9000,100,ba,25,10500,100,09:30:00.545301,09:30:00.566496,09:30:00.566496,
Q,SPY,249.8975,249.8900,249.9000,100,C,19,10500,100,09:30:00.556657,09:30:00.566496,09:30:00.566496,

--> Here is the trade, note trade time 09:30:00.556657 is before the previous Bid/Ask update time (09:30:00.566496)

Q,SPY,249.8975,249.8900,249.9000,8,O,11,10500,100,09:30:00.556657,09:30:00.566496,09:30:00.566496,
Q,SPY,249.8800,249.8900,249.9000,500,C,11,10500,100,09:30:00.559100,09:30:00.566496,09:30:00.566496,
Q,SPY,249.8950,249.8900,249.9000,200,C,11,10500,100,09:30:00.560176,09:30:00.566496,09:30:00.566496,

Please advise.

Craig
-DTN Evangelist-
Posts: 219
Joined: Apr 16, 2010


Posted: Sep 22, 2017 01:45 PM          Msg. 5 of 11
Any updates here?

DTN_Steve_S
-DTN Guru-
Posts: 2039
Joined: Nov 21, 2005


Posted: Sep 22, 2017 02:18 PM          Msg. 6 of 11
Craig, sorry for the delay in responding.

What you are showing here is expected behavior. The bid/ask quotes for these equities come from the exchange on a different feed and we merge them in-house before forwarding them to customers. Any effort to assure they are in chronological order would result in intentionally delaying at least one of the feeds while waiting for data from the other feed. Instead, we opt for the option that gets data to customers as quickly as possible. As a result, you will occasionally see discrepancies between trades timestamps and bid/ask timestamps in this scenario.

Craig
-DTN Evangelist-
Posts: 219
Joined: Apr 16, 2010


Posted: Sep 22, 2017 02:37 PM          Msg. 7 of 11
Thank you Steve, when you say 'different feed', do you mean different exchanges?
If this is the case should the time-stamps be chronological by market center?

bards
-Interested User-
Posts: 26
Joined: May 7, 2011


Posted: Oct 7, 2017 10:51 AM          Msg. 8 of 11
This is a followup on Craig's comment about using time as follows

* If the "Message Contents" contains "C" use the last trade time.
* else if the "Message Contents" contains "b" use the bid time.
* else if the "Message Contents" contains "a" use the ask time.

For some options that are not highly traded, ask time has a value, but
bid time has 99:99:99

I have included a snippet below of an option. This was traded 10/5/2017.

Symbol,Last,Total Volume,Ask,Ask Size,Ask Market Center,Ask Time,Bid,Bid Size,Bid Market Center,Bid Time,Message Contents,Most Recent Trade Size,Most Recent Trade Market Center,Last Time

XRX1720J35 0.11 0 0.07 58 108 10:01:01.990488 99:99:99.990488 ba 2.0 13.0 10:15:24.512977
XRX1720J35 0.11 0 0.07 70 108 10:01:01.991206 99:99:99.991206 ba 2.0 13.0 10:15:24.512977
XRX1720J35 0.11 0 0.07 83 12 10:01:10.236872 99:99:99.236872 ba 2.0 13.0 10:15:24.512977
XRX1720J35 0.11 0 0.07 96 9 10:01:11.115193 99:99:99.115193 ba 2.0 13.0 10:15:24.512977
XRX1720J35 0.11 0 0.07 96 9 10:01:39.732290 0.01 15 18 10:01:39.732290 ba 2.0 13.0 10:15:24.512977

In this scenario, should the time not be that of Ask Time?

DTN_Tim Walter
-DTN Guru-
Posts: 1204
Joined: Apr 25, 2006


Posted: Oct 9, 2017 09:29 AM          Msg. 9 of 11
Any bid or ask update received with a 99:99:99 timestamp is the exchange saying there is no valid value currently.

Bid and ask are always sent as pairs though so you can get several invalid updates on the bid while the ask size continues to update as it does here in your example.

Tim

bards
-Interested User-
Posts: 26
Joined: May 7, 2011


Posted: Oct 10, 2017 11:06 AM          Msg. 10 of 11
Thanks Tim.

So, just to double-check, it is fine to use Ask Time in my example.

DTN_Tim Walter
-DTN Guru-
Posts: 1204
Joined: Apr 25, 2006


Posted: Oct 10, 2017 11:07 AM          Msg. 11 of 11
Correct
 

 

Time: Tue August 21, 2018 7:15 AM CFBB v1.2.0 16 ms.
© AderSoftware 2002-2003