Core concepts

Backtesting

Strategies are written as code, run on an engine that applies the market's own rules, and saved with their metrics, trades and validation for later inspection.

Engines

MarketRules modelled
China A-sharesT+1, no retail shorting, ±10% / ±20% / ±5% price limits, 100-share lots
Global equities (US, Hong Kong, Canada, UK, indices)Per-market trading rules and costs
India (NSE / BSE)Delivery segment on daily bars, circuit bands, statutory cost stack
Korea (KOSPI / KOSDAQ)KRX tick grid, ±30% band, long-only
Vietnam (HOSE)Whole-VND tick grid and price band
CryptoPerpetuals: maker/taker fees, funding every 8 hours, liquidation
China futuresCFFEX, SHFE, DCE, ZCE, INE, GFEX: T+0, margin, price limits
Global futuresCME, ICE, Eurex: margin, contract multipliers
Forex and metalsSpread, leverage, lot sizes
CompositeSeveral markets in one shared capital pool
Options portfolioBlack-Scholes with an IV smile, European and American, multi-leg

Argentine symbols (.BA) have market data but no backtest engine yet; a backtest on them is refused rather than run under another market's rules.

Bar intervals

1m, 5m, 15m, 30m, 1H, 4H, 1D, 1W, 1M. Weekly and monthly bars are built from daily bars. Case matters: 1M is a month and 1m a minute. Minute bars depend on what the source serves.

Portfolio construction

Built-in optimizers: equal volatility, risk parity, mean-variance, maximum diversification and turnover-aware rebalancing.

Validation

A run can add benchmark comparison, a Monte Carlo test, a bootstrap confidence interval for the Sharpe ratio and walk-forward analysis. The run card warns when the data's bar spacing does not match the declared interval or when price adjustments differ between sources. Treat these as evidence, not guarantees.

Example

vibe-trading run -p "Compare risk parity and equal weight on 600519.SH, 000858.SZ and 000001.SZ for 2023-2025, monthly rebalancing, with a Monte Carlo test"