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)




"After all the anxiety I had with my previous data provider it is a relief not to have to worry about data speed and integrity." - Comment from Eamonn
"Excellent datafeed !!!" - Comment from Arely
"I cannot believe what a difference it makes trading with ProphetX!" - Comment from Bruce in Los Angeles
"I've never had DTN go out on me since switching. ******* would go down a couple times every month when I was using them." - Comment from Bryce in AL.
"Thank you so much - awesome feed, awesome service!" - Comment from Greg via Email
"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
"I just wanted to tell you what a fine job you have been doing. While *******, from what I hear, has been down and out, off and on, IQ feed has held like a champ this week." - Comment from Shirin
"Awesome response, as usual. It is a sincere and refreshing pleasure to do business with DTN, compared to your competition." - Comment from Ryan
"DTN has never given me problems. It is incredibly stable. In fact I've occasionally lost the data feed from Interactive Brokers, but still been able to trade because I'm getting good data from DTN." - Comment from Leighton
"I've been using Neoticker RT with IQFeed for two months, and I'm very happy with both of the products (I've had IQFeed for two years with very few complaints). The service from both companies is exceptional." - Comment from Public Forum
Home  Search  Register  Login  Recent Posts

Information on DTN's Industries:
DTN Oil & Gas | DTN Trading | DTN Agriculture | DTN Weather
Follow DTNMarkets on Twitter
DTN.IQ/IQFeed on Twitter
DTN News and Analysis on Twitter
»Forums Index »Archive (2017 and earlier) »IQFeed Developer Support »Having a problem with the interpretation of level 2 messages
Author Topic: Having a problem with the interpretation of level 2 messages (11 messages, Page 1 of 1)

shimo152
-Interested User-
Posts: 15
Joined: Mar 1, 2005

Failure is not quite as frighteing as regret.


Posted: Jan 20, 2007 04:50 AM          Msg. 1 of 11
I need someone to set me straight on this!

As I understand Level2 messages reviles the order book for a stock.

Now this is the way I collect them now:
Each ReceiveQuote event I get’ us loaded into an array where there is an entry for each market Maker (MM) and in order to see the book I run a sort on each side so the Bid side will be sorted Highest on top and the Ask side lowest on top.
Essentially I get the table below which is the true table of “KLAC” taken on Jan 16 2007 at 13:13.

The one thing that appears immediately is the fact that the best Bid is much Higher that the Best Ask and this is due to the fact that I do not know when to consider an entry obsolete.
Therefore I get the entry fron MSCO put in at 9:36 am still in the table confusing thing up.
My first question is: how do I know when to consider an entry obsolete?
My second question is what are the fields: reason’ condition_code and source_ID in the ReceiveQuote event.
Thanks in advance
Shimon


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Time: [13:13:13]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______________________________________________
| Bid || Ask |
______________________________________________
|MSCO |051.830|000001||CINN |050.510|000001|
|ETRD |051.590|000005||EDGX |050.510|000001|
|CDRG |051.510|000005||NSDQ |050.510|000004|
|BARD |051.340|000001||ARCX |050.510|000011|
|COWN |051.310|000001||AMEX |050.530|000010|
|DBAB |051.050|000001||BTRD |050.540|000003|
|GROW |051.000|000001||LEHM |050.540|000002|
|MOKE |051.000|000001||FBCO |050.560|000001|
|WBLR |050.790|000001||BOFA |050.770|000001|
|NITE |050.750|000001||FBRC |050.780|000001|
|RBCM |050.720|000001||SBSH |050.940|000001|
|SBSH |050.620|000001||AGED |051.110|000001|
|BOFA |050.590|000001||UBSS |051.110|000010|
|ARCX |050.500|000011||WBLR |051.570|000001|
|NSDQ |050.500|000002||DBAB |051.660|000001|
|CINN |050.500|000003||NFSC |051.700|000030|
|BTRD |050.500|000004||MADF |051.760|000001|
|AGED |050.500|000001||COWN |051.810|000001|
|AMEX |050.480|000010||CDRG |052.000|000001|
|LEHM |050.460|000002||MSCO |052.290|000001|
|TMBR |050.430|000001||GSCO |052.340|000001|
|GSCO |050.420|000001||WCHV |052.420|000001|
|FBCO |050.410|000001||OPCO |052.810|000001|
|EDGX |050.410|000020||ADAM |052.890|000001|
|UBSS |050.380|000010||RBCM |052.920|000001|
|OPCO |050.350|000001||CANT |052.930|000001|
|MADF |050.250|000005||PIPR |052.960|000001|
|WCHV |050.220|000001||JEFF |053.000|000001|
|SUSQ |050.000|000001||GROW |053.000|000001|
|PERT |049.900|000001||SUSQ |053.000|000001|
|FBRC |049.780|000001||MOKE |053.000|000001|
|STFL |049.600|000001||MLCO |053.000|000003|
|NFSC |049.400|000010||BARD |053.050|000001|
|CANT |049.200|000001||NITE |053.080|000001|
|ADAM |048.500|000001||PRUS |053.150|000001|
|MERI |048.500|000001||BMOC |053.190|000001|
|PIPR |048.450|000001||TMBR |053.580|000001|
|PRUS |048.400|000001||STFL |053.750|000001|
|JEFF |048.200|000001||PERT |053.800|000001|
|MLCO |048.080|000001||BERN |054.170|000001|
|BMOC |047.860|000001||MAXM |055.000|000001|
|BERN |047.400|000001||MERI |055.000|000001|
|MAXM |043.000|000001||THNK |075.000|000001|
|THNK |025.000|000001||STCS |100.000|000001|
|STCS |020.000|000001||AUTO |1000.000|000001|
|VNDM |000.010|000001||CRTC |2000.000|000001|
|NACI |000.010|000001||VNDM |199999.980|000001|
|AUTO |000.010|000002||ETRD |199999.980|000001|
|CRTC |000.010|000001||NACI |199999.980|000001|
______________________________________________

Shimon Dekel

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Jan 21, 2007 05:01 PM          Msg. 2 of 11
Some further info is available at this post:
http://forums.dtnma.com/index.cfm?page=topic&topicID=1192.

In addition, I've posted some code that may help to code for the price book and order book:
http://www.oneunified.net/blog/Trading/SmartQuant/IQFeedOrderBook.article

As a direct answer to your question, remove entries when you see a zero quantity. Bid and ask sides need to be handled independently.

shimo152
-Interested User-
Posts: 15
Joined: Mar 1, 2005

Failure is not quite as frighteing as regret.


Posted: Jan 22, 2007 05:50 AM          Msg. 3 of 11
Thanks stargrazer, This makes sense to me, I will give it a test.

Shimon Dekel

shimo152
-Interested User-
Posts: 15
Joined: Mar 1, 2005

Failure is not quite as frighteing as regret.


Posted: Jan 25, 2007 06:49 PM          Msg. 4 of 11
After some additional testing I am yet to get this right.
I have included two additional samples (out of many) that shows an unbalanced table

(Both samples are from January 25th 2007.)

Sample 1:
Stock: ADSK

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Time: [15:36:10]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______________________________________________
| Bid || Ask |
______________________________________________
|NSDQ |042.200|000004||EDGA |042.180|000001|
|CINN |042.200|000005||NSDQ |042.210|000001|
|ARCX |042.190|000003||ARCX |042.210|000007|
|AMEX |042.180|000010||CINN |042.220|000001|
|BTRD |042.180|000001||BTRD |042.220|000001|
|AUTO |042.150|000012||AMEX |042.230|000010|
|GSCO |042.140|000001||COWN |042.250|000001|
|EDGX |041.880|000005||GSCO |042.260|000001|
|COWN |041.850|000001||EDGX |043.150|000010|
|EDGA |000.000|000000||AUTO |044.000|000003|

“EDGA” on the ask side is lower that NSDQ on the bid side.
This is an unbalance table and an impossible situation.
Clearly EDGA on the Ask side is at fault and I went back to see its last entry and here it is:

L2-->MarketMakerID[EDGA ] Ask[042.180]/Bid[000.000] AskSize[000001]/BidSize[000000] Time[03:19:38] Reason[ :NDR] ConditionCode[R:REG OPEN ] SourceID[015]

It shows an ask side with a price of 42.18 and quantity of 1 (100)
This entry is apparently obsolete as the market has change and this is no longer the offer, but I had no way of telling this from the Level 2 feed.


Here is another sample:


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Time: [15:51:45]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
______________________________________________
| Bid || Ask |
______________________________________________
|ARCX |048.890|000005||BTRD |048.860|000001|
|NSDQ |048.890|000003||EDGX |048.890|000001|
|CINN |048.890|000001||CINN |048.900|000001|
|AMEX |048.860|000010||NSDQ |048.900|000004|
|ETRD |048.860|000008||ARCX |048.900|000011|
|UBSS |048.830|000004||AMEX |048.910|000010|
|LEHM |048.780|000001||LEHM |048.940|000001|
|JPMS |048.750|000001||TMBR |048.960|000011|
|FBCO |048.600|000001||WEDB |049.020|000001|
|TMBR |048.600|000012||COWN |049.050|000001|
|SALI |048.600|000001||JPMS |049.050|000001|
|KBRO |048.600|000001||WBLR |049.170|000001|
|RBCM |048.590|000001||ETRD |049.230|000010|
|OPCO |048.590|000001||BOFA |049.250|000001|
|SBSH |048.590|000001||BARD |049.280|000001|
|GSCO |048.580|000001||UBSS |049.330|000002|
|WCHV |048.580|000001||BEST |049.330|000001|
|BARD |048.580|000001||FBRC |049.490|000001|
|PRUS |048.550|000001||JEFF |049.680|000001|
|LAZA |048.550|000001||MADF |049.940|000001|
|COWN |048.550|000001||GSCO |050.000|000001|
|BEST |048.550|000001||WCHV |050.130|000001|
|DBAB |048.550|000001||CIBC |050.140|000001|
|THNK |048.510|000001||GROW |050.200|000001|
|MLCO |048.510|000001||SBSH |050.210|000001|
|WEDB |048.510|000001||PIPR |050.320|000001|
|CHLM |048.500|000001||MSCO |050.520|000001|
|PERT |048.500|000004||THNK |050.520|000001|
|NEED |048.500|000001||PACS |050.750|000001|
|HSBC |048.500|000001||OPCO |050.800|000001|
|EDGX |048.500|000002||PERT |050.860|000001|
|STFL |048.500|000001||CDRG |051.000|000005|
|BOFA |048.500|000001||STFL |051.000|000001|
|FBRC |048.490|000001||NEED |051.010|000001|
|PIPR |048.440|000001||NITE |051.240|000001|
|WBLR |048.400|000001||RHCO |051.250|000001|
|ADAM |048.400|000001||FBCO |051.490|000001|
|MSCO |048.380|000001||BMOC |051.540|000001|
|NITE |048.370|000001||HDLY |051.590|000001|
|PACS |048.250|000001||SALI |052.000|000001|
|CIBC |048.230|000001||MWRE |053.300|000001|
|HILL |048.200|000001||RBCM |053.730|000001|
|GROW |048.200|000001||KBRO |054.150|000001|
|JEFF |048.180|000001||ADAM |054.500|000001|
|BMOC |048.010|000001||PRUS |054.510|000001|
|HDSN |048.000|000001||TWPT |054.550|000001|
|TWPT |048.000|000001||MLCO |054.550|000001|
|CANT |048.000|000001||DBAB |054.600|000001|
|CDRG |048.000|000002||AUTO |054.800|000003|
|MAXM |048.000|000001||KING |054.970|000001|
|MADF |048.000|000003||HILL |055.450|000001|
|KING |047.990|000001||HSBC |056.000|000001|
|HDLY |047.890|000001||CHLM |056.000|000001|
|BERN |047.860|000001||NFSC |056.000|000002|
|BTRD |047.500|000042||CANT |056.000|000001|
|MWRE |047.000|000001||MAXM |057.000|000001|
|ALLN |046.000|000001||HDSN |057.000|000001|
|EFGI |045.000|000001||BERN |057.050|000001|
|FACT |045.000|000001||LAZA |059.810|000001|
|VNDM |045.000|000001||VNDM |060.000|000001|
|NFSC |040.460|000001||ALLN |060.000|000001|
|SUSQ |034.750|000001||FACT |060.000|000001|
|WEED |030.500|000001||EFGI |060.000|000001|
|STCS |020.000|000001||SUSQ |070.250|000001|
|CHDN |000.010|000001||WEED |075.520|000001|
|DOTC |000.010|000001||FRAN |099.990|000001|
|RHCO |000.010|000001||STCS |120.000|000001|
|BNCH |000.010|000001||CRTC |2000.000|000001|
|SEAB |000.010|000001||CHDN |2000.010|000001|
|CRTC |000.010|000001||SEAB |2000.200|000001|
|FSWC |000.010|000001||GARC |199999.980|000001|
|AUTO |000.010|000002||DOTC |199999.980|000001|
|FRAN |000.010|000001||FSWC |199999.980|000001|
|GARC |000.010|000001||BNCH |199999.980|000001|
|FAGI |000.010|000001||FAGI |199999.980|000001|
|ISSE |000.000|000000||EDGA |000.000|000000|


“BTRD” on the ask side is at fault and the last entry from “BTRC” is here:

L2-->MarketMakerID[BTRD ] Ask[048.860]/Bid[047.500] AskSize[000001]/BidSize[000042] Time[03:47:46] Reason[ :NDR] ConditionCode[R:REG OPEN ] SourceID[005]

Again a situation that the offer is obsolete but I had no way of telling that from the feed.

I need to resolve this so I can continue with my development.
Anyone?

Shimon Dekel

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Jan 25, 2007 06:59 PM          Msg. 5 of 11
Those crossings appear to happen in fast moving markets. I see it happen in a number of symbols. I'd just take them with a grain of salt as they will quickly unravel themselves. I've even used them as 'decision' points for determining whether to get into or out of a trade.

nsolot
-DTN Guru-
Posts: 273
Joined: Sep 4, 2004


Posted: Jan 25, 2007 09:15 PM          Msg. 6 of 11
I prefer using regional quotes to get a better sense of current market bid and ask. Quite frequently Level 1 & 2 shows obselete bid or ask. I've coded my model to watch the most active regional markets and if 2 of them agree on bid & ask, that's what I assume to be current & correct.

DTN_Jay_Froscheiser
-VP, Product Operations-
Posts: 1746
Joined: May 3, 2004

DTN IQFeed/DTN.IQ/DTN NxCore


Posted: Jan 26, 2007 10:10 AM          Msg. 7 of 11
It may be worth upgrading to a DTN.IQ subscription if you don't have one already. This will allow you to use our DTN.IQ client software as well as 3rd party (your own) software. Within the DTN.IQ client software is a very nice Level II display that sorts and color codes the tiers at various prices. You can highlight a MMID to follow them. It also greys out any MMID that isn't in the market (Condition code L or zero price/volume). It may be a good sanity check as you develop your app. If you currently have the basic IQFeed, upgrading to DTN.IQ would only be $9 per month more if you pay annually (you already pay the API fee annually). You will then be able to use the GUI (nice for news, Level II or simple watch lists) and it increases the symbol limit to 1300.

Jay Froscheiser
DTN - Trading Markets

shimo152
-Interested User-
Posts: 15
Joined: Mar 1, 2005

Failure is not quite as frighteing as regret.


Posted: Jan 26, 2007 12:04 PM          Msg. 8 of 11
Thanks guys, I understand that life is not always an exact science and I will have to apply an intelligent filter to get read of some inaccuracies.
Something you said Stargrazer sparked my interest!
How would you use those inaccuracies to determine whether to get into or out of a trade?

As for what you said Jay, thanks, I am looking at upgrading anyway but never the less the Idea is that my software will do this all by itself automatically and will not depend on me to read this for it.
I need is assistance in interpreting your data and I am having problems doing this now.
Thanks
Shimon Dekel

Shimon Dekel

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Jan 26, 2007 06:10 PM          Msg. 9 of 11
Quote: How would you use those inaccuracies to determine whether to get into or out of a trade?


I had developed a Genetic Programming module and fed it quotes, trades and some indicators. It optimized to the point where one of the trade enter/exit conditions keyed on bid > ask. I ran the optimizer over two days. Out of sample testing didn't result in a ongoing success. I'm developing some different indicators and am planning to rerun at a later date. Next week I'll start writing about my trials and tribulations of brute forcing an automated trading strategy at http://www.oneunified.net/blog/Trading/index.blog

nsolot
-DTN Guru-
Posts: 273
Joined: Sep 4, 2004


Posted: Jan 26, 2007 09:39 PM          Msg. 10 of 11
Personally, I'd be very hesitant to use crossed bid/ask for any purpose other than to be suspect of the current market conditions. I've studied this carefully and found it is typical of 1) fast market conditions (slow quotes coming from a source), or 2) technical problems at an exchange or ECN. I suspect (but could very well be wrong) that trades will not get filled on the erroneous side.

Technical problems still seem to plauge various exchanges on a regular basis. If by chance you use Interactive Brokers, they pop up messages advising of such. The problem is that when coding an ATS, the notification happens minutes after the problem occurs. I'd be very concerned about an ATS placing an order into a market where the quotes are suspect to begin with.

I'd be happy to continue on this topic, but we should move it to another section of the forum, as it's strayed from "developer support".

stargrazer
-DTN Guru-
Posts: 302
Joined: Jun 13, 2005

Right Here & Now


Posted: Jan 26, 2007 10:12 PM          Msg. 11 of 11
 

 

Time: Sun May 19, 2024 3:25 AM CFBB v1.2.0 7 ms.
© AderSoftware 2002-2003