tradingcli

tradingcli

Local paper-trading and market simulation MCP server for multi-account portfolios, advanced orders, options/futures, backtesting, alerts, and automation.

Category
Visit Server

README

<div align="center">

๐Ÿ“ˆ TradingCLI

A fast, local-first paper-trading and market-simulation toolkit for your terminal.

CI Python License Scope SQLite

</div>

TradingCLI gives you a fake brokerage account that lives in one file on your own machine. You place orders against it, and it fills them using real market prices from Yahoo Finance. No signup, no API key, and no code path that reaches a real broker.

        you  ยท  or your AI agent
                    โ”‚
                    โ–ผ
     tradingcli  (dashboard ยท commands ยท MCP server)
                    โ”‚
       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
       โ–ผ                         โ–ผ
 ~/.papertrade.db          Yahoo Finance
 accounts, orders,         prices only,
 positions, ledger         read-only

๐Ÿš€ Install and run

Requires Python 3.10 or newer.

python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install .
tradingcli

That last command opens the dashboard and a first-run setup wizard. From there:

tradingcli buy AAPL 5        # place a trade
tradingcli positions         # see what you hold
tradingcli backtest          # test today's holdings against history
tradingcli --help-all        # every command, no market data needed

Three ways to drive it โ€” all sharing the same database:

How you start it Best for
๐Ÿ–ฅ๏ธ Dashboard tradingcli Watching portfolios update live
โŒจ๏ธ Commands tradingcli buy AAPL 5 Scripting, automation, one-off actions
๐Ÿค– MCP server tradingcli-mcp Letting Claude or another agent trade

๐Ÿ–ฅ๏ธ Screenshots

All portfolios Position detail
TradingCLI dashboard listing every paper portfolio TradingCLI detail view showing per-position P&L

TradingCLI backtesting and graphs view

The captures come from a local paper-trading database; they contain no real portfolio or credential data.

โœจ What you get

Area What is included
โšก Fast terminal UX ~20 ms median startup, persistent quote cache, offline-first dashboard
๐Ÿ’ผ Portfolio simulation Multiple accounts, deposits, withdrawals, P&L, time-weighted returns
๐Ÿงพ Advanced orders Market, limit, stop, stop-limit, trailing, bracket, OCO, OTO, multi-leg options
๐ŸŒ Instruments Equities, ETFs, crypto, FX, futures and equity options
๐Ÿงช Research Current-holdings backtests, walk-forward tests, portfolio optimization
๐Ÿ”” Local operations Alerts, reports, quote streaming, scheduling, backups, encrypted copies
๐Ÿค– Agent ready Local stdio MCP server with core, advanced and compatibility profiles
๐Ÿ›ก๏ธ Durable storage SQLite WAL, fixed precision, 56 data guards, migration backups, 0600 files

๐Ÿค– For AI agents

The usual way to let an agent practise trading is a hosted paper API such as Alpaca's: signup, API keys, and a network round trip per order. TradingCLI does the same job with a local SQLite file โ€” no keys to leak, no rate limits, and prices you can pin so a run replays exactly, which a live API cannot do.

PAPERTRADE_DB=./agent-sandbox.db tradingcli-mcp

โ†’ docs/agents.md โ€” the full comparison, the safety rails (narrow tool catalog, idempotency keys, engine-enforced risk limits, audit trail), and how to wire up an MCP client.

๐Ÿ“š Documentation

Guide What's in it
Commands Orders, options, market data, ledger, risk, alerts, backups โ€” the full CLI reference
AI agents MCP server, tool profiles, and using this instead of a hosted paper API
Configuration Environment variables, storage model, schema and migrations
Architecture Design decisions
Changelog Release history

๐Ÿ“Š Backtesting

Press g in the dashboard to open Backtesting & Graphs. It puts the selected portfolio's live performance curve next to a backtesting.py backtest of the same holdings, reporting return, CAGR, volatility, Sharpe, Sortino, costs and maximum drawdown. The universe comes only from that account's open positions; another account's names never leak in. Pick a window on open (6m, 1y, 2y, 5y, 10y, max, or an exact number of days).

[!WARNING] Read the backtest for what it is. It answers one narrow question: how today's open quantities and current cash would have performed if held unchanged over the chosen history. Because today's holdings are already known, it carries look-ahead and survivorship bias โ€” it is not an out-of-sample strategy test. It uses adjusted daily Yahoo prices, skips options (reliable point-in-time option-chain history does not exist) and treats futures as continuous series with no roll costs.

๐Ÿ›ก๏ธ Safety

TradingCLI never places live brokerage orders, and Yahoo Finance is not an exchange-grade feed. Do not use it as the sole source for financial decisions, and do not expose its stdio MCP server as an unauthenticated network service.

Fetching prices, news, history and option chains sends held, pending or watchlisted symbols to Yahoo Finance through yfinance. See SECURITY.md for the local-data and network privacy model.

๐Ÿง‘โ€๐Ÿ’ป Development

uv sync --locked --extra dev
uv run python run_tests.py
ruff check .

The runner discovers every test_*.py contract and executes each one in an isolated subprocess and temporary database. GitHub Actions runs the same checks on Python 3.10 and 3.13.

Contributions are welcome โ€” see CONTRIBUTING.md. Security reports should follow SECURITY.md, not a public issue.

๐Ÿ“„ License

Released under the MIT License.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured