Lean
Lean copied to clipboard
Incorrect Monthly FOP in Currency Futures
Expected Behavior
Only quarterly contracts (Mar, Jun, Sep, Dec) has FOP
Actual Behavior
We are FOP for non-quarterly contracts: 2019-01-02 09:31:00 : | 6A14F19 :: 20190104 2019-01-02 09:31:00 : | 6A15G19 :: 20190208 2019-01-02 09:31:00 : | 6A18H19 :: 20190308 FOP expiring on 20190104, 20190208 and 20190308 refers to 6A18H19, not F19 and G19.
See https://www.cmegroup.com/markets/fx/g10/euro-fx.contractSpecs.options.html
Potential Solution
Reproducing the Problem
class CurrencyFutureAlgorithm(QCAlgorithm):
def initialize(self) -> None:
self.set_start_date(2019,1, 1)
self.set_end_date(2019,1, 15)
self._future = self.add_future("6A")
self._future.set_filter(0,92)
self.add_future_option(self._future, option_filter=lambda x: x.calls_only().strikes(0,1))
self._day = 0
def on_data(self, slice: Slice) -> None:
if self.time.day == self._day:
return
for symbol, chain in slice.option_chains.items():
self.log(f'{symbol.underlying.value} :: {",".join(sorted(set([f"""{x.expiry:%Y%m%d}""" for x in chain])))}')
self._day = self.time.day
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
The screenshot from the Desktop InteractiveBrokers Trader Workstation app.