TWS API Help: Day's Opening Price

Discussion in 'Trading Software' started by GTG, Jul 16, 2011.

  1. GTG


    How do you obtain the day's opening price from the TWS API? From the API examples, I was thinking I should be checking for tickType==14 in the tickPrice handler, but tickType 14 never shows up. While, I'm at it, I've also never seen TickType=6, or TickType=7 (presumably the day's high and low?) come through the tickPrice handler either. Is there something extra I need to do to enable these tick types, or perhaps I'm mistaken about checking for these in the tickPrice handler?
  2. Check out historicalData(), input exchange open time, then get opening bar price.
  3. GTG


    Just to clarify, I was talking about getting the day's official opening price during live trading like is shown within Trader Workstation. Are you saying that during the regular trading day, I can call "reqHistoricalData()" and request a daily bar for the current day, and get the current day's official open? Also, if so, what will happen if I call reqHistoricalData to get today's open, but the stock hasn't opened yet?
  4. It is 14.
    I've had some issues with that in the past as well.

    I don't think it ever shows up on the simulator (edemo/demouser)
    It does show up in the paper trading account and in the live account.

    Also make sure you restart TWS daily, I've used IBController in the past and that also caused issues with the open tick.
  5. GTG


    Thanks for your help guys. I am getting tick 14 now and those other ticks as well. It looks like the times I had originally tested this during live trading, I had a small bug in my code that was excluding the tick, and other times I was testing this using the edemo/demouser account when those ticks don't show up as you mentioned.
  6. Bob111


    open is the tricky one...the other option would be to subscribe to the data from main exchange(NYSE for example),not SMART, and pick very first trade after 9:30.
    on top of that i would test both methods for a)accuracy, b) speed.
    how fast tick14 fires after open and how accurate the data?
    i remember some issues(don't remember with whom)where API fires open after first trade > 9:30, and later all off sudden after "official"open price was "announced" it's roll back their own "open", if the numbers did not match. you really have to play with it for while,if you planning to use it in calculations,where accuracy is important.