QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
8.96k stars 3.14k forks source link

Add Support For Option Tick Data #2959

Closed jandykwan closed 1 year ago

jandykwan commented 5 years ago

I am using the Lean engine to backtest, I add subscribe to the tick data with the following code:

AddOption(UnderlyingTicker, resolution: Resolution.Tick);

but i found the engine try to load the second data. 

I found the following line in OptionChainUniverseSubscriptionEnumeratorFactory line 114:

// Making sure data is non-tick var resolution = config.Resolution == Resolution.Tick ? Resolution.Second : config.Resolution;

why do this?

Doggie52 commented 5 years ago

Tick resolution option data is not available: https://www.quantconnect.com/data/tree/option/usa

jandykwan commented 5 years ago

I have downloaded the Tick data to my disk, would i do the Tick resolution backtest locally with the engine?

jaredbroad commented 5 years ago

Sorry it is not supported at this time. As its a rare request I can't give an ETA at this time. To confirm you want to do options tick resolution backtesting?

On Tue, Feb 26, 2019, 6:11 AM jandy notifications@github.com wrote:

I have downloaded the Tick data to my disk, would i do the Tick resolution backtest locally with the engine?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/QuantConnect/Lean/issues/2959#issuecomment-467452651, or mute the thread https://github.com/notifications/unsubscribe-auth/ACI6me0OvtEud26i5Q8xDGsrTAMz68EPks5vRUCIgaJpZM4bRasR .

jandykwan commented 5 years ago

Yes. I want to do some HFT backtest base on the tick history. I think Lean can do this.

jaredbroad commented 5 years ago

This should be possible with a touch of work:

It's forcing the underlying to be a trade bar so it can be filled forward (ticks can't be copied forward as they are point values) -- this is so we always have a bar when we calculate the options universe. I think this only applies to the underlying, not the options trades themselves. If you tweak it a little to only apply that resolution to the underlying subscription it might work.