Claude Code
Backtest trading strategies in Claude Code
Add LONA to Claude Code with one command, sign in with your LONA account, and backtest, optimize and walk-forward test strategies without leaving the terminal.
Set it up
- 1
Add the server
Run the command below in your terminal. It registers LONA as a remote HTTP MCP server.
- 2
Sign in
Run /mcp in Claude Code, pick lona and sign in with your LONA account in the browser. There is no API key to paste.
- 3
Ask for a backtest
Describe a strategy. Claude Code writes it, dry-runs it on LONA and returns the report's metrics.
claude mcp add --transport http lona https://mcp.lona.agency/mcpThen ask
A first prompt to paste once LONA is connected.
Use LONA to create a strategy that buys BTC when the 50-day SMA crosses above the 200-day SMA and sells on the opposite cross. Backtest it on daily data since 2018 and summarize return, drawdown and trades.What your agent can do with LONA
Create strategies
Describe the rules in plain words. The agent writes the Python strategy and dry-runs it before saving.
Backtest
Run it on US and China equities, ETFs, crypto and forex, from 5-minute bars to daily.
Optimize parameters
Sweep one or two parameters and compare every combination.
Walk-forward analysis
Re-optimize on rolling windows and test on data the parameters never saw.
Day and time tests
Find the weekdays or UTC hours your strategy should skip.
[ FAQ ]