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_get_full_report
ChatGPTRetrieves comprehensive backtest results by ID, including detailed metrics, trade history, and per-symbol performance breakdown.
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_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_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_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.