SignalAI

Your first backtest

From zero to a backtest you can see, in about five minutes. Strategies are Rust, but the engine runs in the cloud, you just write the strategy.

1. The zero-install path, the Web Studio

Open signal-ai-mu.vercel.app/strategies and click Build strategy. Then:

  1. Describe an idea in chat, e.g. "a mean-reversion strategy: buy after a red bar, sell after a green one."
  2. The hosted agent writes the Rust for you.
  3. In the side panel, set the run params, universe AAPL, a date range like 2015-01-01 to 2024-12-31, starting cash, and daily resolution.
  4. Click Run backtest and watch it run inline.

When it finishes you'll see the equity curve, trades, and stats right there (also at your backtests).

2. The strategy it writes

The same tiny mean-reversion idea in Rust, buy when a bar closes red, sell when it closes green. You implement the Strategy trait, subscribe to bars in init, and place orders in on_bar. You never touch an engine.

use signalai_quant::prelude::*;

struct MeanReversion { sym: SymbolId }

impl Strategy for MeanReversion {
    fn init(&mut self, ctx: &mut Ctx) {
        self.sym = ctx.universe()[0];          // symbols come from the run
        ctx.subscribe_bars(self.sym, Resolution::Day1);
    }
    fn on_bar(&mut self, ctx: &mut Ctx, bar: &Bar) {
        let holding = !ctx.position(self.sym).is_zero();
        if bar.close.as_f64() < bar.open.as_f64() && !holding {
            // red bar, and flat: buy what the cash allows
            let qty = (ctx.cash() / bar.close.as_f64()).floor();
            ctx.order(self.sym, Side::Buy, Qty::shares(qty));
        } else if bar.close.as_f64() > bar.open.as_f64() && holding {
            // green bar, and holding: exit
            ctx.liquidate(self.sym);
        }
    }
}

pub fn build_strategy() -> Box<dyn Strategy> {
    Box::new(MeanReversion { sym: SymbolId(0) })
}

3. Author locally instead (optional)

Prefer your editor? cargo add signalai-quant, write the strategy against signalai_quant::prelude, and run cargo build (or cargo test) to type-check it. The crate is the API contract, it compiles against exactly what the server runs, but backtests still run in the cloud (submit from the Studio or Claude).

When a run finishes, view it at your backtests:

  • equity curve, account value over time
  • trades, every fill (timestamp, side, qty, price)
  • stats, return, max drawdown, Sharpe

What to try next