Getting Started
Platform Basics
Writing Strategies
Development Tools
Backtesting System
Advanced Topics
Data and Research
Integrations
Supported Languages and Exchanges
Programming languages
The backtesting system supports strategies written in JavaScript, TypeScript, Python, Rust, PINE, MyLanguage, Blockly and Workflow.
- JavaScript strategies (TypeScript is compiled to JavaScript first) are backtested in the browser, where the backtest engine runs as WebAssembly; nothing needs to be installed. JavaScript strategies can be debugged with Chrome DevTools during a backtest, see this guide.
- Rust strategies are compiled by the platform's servers and the result is backtested in the browser; third-party crates declared in the strategy's frontmatter are fetched at compile time, so no local toolchain is needed.
- Python strategies are backtested on a docker, either the platform's public servers or your own docker. Both backtesting and live trading use the Python 3 environment of the docker's system; install the third-party libraries you need yourself. The public servers only provide common libraries.
- Workflow strategies show each node's execution state and data flow visually during a backtest.
Exchanges
Backtests use the platform's historical data; the exchanges selectable on the backtest page are the ones that can be backtested (the MCP tool list_exchanges also shows this: exchanges with backtest set to true have history data).
- Cryptocurrency: spot and futures of major exchanges, e.g. Binance and Futures_Binance, OKX and Futures_OKX, HTX and Futures_HTX, Bybit and Futures_Bybit, Bitget and Futures_Bitget, GateIO and Futures_GateIO, with all symbols of the exchange.
- Futu Securities (
Futures_Futu): Hong Kong, US and other stock markets. Only daily data is available for backtesting; setcurrencytoSTOCKand select the stock code in the strategy withexchange.SetContractType():
javascript
/*backtest
start: 2024-05-01 00:00:00
end: 2025-02-17 00:00:00
period: 1d
basePeriod: 1d
exchanges: [{"eid":"Futures_Futu","currency":"STOCK","fee":[0.03,0.03]}]
*/
function main() {
var info = exchange.SetContractType("TSLA.US") // Set the stock code: Tesla
Log("info:", info) // Contract info: InstrumentID, PriceTick, LotTick, VolumeMultiple, ...
Log(exchange.GetTicker()) // Daily market data at the current backtest time
}