Understanding interactive brokerage events

When fetching financial tick data using Interactive Brokers API methods tickPrice

or the tickSize

data will have the following parameters

  • tickerId (character)
  • field (1 = bid, 2 = request, 4 = last, 6 = high, 7 = low, 9 = closed)
  • price
  • canAutoExecute

From any other feed I expect the tick to give me

  • tickerId (character)
  • rate
  • ask
  • bet size
  • set size

So my question is, should I store a dictionary with a ticker as a key and a struct as a value containing the above five properties, so that every time a tick event occurs, I would update the struct property and send the entire structure to my database as teak? Ideally my tick database would look something like this.

Date        Time            Symbol  Side    Price   Quantity
2012-10-31  13:51:13.784    AAPL    Bid     25.81   15007
2012-10-31  13:51:14.615    AAPL    Bid     25.82   10
2012-10-31  13:51:14.633    AAPL    Bid     25.81   13623
2012-10-31  13:51:14.684    AAPL    Ask     25.82   2500
2012-10-31  13:52:09.168    AAPL    Bid     25.80   12223

      

From the IB API documentation: This method is called when market data changes. Does this mean that if, for example, the offer price is updated, the rest of the properties will remain the same?

+3


source to share


3 answers


You're right. Whenever a certain property changes, a new tick event will be triggered. Your design of using a framework to save a tick snapshot is one of the standard approaches.

In other words, the IB API will send back each aggregated tick as it comes in. However, these ticks are not real ticks, as they are only 0.2 - 0.3 seconds. ... If you are dealing with HFT, this data can be reliable for modeling a book model. However, if you are just doing basic data analysis, then the quality is acceptable.



Their high, low and close price may not be appropriate in this case, since the high, low close information will not be indicated in the standard order book. I usually give them up. The bid size and request size are also unreliable in this case, as they are just synthetic ticks.

Hope my answer helps.

+5


source


It depends on what you enter in the method : reqMktData()

void reqMktData(       TickerId          id,
                 const Contract         &contract,
                       IBString         &genericTicks,
                       bool              snapshot,
                 const TagValueListSPtr &mktDataOptions
                       )

      



If you write , you will get data snapshots every ~ 0.2-0.5 seconds. If the rate or price moves, you will see it. snapshot = true

If you write , you get a new variable rate, or ask each time it changes. snapshot = false

+5


source


If you are considering a data link that IB provides, consider a situation where you want to update data in a display form / page. In this case, if the exchange generates a new best offer rate at the same offer price, only with a different size, then it makes sense to send the new size (and not the offer price again, which has not changed). In addition, IB will execute these changes for about 200 or 300 milliseconds, so not every change propagates.

If you look at it in this context, a data feed is actually quite efficient in terms of minimizing the size and frequency of posts.

Most people are familiar with what provides a more complete set of Level 1 data (for example, a consolidated citation system). In this case, each price or size change generates a complete new offer containing all fields.

What type of data feed you require depends on your specific use case. For example, I worked to provide clients with very detailed (e..g, every quote message) billions of records to find that they were aggregating data into 1 minute OHLCV bands.

So it really is a matter of how your data complies with the analysis requirements. In some cases, IB data will work very well. In other cases it won't.

+1


source







All Articles