Skip to main content
  • Signal +1 → open a bear call spread (sell higher delta, buy lower delta call)
  • Signal -1 → open a bull put spread (sell higher delta, buy lower delta put)
  • Signal 0 → no action; hold existing position
Each time a new signal fires, any open position is closed first, then a fresh spread is entered.

Setup

Strategy

VerticalSpreadsWithSignals extends Strategy and overrides on_update(). On each pulse it:
  1. Looks up the current date in _signals - if no entry exists the signal is 0 (no trade).
  2. Resolves the target expiry using resolver.expiry.relative with a minimum DTE filter.
  3. Resolves the short and long strikes by delta using resolver.strike.delta.
  4. Closes any existing position, then submits two orders to form the spread.
The spread width is determined by the gap between short_delta and long_delta (e.g. 0.30 vs 0.20 → a 10-delta-wide spread).

Signal Conversion Helper

The strategy expects signals as a dict[datetime, int]. This helper converts a DataFrame (with timestamp and signal columns) into that format.

Load Signals

Load signals from a parquet file. Each row has a timestamp and a signal value (+1, -1, or 0).

Run the Strategy

Configure and run the strategy on hourly BTC crypto options (CRY.BTCUSD.DER_1h):
Output

Equity Curve

Chart output 1

Trades

Output

Statistics

Output
Last modified on November 4, 2026