Skip to content

OptionStrategies fail silently when a contract is missing #8045

@DerekMelchin

Description

@DerekMelchin

Expected Behavior

When we call one of the OptionStrategies functions, if it can't find the selected contracts in the OptionChain, it throws an error message.

Actual Behavior

It throws no error message. We only get an error message after we try to place the order.

Potential Solution

The leg 'SPY 210416C00390000' does not have an active subscription.

or

short_straddle = OptionStrategies.short_straddle(self._option_symbol, strike, expiry)
if short_straddle.is_tradable:
    tickets = self.buy(short_straddle, 1)

Reproducing the Problem

In this algorithm, the call contract is removed from the chain but the put contract remains in the chain.
As a result, when I try to create the Option strategy the second time, I get

The security with symbol 'SPY 210416C00390000' is marked as non-tradable.

(and end up with a missing leg)
https://www.quantconnect.com/terminal/processCache?request=embedded_backtest_f06123357019037c268be2826cc9fb5d.html

2021-03-22 09:31:00 2021-03-22 09:31:00 - 0 in chain
2021-03-22 09:31:00 2021-03-22 09:31:00 - 1 in chain
2021-03-22 09:31:00 2021-03-22 09:31:00 - expiry: 2021-04-16 00:00:00; strike: 390.0
2021-04-12 06:30:00 2021-04-12 06:30:00 - exercised
2021-04-12 09:31:00 The security with symbol 'SPY   210416C00390000' is marked as non-tradable.
2021-04-12 09:31:00 2021-04-12 09:31:00 - 1 in chain
2021-04-12 09:31:00 2021-04-12 09:31:00 - expiry: 2021-04-16 00:00:00; strike: 390.0

System Information

QC Cloud

Checklist

  • I have completely filled out this template
  • I have confirmed that this issue exists on the current master branch
  • I have confirmed that this is not a duplicate issue by searching issues
  • I have provided detailed steps to reproduce the issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions