TL;DR
Build a call calendar spread in four steps: describe it to Aurora, check the saved rules, backtest it, follow a trade. Start from the worked example below: copy its rules, then change the ticker, dates or exits and test your version. On SPY in 2024 it returned -7.94% against 25.30% for SPY, and its maximum drawdown was 7.94%.
How to build a call calendar spread
1. Describe it to Aurora
Open the prepared request. Aurora receives the exact rules shown here and checks them without saving a portfolio. Review its preview before choosing whether to save or test your own version.
A preview of the rules and their validation result. Any invalid inputs are identified before you decide what to save.
2. Check the saved rules
Start with the actual rules used in this example. Days to expiration means the days remaining until the option expires. The complete editor inputs and SDK functions are available below.
- Entry
- Open when SPY’s 14-day relative strength index (RSI) is between 45 and 55, and no matching option position is open.
- Position sizing
- One strategy unit; leg ratios apply. Buying power, collateral and liquidity can restrict orders.
- Signal exit
- Close all matching option legs when RSI falls below 40 or rises above 60, or when 14 or fewer days remain until expiration.
- Starting capital
- $10,000.00
- Leg 1
- Buy 1 call contract per unit, targeting a strike nearest SPY’s price. Choose the nearest available expiry 60 to 90 days away.
- Leg 2
- Sell 1 call contract per unit, targeting a strike nearest SPY’s price. Choose the nearest available expiry 30 to 45 days away.
The entry decides when to open. The leg selectors choose contracts. The allocation sets size, and the exit decides when to close. Keep these parts together in your draft.
Portfolio value (USD)
- Call calendar spread 2024-12-31, 21:00:00 UTC
- $9,206.09
- Full-capital SPY buy and hold 2024-12-31, 21:00:00 UTC
- $12,530.29
Call calendar spread: 7.94% largest decline in plotted observations. 2024-01-02, 14:30:00 UTC ($10,000.00) to 2024-12-30, 21:00:00 UTC ($9,206.09).
3. Backtest it
Compare the two recorded curves and the result below. SPY invests the full starting balance; this options candidate uses its saved allocation. Their fees and invested capital differ.
- Candidate vs full-capital SPY
- -7.94% vs 25.30%
A completed 2024 curve beside full-capital SPY. The example returned -7.94% with a 7.94% reported maximum drawdown and $101.40 in commissions.
4. Follow one trade
Follow each leg of one recorded position from its opening fill to its close.
- Call · $598 strike · Feb 28, 2025
- Dec 27, 2024 14:31 UTC: buy to open 1 at $15.5860 per share; $0.65 fee. Dec 30, 2024 14:31 UTC: sell to close 1 at $10.2800 per share; $0.65 fee.
- Call · $598 strike · Jan 31, 2025
- Dec 27, 2024 14:31 UTC: sell to open 1 at $10.6541 per share; $0.65 fee. Dec 30, 2024 14:31 UTC: buy to close 1 at $5.8150 per share; $0.65 fee.
These Filled orders show one captured position from the run. Its recorded opening and closing cash flows sum to $-49.28 after commissions. Inspect every leg and ratio; the engine's closed-trade count can count option legs rather than whole spread round trips.
Four steps take a call calendar spread from an idea to a tested strategy. Each step uses the SPY worked example.
The rules that define it
Entry
45 <= RSI(SPY,14,Day) <= 55 AND zero matching option positions
Position sizing
One strategy unit; leg ratios apply. Buying power, collateral and liquidity can restrict orders.
Signal exit
RSI(SPY,14,Day) < 40 OR > 60; close whole matching spread at 14 or fewer DTE
Starting capital
$10000.00
Spread type
calendar
Execution
Market; $0.65 commission per option contract, default 0.5 half-spread fraction plus applicable liquidity impact.
Show the table · 6 rows, 2 columns
| Rule | Saved candidate |
|---|---|
| Entry | 45 <= RSI(SPY,14,Day) <= 55 AND zero matching option positions |
| Position sizing | One strategy unit; leg ratios apply. Buying power, collateral and liquidity can restrict orders. |
| Signal exit | RSI(SPY,14,Day) < 40 OR > 60; close whole matching spread at 14 or fewer DTE |
| Starting capital | $10000.00 |
| Spread type | calendar |
| Execution | Market; $0.65 commission per option contract, default 0.5 half-spread fraction plus applicable liquidity impact. |
No matching rows. Clear the filter to see all records.
Contract selectors and ratios
Inspect contract selectors and ratios
Strike distances are percentages of the underlying price, not fixed market strikes or delta targets. Positive distance means out of the money: a higher strike for calls and a lower strike for puts. Negative distance means in the money; zero targets at the money (ATM). Days to expiration (DTE) measures the time remaining until a contract expires. Nearest expiration must lie within each leg's DTE range. Inspect the resolved contracts rather than assuming the authored offsets produce exact strike widths.
These legs intentionally use different expirations. A single-expiration payoff diagram does not describe the whole position. Inspect each selected expiration, the short-leg lifecycle and reserved collateral.
Scroll sideways to compare all columns. Select a heading to sort.
| 1 | long | call | 0% | 1 | 60 to 90 DTE |
| 2 | short | call | 0% | 1 | 30 to 45 DTE |
No matching rows. Clear the filter to see all records.
Save it as a draft
Show how to save the draft
Ask Aurora to build the rules above, review the preview, then save the draft while keeping automated trading off. A chat draft is inspected in Portfolio > Drafts or Aurora; the native Strategies editor belongs to a paper or live portfolio.
In an inactive native portfolio, use Open Options Position, choose the matching structure preset and verify each leg above. Under Allocation, set Type Contracts and Amount 1. Add the entry conditions, including zero matching option positions. Add both Close Options Position rules separately, matching SPY and the spread type with close scope spread and quantity all. A preset adds contract legs; it does not supply the complete entry or exit algorithm.
Create and backtest with Python
Use the Python SDK instead of Aurora
Python SDK 1.42.0. Save the runner below as run_call_calendar_spread.py.
Install and download
python3 -m pip install nexustrade==1.42.0
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output call_calendar_spread.py https://nexustrade.io/seo/strategy-examples/call-calendar-spread.py
Create, test and inspect
from call_calendar_spread import create_call_calendar_spread, backtest_call_calendar_spread
book = create_call_calendar_spread()
completed = backtest_call_calendar_spread()
print(completed["result"])
Run
python3 run_call_calendar_spread.py
Python strategy and backtest functions
View complete Python SDK functions
The backtest function submits the 2024 test with SPY as its benchmark, records events and waits for the result. Use a new request key when changing rules, dates or fees.
import nexustrade as nt
def create_call_calendar_spread():
asset = nt.stock_asset("SPY")
return nt.portfolio(
"Public SEO example - Call calendar spread",
[
nt.strategy(
"Open Call calendar spread",
(((nt.RSI(asset, 14, "Day") >= nt.Value(45)) & (nt.RSI(asset, 14, "Day") <= nt.Value(55))) & (nt.OptionPositionCount("SPY", "call", "long", "calendar") == nt.Value(0))),
nt.open_option(
builder=nt.options_builder(
legs=[
nt.leg(
option_type="call",
direction="long",
min_days_to_expiration=60,
max_days_to_expiration=90,
preference="nearest",
distance=0,
ratio=1
),
nt.leg(
option_type="call",
direction="short",
min_days_to_expiration=30,
max_days_to_expiration=45,
preference="nearest",
distance=0,
ratio=1
)
],
underlying_symbol="SPY",
spread_type="calendar"
),
allocation={'type': 'contracts', 'amount': 1}
)
),
nt.strategy(
"Close when signal invalidates",
((nt.RSI(asset, 14, "Day") < nt.Value(40)) | (nt.RSI(asset, 14, "Day") > nt.Value(60))),
nt.close_option(
underlyings=['SPY'],
spread_type="calendar",
close_scope="spread",
quantity={'type': 'all'}
)
),
nt.strategy(
"Close at 14 DTE",
(nt.Value(1) > nt.Value(0)),
nt.close_option(
underlyings=['SPY'],
spread_type="calendar",
close_scope="spread",
quantity={'type': 'all'},
triggers=[nt.dte_trigger(max_dte=14)]
)
),
],
initial_value=10000,
supports_fractional_shares=False,
alerts_enabled=False,
dividend_policy='cash',
)
def backtest_call_calendar_spread(client=None):
client = client or nt.NexusTradeClient.from_environment()
operation = client.create_backtest(
nt.backtest(
create_call_calendar_spread(),
start_date="2024-01-01", end_date="2024-12-31",
interval="Day", baseline_symbol="SPY",
initial_value=10000, generate_events=True,
dividend_policy="cash",
fee_config={"Stock": {"type": "percent", "amount": 0.1},
"Cryptocurrency": {"type": "percent", "amount": 0.7},
"Option": {"type": "dollars", "amount": 0.65}},
),
idempotency_key="explore-call-calendar-spread-2024-spy-v1",
)
return client.wait_for_backtest(operation["id"])
# Build locally: book = create_call_calendar_spread()
# Run and inspect: completed = backtest_call_calendar_spread(); print(completed["result"])
Create and backtest with TypeScript
Use the TypeScript SDK instead of Aurora
TypeScript SDK 1.42.0. Save the runner below as run-call-calendar-spread.ts.
Install and download
npm install nexustrade@1.42.0
npm install --save-dev tsx
export NEXUSTRADE_API_KEY="YOUR_API_KEY"
curl --fail --output call-calendar-spread.ts https://nexustrade.io/seo/strategy-examples/call-calendar-spread.ts
Create, test and inspect
import { createCallCalendarSpread, backtestCallCalendarSpread } from "./call-calendar-spread";
async function main() {
const book = createCallCalendarSpread();
const completed = await backtestCallCalendarSpread();
console.log(completed.result);
}
main().catch((error: unknown) => {
console.error(error);
process.exitCode = 1;
});
Run
npx tsx run-call-calendar-spread.ts
TypeScript strategy and backtest functions
View complete TypeScript SDK functions
The same rules, dates and fees are used in both SDKs. The backtest function keeps its request key across retries.
import * as nt from "nexustrade";
export function createCallCalendarSpread() {
const asset = nt.stockAsset("SPY");
return nt.portfolio(
"Public SEO example - Call calendar spread",
[
nt.strategy(
"Open Call calendar spread",
nt.and(
nt.and(
nt.gte(nt.RSI(asset, 14, "Day"), nt.Value(45)),
nt.lte(nt.RSI(asset, 14, "Day"), nt.Value(55))
),
nt.eq(nt.OptionPositionCount("SPY", "call", "long", "calendar"), nt.Value(0))
),
nt.openOption({ builder: nt.optionsBuilder({ legs: [nt.leg({ optionType: "call", direction: "long", minDaysToExpiration: 60, maxDaysToExpiration: 90, preference: "nearest", distance: 0, ratio: 1 }), nt.leg({ optionType: "call", direction: "short", minDaysToExpiration: 30, maxDaysToExpiration: 45, preference: "nearest", distance: 0, ratio: 1 })], underlyingSymbol: "SPY", spreadType: "calendar" }), allocation: {"type": "contracts", "amount": 1} })
),
nt.strategy(
"Close when signal invalidates",
nt.or(nt.lt(nt.RSI(asset, 14, "Day"), nt.Value(40)), nt.gt(nt.RSI(asset, 14, "Day"), nt.Value(60))),
nt.closeOption({ underlyings: ["SPY"], spreadType: "calendar", closeScope: "spread", quantity: {"type": "all"} })
),
nt.strategy(
"Close at 14 DTE",
nt.gt(nt.Value(1), nt.Value(0)),
nt.closeOption({ underlyings: ["SPY"], spreadType: "calendar", closeScope: "spread", quantity: {"type": "all"}, triggers: [nt.dteTrigger({ maxDte: 14 })] })
),
],
{ initialValue: 10000, supportsFractionalShares: false, alertsEnabled: false, dividendPolicy: "cash" }
);
}
export async function backtestCallCalendarSpread(client = new nt.NexusTradeClient()) {
const operation = await client.createBacktest(
nt.backtest(createCallCalendarSpread(), {
startDate: "2024-01-01", endDate: "2024-12-31",
interval: "Day", baselineSymbol: "SPY",
initialValue: 10000, generateEvents: true,
dividendPolicy: "cash",
feeConfig: {
Stock: { type: "percent", amount: 0.1 },
Cryptocurrency: { type: "percent", amount: 0.7 },
Option: { type: "dollars", amount: 0.65 },
},
}),
{ idempotencyKey: "explore-call-calendar-spread-2024-spy-v1" }
);
if (typeof operation.id !== "string") throw new Error("Missing backtest ID");
return client.waitForBacktest(operation.id);
}
// Build locally: const book = createCallCalendarSpread();
// Run and inspect: const completed = await backtestCallCalendarSpread(); console.log(completed.result);
Start from this example
The worked example below is a starting point for you to copy. Open its exact rules in Aurora, then change the ticker, dates, legs or exits and backtest your own version.
Worked example to copy: SPY, 2024
Portfolio value (USD)
- Call calendar spread 2024-12-31, 21:00:00 UTC
- $9,206.09
- Full-capital SPY buy and hold 2024-12-31, 21:00:00 UTC
- $12,530.29
Call calendar spread: 7.94% largest decline in plotted observations. 2024-01-02, 14:30:00 UTC ($10,000.00) to 2024-12-30, 21:00:00 UTC ($9,206.09).
- Return
- -7.94%
- SPY buy and hold
- 25.30%
- Max drawdown
- 7.94%
- Closed option legs
- 78
- Commissions
- $101.40
Show the table · 16 rows, 2 columns
Scroll sideways to compare all columns. Select a heading to sort.
| Status | COMPLETE |
| Requested period | 2024-01-01 through 2024-12-31 |
| Starting capital | $10000.00 |
| Modeled return | -7.94% |
| Reported maximum drawdown | 7.94% |
| Full-capital SPY comparator return | 25.30% |
| Recorded commissions | $101.40 |
| Engine closed-trade count | 78 |
| Peak reserved collateral | $918.00 |
| Median reserved collateral while holding positions | $528.00 |
| Pricing contract version | 8 |
| Observed / synthetic half-spread calls | 200 / 264 |
| Unknown-timing quote accesses | 8218 |
| Missing-current-quote checks | 0 |
| Rejected fill groups / marks | 0 / 0 |
| Stale basket / single-option marks | 0 / 0 |
No matching rows. Clear the filter to see all records.
How the example did on SPY, 2024-01-01 to 2024-12-31, starting with $10,000.
One trade from the example
One position from the worked example, opened Dec 27, 2024 and closed Dec 30, 2024.
- Long $598 call (Feb 28)
- −$530.60
- Short $598 call (Jan 31)
- +$483.91
- Commissions
- −$2.60
- Net
- −$49.28
Explain this options decision with Aurora
Ask Aurora to connect the recorded signal, contract choice, allocation and fills. It receives this page's captured decision and order fields, so you can follow its explanation back to each value.
Inspect the worked example's records
The example trade's fills
2024-12-27 14:31:00
ContractSPY250228C00598000
ActionBuy to open
Contracts1
Premium per share$15.5860
Fee$0.65
2024-12-27 14:31:00
ContractSPY250131C00598000
ActionSell to open
Contracts1
Premium per share$10.6541
Fee$0.65
2024-12-30 14:31:00
ContractSPY250131C00598000
ActionBuy to close
Contracts1
Premium per share$5.8150
Fee$0.65
2024-12-30 14:31:00
ContractSPY250228C00598000
ActionSell to close
Contracts1
Premium per share$10.2800
Fee$0.65
Recorded rows in source order; spacing does not represent elapsed time.
Show the table · 4 rows, 6 columns
Scroll sideways to compare all columns. Select a heading to sort.
| 2024-12-27 14:31:00 | SPY250228C00598000 | Buy to open | 1 | $15.5860 | $0.65 |
| 2024-12-27 14:31:00 | SPY250131C00598000 | Sell to open | 1 | $10.6541 | $0.65 |
| 2024-12-30 14:31:00 | SPY250131C00598000 | Buy to close | 1 | $5.8150 | $0.65 |
| 2024-12-30 14:31:00 | SPY250228C00598000 | Sell to close | 1 | $10.2800 | $0.65 |
No matching rows. Clear the filter to see all records.
Each premium is per share; one contract is 100 shares.
Inspect the candidate book
This is the indicative selected-candidate snapshot from the opening size decision. Compare the selected symbols and ratios with the actual Filled orders. Use the candidate bid, ask and mid to follow the sizing calculation, then compare the recorded execution premium.
Show the table · 2 rows, 9 columns
Scroll sideways to compare all columns. Select a heading to sort.
| SPY250228C00598000 | $598.00 | 2025-02-28 | 63 | $15.52 | $15.60 | $15.56 | 1 | 45; trailingMedian5 |
| SPY250131C00598000 | $598.00 | 2025-01-31 | 35 | $10.64 | $10.71 | $10.68 | 1 | 108; trailingMedian5 |
No matching rows. Clear the filter to see all records.
{
"modelVersion": 2,
"enforced": true,
"chosenIndex": 0,
"path": "targetKept",
"reason": "target size limit 11 covers 1",
"requestedQuantity": 1,
"quantity": 1,
"sizingChain": [
{
"kind": "allocationImplied",
"bound": 1,
"quantity": 1,
"binding": true
},
{
"kind": "buyingPowerCap",
"bound": 18,
"quantity": 1,
"binding": false
},
{
"kind": "volumeLimit",
"bound": 11,
"quantity": 1,
"binding": false
},
{
"kind": "finalPriceRecap",
"bound": 1,
"quantity": 1,
"binding": false
}
],
"pricing": {
"mid": 26.235,
"halfSpread": 0.07500000000000018,
"participation": 0.022222222222222223,
"impactCost": 0.9330724510272276
}
}Inspect a contract-resolution audit
This is the latest retained resolution attempt, which can belong to a different position than the matched trade above. Its outcome, capital and risk codes explain what the resolver accepted or rejected at that decision. Follow the resulting Order events to see its fill status.
{
"time": "2024-12-27T14:31:00.000Z",
"status": "success",
"reason": null,
"riskAudit": {
"rulesetVersion": 1,
"outcome": "allowed",
"longSharesAvailable": 0,
"unhedgedShortCallContractsPerSpread": 0,
"buyingPowerEffective": 9255.370671160026,
"allocationRequested": 1,
"allocation": {
"type": "contracts",
"amount": 1
},
"portfolioValue": 9255.370671160026,
"underlyingPrice": 597.5399780273438,
"maxLossPerUnit": 496,
"finalContractQuantity": 1,
"collateralReserved": 496,
"committedCostBefore": 0
}
}Inspect the largest decline in the exported history
Show the table · 2 rows, 4 columns
Scroll sideways to compare all columns. Select a heading to sort.
| 2024-01-02T14:30:00.000Z | $10000.00 | $0.00 | $0.00 |
| 2024-12-30T21:00:00.000Z | $9206.09 | $0.00 | $0.00 |
No matching rows. Clear the filter to see all records.
The exported grid's largest peak-to-trough decline was 7.94%, from $10000.00 at 2024-01-02T14:30:00.000Z to $9206.09 at 2024-12-30T21:00:00.000Z. The engine reported maximum drawdown of 7.94%. Compare the history snapshots with the reported statistic and inspect the events around this period.
Plan a separate variant and later test
Review the optional next experiment
After reviewing the recorded example, use the prepared request above for the original rules. This optional plan covers a separate variant and a later test.
Create one variant, then test unseen dates
Ask: "Change only the timed close trigger from 14 DTE to 10 DTE. Show the rule diff and compare both candidates on the 2024 development period with every other setting fixed." After choosing, freeze the rules and select another test period you have not inspected. The displayed 2024 results already make 2024 a viewed development period. Keep any later revisions in a new research cycle.
Explore this strategy further
Inspect explore this strategy further
Inspect matched quantities, actual strike widths, expirations and all close orders. For sold options, review collateral and exercise or assignment exposure separately from premium income. A condition firing can emit zero close orders; look at its evaluation and the Filled-order records.
Try another date range or change one rule, then compare the new backtest with this saved 2024 result. Inspect which trades and periods explain the difference.
No comments yet.