Research
Research copied to clipboard
How to retreive historical Option Data in C#
Hello!
I am trying to understand how I get retreive historical option chain data and how found this code in one example.
But this C# code does not compile. I am trying to use this code in the terminal here: https://www.quantconnect.com/terminal/#
option = qb.AddOption("SPY", Resolution.Minute)
option.SetFilter(-2, 2, timedelta(0), timedelta(20))
option_history = qb.GetOptionHistory(option.Symbol, datetime(2017, 1, 4, 10 ,0, 0), datetime(2017, 1, 4, 10 ,5, 0),sort = True)
df = option_history.GetAllData()
print(df.tail())
Is it possible to know how to write a code that is complete including the correct classes etc that prints out the requested optionHistory Data. That would be so greatful as I can't find such example?
Kind Regards