Time stamp for bid/ask IB API C#

Discussion in 'App Development' started by BrazilForever, Mar 1, 2015.

  1. Hello Everyone,

    I am curious, if it is possible to retrieve time stamp for bid/ask. In the example below I am requesting data on SPX option.

    Code:
     
    Contract contract1 = new Contract();
    contract1.ConId = DataCollection[0].Summary.ConId;
    contract1.Symbol = DataCollection[0].Summary.Symbol;
    contract1.SecType = DataCollection[0].Summary.SecType;
    contract1.Exchange = "SMART";
    contract1.Right = DataCollection[0].Summary.Right;
    contract1.Strike = DataCollection[0].Summary.Strike;
    contract1.Expiry = DataCollection[0].Summary.Expiry;
    List<TagValue> BogusmktDataOptions = new List<TagValue>();
    ibClient.ClientSocket.reqMktData(2, contract1, "", true, BogusmktDataOptions);
    
    The output looks like;

    Tick Price ...
    Tick Size ...
    Tick Price ...
    Tick Size ...

    Each Tick Price and Tick Size contains info for either bid or ask.

    I read that reqMktData is supposed to call tickString, which contains time stamp, but for some reason I do not see it in output.

    Also I am new to internet trading, what does term "Tick" exactly mean?

    Regards,
    BrazilForever
     
  2. "Tick" can have a couple of meanings:
    1) Smallest increment of a trading instrument.
    2) A single trade.

    In this case, you are referring to #2.

    You probably want to read up on Interactive Brokers data feed, as it is not a true "tick" stream in the sense that many other vendors (where every single trade gets transmitted). IB sends an aggregate data stream, not one tick per trade...I forget the actual specifics, but it's been discussed a fair amount online (both pro and con). It's the collection of trades that occurred in the last 500ms or something along those lines. So when you see a volume of 20, that could have been a single 20 lot trade, 4x5lots, or any combination that gets you 20. Trade price is actually the average price over the period.

    It wouldn't make sense anyway, as there may have been a number of actual "ticks" in a single transmission. I seem to recall that I attached a time stamp from my local clock when storing the data in my historical database.
     
    BrazilForever likes this.
  3. Also, although you use local time to get the time a tick occurred, I believe you can get the IB server time as an event when you connect. This allows you to make sure your local time is in sync with the server.
     
    BrazilForever likes this.
  4. MD99

    MD99

    When a trade takes place at a new price then the normal sequence is timestamp, trd price, trd size. If the trade is at the same price as the prior trade then just a trd size record is sent.

    This may depend on what type of instrument you are looking at. If it's FX then I wouldn't expect to see any trade records.
     
    BrazilForever likes this.
  5. Risk619

    Risk619

    For whatever it's worth I've liked having my data source different from my brokerage. IB's data has a lot going for it, but keeping them as two completely different pieces of software is nice from a responsibility stand point. Really different application needs as well.

    And I wanted tick.
     
    BrazilForever likes this.
  6. I only use FIX (I do not use the IB data feed, only use IB for executions), but if memory serves well I remember that via API you need to use Tags when you subscribe to market data in order to inform which events will be raised. One such Tag I think was called "Server Time", meaning the time on IB's side a "tick" (or just bid or ask in case of FX data) was sent. But again I am not 100% sure this is still the case or whether I remember correctly.

    The definition of time for any non exchange-traded products is murky at best anyway: The time the liquidity provider sourced the price, submitted the price, the time IB received the price from the liquidity provider, the time IB created its own price update, or the time IB sent out the update. I do not know to be honest, best to ask if you really care. But as someone correctly pointed out, IB does not offer a true tick data feed hence the time of price update is somewhat moot.

     
    BrazilForever likes this.