QuantConnect/Lean · error · RegressionTestException
Index is tradable.
Error message
Index is tradable.
What it means
Thrown in OnEndOfAlgorithm when the MarketOrder(Spx, 1) ticket status is not a fill. Unlike the other index algorithms, BasicTemplateTradableIndexAlgorithm explicitly sets Securities[Spx].IsTradable = true, making the SPX index directly tradable. If the order does not fill, the assertion fails with the message 'Index is tradable.' — confirming the expectation that the index should have been tradeable and filled.
Source
Thrown at Algorithm.CSharp/BasicTemplateTradableIndexAlgorithm.cs:57
{
base.Initialize();
Securities[Spx].IsTradable = true;
}
/// <summary>
/// Index EMA Cross trading underlying.
/// </summary>
public override void OnData(Slice slice)
{
base.OnData(slice);
_ticket ??= MarketOrder(Spx, 1);
}
public override void OnEndOfAlgorithm()
{
if (!_ticket.Status.IsFill())
{
throw new RegressionTestException("Index is tradable.");
}
}
/// <summary>
/// This is used by the regression test system to indicate what the expected statistics are from running the algorithm
/// </summary>
public override Dictionary<string, string> ExpectedStatistics => new()
{
{"Total Orders", "5"},
{"Average Win", "7.08%"},
{"Average Loss", "-0.01%"},
{"Compounding Annual Return", "602.278%"},
{"Drawdown", "3.400%"},
{"Expectancy", "677.669"},
{"Start Equity", "1000000"},
{"End Equity", "1064342.82"},
{"Net Profit", "6.434%"},
{"Sharpe Ratio", "-4.563"},View on GitHub (pinned to d2c3659f87)
Solutions
- Confirm Securities[Spx].IsTradable = true is set in the override of Initialize.
- Check the order ticket's Status and any cancel/reject message via _ticket.CancelMessage.
Example fix
// before
public override void Initialize()
{
base.Initialize();
// IsTradable line missing or commented out
}
// after
public override void Initialize()
{
base.Initialize();
Securities[Spx].IsTradable = true;
} Defensive patterns
Strategy: validation
Validate before calling
// Verify tradable index setup and order status
public override void OnEndOfAlgorithm()
{
if (_ticket == null)
{
Log("Order was never placed — OnData may not have triggered");
return;
}
if (!_ticket.Status.IsFill())
{
Log($"Order status: {_ticket.Status}, cancel msg: {_ticket.CancelMessage}");
}
} Type guard
bool IsOrderFilled(OrderTicket ticket) => ticket != null && ticket.Status.IsFill();
Prevention
- Confirm Securities[Spx].IsTradable = true is set in the Initialize override.
- Log _ticket.Status after order placement to verify it fills.
- Ensure the SPX data feed provides prices for the order to fill against.
- Place the order early enough in OnData for it to process before algorithm end.
When it happens
Trigger: The IsTradable override was removed or reverted, the brokerage model rejects index orders, the SPX data feed has no price quotes so the market order cannot fill, or the order was cancelled before filling.
Common situations: Changes to the tradable index feature (SetIsTradable), brokerage model updates that block index fills, data feed issues preventing price discovery for the index, or algorithm timing changes that place the order too late to fill.
Related errors
- Index is not tradable.
- Index is not tradable.
- Index is not tradable.
- Option was not sold
- Expected a single subscription to exist ({spx})
AI-assisted analysis of QuantConnect/Lean@d2c3659f87 (2026-08-13).
Data as JSON: /api/errors/cfa1b5e5267af3ce.
Report an issue: GitHub.