lona_cancel_optimization
ChatGPTCancel a pending or executing optimization. This stops remaining work and refunds unused reserved credits. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_create_strategy
ChatGPTCreates a new trading strategy from existing Backtrader Python code. Code requirements: - The code imports backtrader: import backtrader as bt - Defines a class inheriting from bt.Strategy - Parameters use tuple format: params = (('name', value), ...) - Indicators are initialized in __init__, trading logic in next() Example: ``python import backtrader as bt class Strategy(bt.Strategy): params = (('period', 20),) def __init__(self): self.sma = bt.indicators.SMA(period=self.p.period) def next(self): if self.data.close[0] > self.sma[0]: self.buy() ``
lona_create_strategy_from_description
ChatGPTCreates a new trading strategy from a natural language description. An AI pipeline generates Backtrader Python code based on the description. This is an asynchronous operation. Returns a jobId immediately. The generation runs in the background (typically 3-5 minutes). Progress can be checked with lona_get_strategy_creation_status. Pipeline stages: PENDING -> GENERATING -> SAVING -> COMPLETED (or FAILED at any point). Example descriptions: - "A momentum strategy that buys when RSI crosses above 30 and sells below 70" - "Trend following using 20 and 50 period moving averages with 2% stop loss" - "Mean reversion with Bollinger Bands - buy at lower band, sell at upper band"
lona_download_market_data
ChatGPTDownloads cryptocurrency market data from supported exchanges and saves it as a new symbol in the user's Lona account. Returns a symbol ID usable as a data_id in lona_run_backtest. Supported intervals: 1m, 5m, 15m, 30m, 1h, 4h, 1d Practical data limits: - 1m data: up to ~6 months - 5m data: up to ~2 years - 1h+ data: several years of history
lona_export_strategy
ChatGPTExports a saved strategy to MetaTrader 5 (MQL5). An AI pipeline converts the Backtrader code to MQL5 and compiles it in the background. Returns { id } of the export immediately. Poll lona_get_export with that ID until its status is completed (includes a download URL) or failed (includes the error). A strategy can only have one pending or completed export; a failed export is replaced by a new attempt. lona_get_strategy lists a strategy's existing exports with their IDs and download URLs. Requires a Pro plan or higher. Persists an export record and compiled artifact, and queues background compilation. Retrying after failure deletes the strategy's previous failed export records, including their diagnostics. Pending or completed exports reject duplicate submissions. Does not charge LONA credits. Requires explicit user approval.
lona_get_credit_usage
ChatGPTGet the authenticated user's credit limit, current balance, and remaining free optimizations when applicable.
lona_get_export
ChatGPTGets the status of a strategy export created by lona_export_strategy. Status is pending, completed (with a temporary download_url for the compiled MQL5 artifact), or failed (with the error).
lona_get_full_report
ChatGPTRetrieves comprehensive backtest results by ID, including detailed metrics, trade history, and per-symbol performance breakdown.
lona_get_latest_optimization_by_strategy
ChatGPTGet a strategy's latest optimization, or null. Include the same metadata fields as lona_list_optimizations; use lona_show_optimization to display its table/charts. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_get_optimization
ChatGPTGet an optimization's metadata: status, progress, parameter grids and selected_metrics (null means a non-target metric). Runs are not included; page them with lona_list_optimization_results. Displays nothing; call lona_show_optimization to show the interactive table and charts. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_get_report
ChatGPTRetrieves a backtest report summary by ID. Returns key performance metrics including total return, Sharpe ratio, maximum drawdown, win rate, and number of trades.
lona_get_report_chart
ChatGPTRetrieves chart data for a completed backtest report. Returns an interactive candlestick chart with buy/sell markers showing trade entry and exit points.
lona_get_report_status
ChatGPTChecks the execution status of a backtest report. Returns current status (PENDING, EXECUTING, PROCESSING, COMPLETED, or FAILED) and whether the backtest is complete.
lona_get_strategy
ChatGPTRetrieves metadata for a single trading strategy by ID. Returns the strategy name, description, version, language, and timestamps.
lona_get_strategy_code
ChatGPTRetrieves the Python source code of a trading strategy by ID. Returns the Backtrader code that implements the strategy logic.
lona_get_strategy_creation_status
ChatGPTChecks the progress of an async strategy creation job started by lona_create_strategy_from_description. Returns current status: PENDING, GENERATING, SAVING, COMPLETED, or FAILED. When COMPLETED, includes the strategyId, generated code, explanation, and a review score. When FAILED, includes error details and suggestions.
lona_get_strategy_documentation
ChatGPTReturns the authoritative LONA strategy-authoring documentation. Call this before creating or modifying strategy code. It describes the execution environment, supported APIs, multi-data requirements, order handling, parameters, and visualization rules.
lona_get_symbol
ChatGPTRetrieves metadata for a single market data symbol by ID. Returns the symbol name, description, data type, and whether it is a global or user-uploaded dataset. The metadata field may include exchange, asset_class, frequency, quote_currency, and timeframe availability.
lona_get_symbol_data
ChatGPTRetrieves OHLCV (Open, High, Low, Close, Volume) time-series price data for a symbol by ID.
lona_list_optimization_results
ChatGPTList paginated runs with iteration, swept parameters, status, web table metrics and errors. Preserve every returned parameter and metric column (including nulls) and row order. State that the table is partial when has_next is true. Omit sort_by/descending unless the user requests another order. For all runs, follow next_skip while has_next. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_list_optimizations
ChatGPTList optimizations newest first. Use the returned summary in your reply: preserve each optimization's name/ID, status, symbol/frequency, backtest period, grid min/max/step, target/direction, created/updated dates, iterations, and credits. lona_show_optimizations displays them as cards. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_list_report_trades
ChatGPTList a backtest report's formatted trades with bounded pagination (at most 200 trades per page). Returns entry and exit times, prices, quantity, P&L, and P&L percentage; total counts the reconstructed round-trip trades (for legacy redacted reports it can be lower than the report's own trade count) and has_next signals further pages, so a page is never the whole history unless has_next is false. Trades are reconstructed from the execution timeline, so their P&L is gross of commissions and fees: when a recount of wins or losses differs from the report's stored statistics (win rate, trade count), the stored statistics are authoritative.
lona_list_reports
ChatGPTLists the user's backtest reports with status, performance metrics (return, Sharpe ratio, trades), and timestamps. Supports filtering by strategy_id or status (PENDING, EXECUTING, PROCESSING, COMPLETED, FAILED) and pagination via skip/limit.
lona_list_strategies
ChatGPTLists the user's saved trading strategies. Returns strategy names, IDs, descriptions, and version info. Supports pagination via skip/limit parameters.
lona_list_symbols
ChatGPTLists available market data symbols. Returns user-uploaded data files by default, or pre-loaded global datasets (US equities, crypto, forex) when is_global=true. Each symbol has an ID usable as a data_id in lona_run_backtest.
lona_register_agent
ChatGPTProvisions a session token for API-key mode authentication. Not needed for OAuth-authenticated sessions (e.g., ChatGPT users). Returns a short-lived token for subsequent tool calls.
lona_run_backtest
ChatGPTExecutes a trading strategy backtest against historical market data. Runs asynchronously and returns a report_id for checking progress with lona_get_report_status. Required inputs: - strategy_id: a Lona strategy ID (from lona_list_strategies, lona_create_strategy, or lona_create_strategy_from_description) - data_ids: array of Lona symbol IDs (from lona_list_symbols, lona_download_market_data, or lona_upload_market_data) Configurable parameters: - initial_cash: Starting capital (default: 100000) - commission: Trading commission as decimal (default: 0.001 = 0.1%) - leverage: Maximum leverage allowed (default: 1) - parameters: Override strategy parameters (passed to the strategy's params tuple)
lona_run_dry_run_backtest
ChatGPTExecute a dry-run backtest of the latest generated code against a fixed symbol and return the complete backend execution result.
lona_run_optimization
ChatGPTSubmit a grid optimization for a saved strategy instead of a batch of backtests. Consumes a free optimization entitlement or credits. After completion call lona_show_optimization to display the table and charts. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_search_symbols_by_name
ChatGPTSearch for trading symbols by ticker or asset name (e.g. XAU/USD, XAUUSD, or gold) across global symbols and the user's own symbols. Preserve equity_market and exchange when presenting equity matches; a US-listed ADR is not a mainland China listing. In data_availability, a null end_timestamp means the frequency is refreshed daily and covers up to the latest trading day.
lona_show_optimization
ChatGPTDisplay one optimization in an interactive widget with its full results table and charts for all selected metrics, target first: one/two parameters produce 2D/3D charts, each with a threshold slider and line/plane. Call only when the user wants to see the optimization, once per optimization; use lona_get_optimization for analysis. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_show_optimization_results
ChatGPTDisplay a page of an optimization's runs as an interactive table. Call only when the user wants to see the table; use lona_list_optimization_results for analysis. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_show_optimizations
ChatGPTDisplay optimization cards newest first in an interactive widget. Call only when the user wants to see their optimizations; use lona_list_optimizations for analysis. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_show_report
ChatGPTDisplay one backtest report in an interactive widget with metrics, equity and drawdown curves, price candles with trade markers, a trade log and per-symbol results. Call only when the user wants to see the report, once per report; use lona_get_report for analysis.
lona_show_reports
ChatGPTDisplay backtest report cards with status, symbols, parameters and headline metrics in an interactive widget. Call only when the user wants to see the reports; use lona_list_reports for analysis.
lona_show_strategies
ChatGPTDisplay the user's saved strategies as interactive cards with direct code viewing. Call only when the user wants to see their strategies; use lona_list_strategies for analysis.
lona_update_strategy
ChatGPTModifies an existing trading strategy. Accepts updates to the name, description, or code individually or all at once. This operation uses immutable versioning: the update creates a new version of the strategy and returns a new strategy ID. The previous version is replaced in listings. The returned strategyId represents the latest version.
lona_upload_market_data
ChatGPTUploads user-provided CSV market data and creates a new symbol in the user's Lona account. Returns a symbol_id usable as a data_id in lona_run_backtest. Accepts data via the file parameter (when user attaches a CSV) or the csv_content parameter (raw CSV string). This tool accepts OHLCV (Open-High-Low-Close-Volume) price data in CSV format. CSV Requirements: - Header row with column names - Minimum 10 data rows - Maximum ~15MB - Must contain at minimum: a timestamp/date column and a close price column - Additional columns (open, high, low, volume) are optional but recommended Supported timestamp formats (auto-detected): - ISO 8601: 2024-01-15T00:00:00Z - Date-time: 2024-01-15 00:00:00 - Date only: 2024-01-15 - Slash format: 01/15/2024 or 15/01/2024 (auto-detected) - Unix timestamps: 1705276800 (seconds), 1705276800000 (ms) Standard column names (auto-detected, case-insensitive): - Timestamp: "timestamp", "date", "time", "datetime" - Price: "open", "high", "low", "close" (or "adj close", "price") - Volume: "volume", "vol" If your CSV uses non-standard column names, provide the column_mapping parameter.
lona_wait_for_optimization
ChatGPTWait up to 10 minutes for completion, failure or cancellation. Confirm the terminal status and errors; on completion call lona_show_optimization to display the table and charts. Optimization results are historical simulations of every grid combination, returned as neutral tables and charts. They do not identify a best or recommended parameter set, and a strong in-sample run is not a recommendation or a prediction of future performance.
lona_wait_for_reports
ChatGPTWait for all requested reports to complete or fail. Confirm each terminal status; call lona_get_report for each requested completed report's metrics, and lona_show_report to display a report the user wants to see.