Future Contract Marked as Non-Tradable Has Data In Slice.FutureChains
Expected Behavior
If a futures' contract is marked as non-tradable, it shouldn't have data in the Slice.FutureChains object and vice-versa.
Actual Behavior
If a futures' contract is marked as non-tradable has data in Slice.FutureChains object.
Potential Solution
N/A
Reproducing the Problem
The following algorithm selects ZC14U21 (expiry 2021-09-14) on 2021-06-15 08:38:00. It shouldn't be filtered out since the filter selects contracts up to 120 days, and this contract expires in 30 days:
from AlgorithmImports import *
class HipsterBlackFrog(QCAlgorithm):
def Initialize(self):
self.SetStartDate(2021, 5, 18)
self.SetEndDate(2021, 6, 30)
self.ZC = self.AddFuture(Futures.Grains.Corn, Resolution.Minute)
self.ZC.SetFilter(0, 120)
self.sessionStartMM = 518
def OnData(self, data: Slice):
if self.sessionStartMM == data.Time.hour * 60 + data.Time.minute:
for chain in data.FutureChains.Values:
contract = next(contract for contract in chain
if contract.Expiry.month in [9])
if contract:
if not self.Securities[contract.Symbol].IsTradable:
self.Log(f'{self.Time} :: {contract.Symbol.Value}/{contract.Symbol.ID.Date:%y%m%d} is not tradable, but we have data in the FutureChains')
return
self.MarketOrder(contract.Symbol, 1, False)
self.MarketOrder(contract.Symbol, -1, False)
Checklist
- [x] I have completely filled out this template
- [x] I have confirmed that this issue exists on the current
masterbranch - [x] I have confirmed that this is not a duplicate issue by searching issues
- [x] I have provided detailed steps to reproduce the issue
Odd question, can I just assign myself to this issue and just start working on it?
Hey @kfwojton! Sorry for the delay, are you still up for the task? if so, please let us know and can go for it 🚀
Hi Martin,
I'm completing a futures issue study and will be sending the results to Alex when I'm done. I think that the non-tradable issue is related to a number of things. But, you will find that when a continuous future has a rollover, the expiring Future is marked non-tradable even though it is still an active and tradable Future until it's actual expiration.
Dave
On Thu, Aug 25, 2022 at 1:17 PM Martin-Molinero @.***> wrote:
Hey @kfwojton https://github.com/kfwojton! Sorry for the delay, are you still up for the task? if so, please let us know and can go for it 🚀
— Reply to this email directly, view it on GitHub https://github.com/QuantConnect/Lean/issues/6525#issuecomment-1227610255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAUTJIVVNOOIYTTUJ5P26EDV262D7ANCNFSM55TPNBQA . You are receiving this because you are subscribed to this thread.Message ID: @.***>
This issue no longer reproduces in master, believe it was fixed recently by https://github.com/QuantConnect/Lean/pull/6692