Dinosaur Technology and Trading » Dinosaur Technology and Trading

Getting market data with time?

(6 posts)

  1. clam61
    Member

    Hi Karl, thanks so much for this software.

    As for my question, I'm trying to draw a realtime chart using your software. The problems I see are as follows.

    1. If I use the ReqHistoricalData function, one of the arguments is the end time. I could be wrong, but it seems I would need to constantly call ReqHistoricalData function and pass in the current datetime. This leads to some lag problems because I have to first query for the current server time, right?

    2. Another option is to use the reqMarketData function once, which is great because the tick event will constantly fire off. The problem is that the data passed via the tick event handler does not have a time associated with it. So if I am creating a 15 minute chart, I would have to calculate the 15 minute intervals myself...and to be the most precise I would have to constantly call the function to get the current server time.

    Posted 3 months ago #
  2. IB unfortunately does not provide time data with the ticks. I suggest using the real time bars instead of the market ticks.

    See - public void RequestRealTimeBars(int tickerId, Contract contract, int barSize, RealTimeBarType whatToShow, bool useRth).

    You can then begin with the real time data, then backfill with the historical bars. I believe the real time bars only come in 5-sec bars, but you can combine them to get bigger bars if you need.

    Posted 3 months ago #
  3. clam61
    Member

    i assume that because the realtimebars only come in 5 second bars, that data also comes in every 5 seconds and not every tick?

    if i am running a realtime intrabar (orders fired intrabar) forex strategy that is based on 15 minute bars what would you recommend? it seems like the best method would be to use the tick data and to create 15 minute bars from the tick data...trying to synchronize with the server time.

    question:

    when you query for the server time via your API, does TWS send a message to the server to query for the current time or does it already have a server time in memory

    Posted 3 months ago #
  4. I think the RT bars update with new tick data as opposed to every 5 seconds, but I am really not sure.

    I would suggest using the real time bars, as the real time ticks are not guaranteed to catch the real high/low/close values, they are just a sub set of all ticks.

    I am not sure about the time question. I think TWS probably caches it.

    Posted 3 months ago #
  5. ap
    Member

    The realtimebars come in 5-sec intervals with correct timestamp five seconds after the point in time noted in the timestamp. For a new 15 minute bar, the first realtimebar comes 5 seconds into the bar.
    Use the tickprice and ticksize event to generate your bars, and additionally update your bar through the realtimebar event.

    Posted 3 months ago #
  6. Neil
    Member

    ap, how more specifically do you generate and store bars greater than 5 seconds in length? I have an inkling on how to do it, but if you have it already figured out, it would be nice if you could post your code for how you do it so that we may all benefit.

    You too Karl, if you have code for generating and storing bars greater than 5 seconds in length please post it.

    Posted 2 months ago #

RSS feed for this topic

Reply

You must log in to post.