开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: Option Open Interest


 

Thank you!

Confirming that the following code works both during and before and after market open hours:
?
from ib_async import *
import time
?
ib = IB()
ib.connect('127.0.0.1', 4001, clientId=170)
?
ib.reqMarketDataType(1)
?
contract = Option('GOOGL', '20250117', 195, 'C', 'SMART')
contract = ib.qualifyContracts(contract)[0]
?
print("Printing contract")
print("")
print(contract)
print("")
?
a = ib.reqMktData(contract, genericTickList='100,101')
ib.sleep(2) # wait 2 seconds for the first data packets to arrive
?
print("Printing requested market data")
print("")
print(a)
print("")
print("marketDataType is ", a.marketDataType)
print("end of printing")
?
ib.disconnect()
?
The output of the relevant variable "a" on 31 December 2024 after market close is:
?
?
Ticker(contract=Option(conId=584786601, symbol='GOOGL', lastTradeDateOrContractMonth='20250117', strike=195.0, right='C', multiplier='100', exchange='SMART', currency='USD', localSymbol='GOOGL 250117C00195000', tradingClass='GOOGL'), time=datetime.datetime(2024, 12, 31, 22, 26, 39, 1784, tzinfo=datetime.timezone.utc), minTick=0.01, bid=-1.0, bidSize=0.0, ask=-1.0, askSize=0.0, last=2.01, lastSize=5.0, volume=3203.0, high=3.15, low=1.88, close=3.14, putOpenInterest=0.0, callOpenInterest=22092.0, ticks=[TickData(time=datetime.datetime(2024, 12, 31, 22, 26, 39, 1784, tzinfo=datetime.timezone.utc), tickType=5, price=2.01, size=5.0)], bidGreeks=OptionComputation(tickAttrib=0, impliedVol=0.25391115222998306, delta=None, optPrice=None, pvDividend=0.0, gamma=None, vega=-2.0, theta=-2.0, undPrice=189.0066375732422), askGreeks=OptionComputation(tickAttrib=0, impliedVol=0.25592227507404464, delta=None, optPrice=None, pvDividend=0.0, gamma=None, vega=-2.0, theta=-2.0, undPrice=189.0066375732422), lastGreeks=OptionComputation(tickAttrib=0, impliedVol=0.2561369063292868, delta=0.3078586406258187, optPrice=2.009999990463257, pvDividend=0.0, gamma=0.03386755720078562, vega=0.1486588979505994, theta=-0.11558233715117001, undPrice=189.0066375732422), modelGreeks=OptionComputation(tickAttrib=0, impliedVol=0.25530032176703077, delta=0.30719285939414664, optPrice=1.9897448496104688, pvDividend=0.0, gamma=0.033950430193128225, vega=0.14867813869422197, theta=-0.11512370414862398, undPrice=189.0066375732422), bboExchange='c70003', snapshotPermissions=3)
?
?
?
?

Join [email protected] to automatically receive all group messages.