Skip to main content
Glama
Dor1Toes

BackTest_MCP

by Dor1Toes

Server Configuration

Describes the environment variables required to run the server.

NameRequiredDescriptionDefault
QUANTFORGE_DB_PATHNoPath to SQLite database filequantforge_mcp/storage/quantforge.db
QUANTFORGE_SSE_PORTNoPort for SSE transport8001
QUANTFORGE_TRANSPORTNoTransport method (stdio or sse)stdio
QUANTFORGE_DATA_SOURCENoData source for stock datayfinance
QUANTFORGE_DOCKER_IMAGENoDocker image for sandbox workerquantforge-worker:latest
QUANTFORGE_ARTIFACTS_DIRNoDirectory for backtest artifactsquantforge_mcp/storage/artifacts
QUANTFORGE_DOCKER_ENABLEDNoEnable Docker sandbox for backtest workerstrue
QUANTFORGE_SANDBOX_CPU_QUOTANoSandbox CPU quota100000
QUANTFORGE_SANDBOX_MEM_LIMITNoSandbox memory limit512m
QUANTFORGE_SANDBOX_TIMEOUT_SECNoSandbox timeout in seconds120
QUANTFORGE_ENABLE_EXPERIMENTAL_MLNoEnable experimental ML module (set to 1 to enable)
QUANTFORGE_ALLOW_SYNTHETIC_FALLBACKNoAllow synthetic data fallbacktrue

Instructions

Guidance the server publishes about itself, which clients place ahead of the tool catalog so the model reads it before choosing anything.

This server publishes no instructions, or was last inspected before Glama recorded them.

Capabilities

Features and capabilities supported by this server

Protocol revision2025-11-25

CapabilityDetails
tools
{
  "listChanged": false
}
prompts
{
  "listChanged": false
}
resources
{
  "subscribe": false,
  "listChanged": false
}
experimental
{}

Tools

Functions exposed to the LLM to take actions

NameDescription
get_stock_dataA

Fetch and cache OHLCV bars for one or more symbols from local DB or remote source.

Args: symbols: Non-empty list of ticker codes; pass a single symbol as ["600519"]. Symbol formats: quantforge://data/symbol-guide. start: Start date YYYY-MM-DD; empty uses a default lookback window. end: End date YYYY-MM-DD; empty defaults to today. interval: Bar interval (default "1d"). preview: When false, returns row counts only; when true, adds stats and head/tail samples. preview_rows: Number of head/tail rows per symbol when preview=True (default 3).

Returns: {"ok": true, "start": str, "end": str, "interval": str, "items": [...]} where each item has symbol, rows, source, and optional preview fields. On empty symbols: {"ok": false, "error": str}.

list_cached_symbolsA

List stock symbols that already have OHLCV data in the local SQLite cache.

Returns: {"ok": true, "symbols": [str, ...]}.

run_backtest_dynamicA

Run a dynamic Strategy backtest in an isolated sandbox and persist artifacts.

Args: code: Python source with exactly one Strategy subclass. Strategy rules and allowed imports are enforced before execution; see quantforge://codegen/spec. config_json: JSON string for backtest settings (required: symbols; optional: name, start, end, initial_capital, commission, slippage, target_weights, sizing_fraction, rebalance, last_rebalance_ts, history_tail). Dates must be YYYY-MM-DD. Full schema and examples: quantforge://codegen/spec.

Returns: On success: {"ok": true, "job_id": str, "status": "done", "result": {...}} where result includes metrics (total_return, max_drawdown, n_trades, ...). On validation failure: {"ok": false, "validation": {...}} (no job created). On runtime failure: {"ok": false, "job_id": str, "status": "failed", "error": str}.

get_backtest_resultA

Fetch status and summary for a backtest job stored in SQLite.

Args: job_id: Job identifier returned by run_backtest_dynamic.

Returns: {"ok": true, "job_id": str, "status": str, "job_type": str, "error_message": str|null, "result": dict|null} where result holds metrics and metadata when status is "done". On unknown job: {"ok": false, "error": str}.

list_backtest_jobsA

List recent backtest jobs from SQLite, newest first.

Args: limit: Maximum number of jobs to return (default 50). status: Optional filter, e.g. "done" or "failed"; empty string returns all.

Returns: {"ok": true, "count": int, "jobs": [...]} where each job includes job_id, status, strategy_name, symbols, start, end, total_return, max_drawdown, n_trades, timestamps, and error_message.

generate_backtest_reportA

Build a Markdown tearsheet report from a completed backtest's equity curve.

Args: job_id: Completed backtest job (must have an equity_curve artifact). title: Optional report heading; defaults to "Backtest {job_id}".

Returns: On success: {"ok": true, "job_id": str, "title": str, "format": "markdown", "path": str, "content": str}. Also registers a report_markdown artifact. On missing equity curve: {"ok": false, "error": str}.

get_backtest_artifactsA

List on-disk artifact paths for a backtest job.

Args: job_id: Backtest job identifier. kind: Optional filter: equity_curve, trades, stdout, stderr, strategy_code, or report_markdown; empty returns all kinds.

Returns: {"ok": true, "job_id": str, "artifacts": [{"kind": str, "path": str, ...}]}.

scan_strategy_signalsA

Scan the latest bar for live strategy signals from a saved backtest job.

Loads strategy.py and config.json from storage/artifacts/{job_id}/. Fetches recent OHLCV through today; the calendar-day window is derived from strategy.warmup() unless overridden.

Args: job_id: Backtest job whose artifacts contain the strategy and config. warmup_days_override: Optional calendar days of history to fetch; overrides the default warmup-based window when set. notify: When true and signals exist, send email via configured SMTP (QUANTFORGE_SMTP_* / QUANTFORGE_NOTIFY_* env vars). notify_to: Optional recipient override; defaults to QUANTFORGE_NOTIFY_TO.

Returns: {"ok": bool, "strategy_name": str, "symbols": [...], "data_range": {...}, "signals": [{symbol, direction, strength, strategy_id, bar_date, close}], "warnings": [...], "notified": bool, "notify_error": str|null}. On missing files or invalid config: {"ok": false, "error": str} or {"ok": false, "validation": {...}}. Config fields (rebalance, last_rebalance_ts, history_tail) follow quantforge://codegen/spec.

Prompts

Interactive templates invoked by user choice

NameDescription

No prompts

Resources

Contextual data attached and managed by the client

NameDescription
compute_modules_index
strategies_indexBuilt-in strategy examples index.
codegen_spec
symbol_guide
nvda_example

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Dor1Toes/BackTest_MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server