How to retrieve data only up to open of current trading session? #64
-
Hello, I am trying to retrieve data using ib.reqHistoricalData. And I want to make reference to open price of the current trading session (instead of calendar day) for instruments which trade almost around the clock e.g. ES, GC, etc. I am thinking of using pandas loc and locate row 0. However, durationStr = 1D returns 1 calendar day worth of bars. Are there ways to work around this? Thank you. Nicholas |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
this looks more like "how do i get the current trading session?" question. to get the open price, i usually do ticker = ib.reqMktData(contract)
ib.sleep(1)
ticker.open which will only work if the session is open hope it helps |
Beta Was this translation helpful? Give feedback.
this looks more like "how do i get the current trading session?" question.
I use exchange calendars or eventually historical schedule
to get the open price, i usually do
which will only work if the session is open
hope it helps