analyzeConsecutiveProfitLoss
Analyze consecutive winning and losing trades
Trade through named exchange accounts and get your own performance analysed — win rate, streaks, daily and monthly returns — from the trade history itself.
LABSCO SUMMARY
The four analysis tools are what separate this from a plain exchange wrapper: win rate, consecutive wins and losses, and returns split by day and month come back as computed metrics for a named account and period, so a review does not start with exporting a CSV. Named accounts are the other design choice worth noting — credentials live in configuration, calls carry only the account name, and a spot and a swap account on the same exchange stay distinct.
A CCXT-backed server with accounts as first-class objects. Market data tools take an exchange id; anything touching money takes an accountName that maps to credentials you configured once, so keys never appear in a call.
Nothing for market data. Trading and analysis need an accounts array — each entry a name, exchangeId, apiKey, secret and defaultType such as spot or swap — either inside the client's own MCP configuration or in a separate JSON file passed with --config, where accounts must sit at the root. It runs as npx @lazydino/ccxt-mcp, or as ccxt-mcp after a global install. Running it in HTTP+SSE mode with --sse requires mcpBearerToken in the same config file, and clients must then send it as an Authorization: Bearer header. MIT.
One command plus a key — npx -y @lazydino/ccxt-mcp, then supply credentials
USE CASES
Get the performance summary and win rate for the period, then look at the streaks behind it rather than the average alone.
Break returns down by day and by month over the period, for one symbol or the whole account.
Check which accounts are configured, place the order with its type and side, and follow it through open and closed orders.
Pull the ticker, the order book depth and the candles for the pair — no account needed for any of it.
Read the balance next to deposit and withdrawal history over the same window.
List what is open on that account, then cancel the one by id and symbol.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
analyzeConsecutiveProfitLossAnalyze consecutive winning and losing trades
analyzePeriodicReturnsAnalyze daily and monthly returns for a configured account
analyzeTradingPerformanceAnalyze trading performance for a configured account
calculateWinRateCalculate win rate and profit metrics for a configured account
cancelOrderCancel an existing order using a configured account
createOrderCreate a new order using a configured account
fetchBalanceFetch account balance for a configured account
fetchClosedOrdersFetch all closed orders using a configured account
fetchDepositsFetch deposit history for a configured account
fetchMarketsFetch markets from a cryptocurrency exchange
fetchMyTradesFetch personal trade history for a configured account
fetchOHLCVFetch OHLCV candlestick data for a symbol on an exchange
fetchOpenOrdersFetch all open orders using a configured account
fetchOrderFetch information about a specific order using a configured account
fetchOrderBookFetch order book for a symbol on an exchange
fetchTickerFetch ticker information for a symbol on an exchange
fetchTickersFetch all tickers from an exchange
fetchTradesFetch recent trades for a symbol on an exchange
fetchWithdrawalsFetch withdrawal history for a configured account
listAccountsList all configured account names
BEFORE YOU INSTALL
20 tools when we connected. Position and risk management (leverage, stop loss, take-profit, daily loss limits) have no tools of their own; the model builds them from createOrder and the fetch tools.
npx on PATH
CONTEXT COST
Rated by the size of the 20 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npx -y @lazydino/ccxt-mcp{
"mcpServers": {
"ccxt-mcp": {
"command": "npx",
"args": [
"-y",
"@lazydino/ccxt-mcp"
],
"accounts": [
{
"name": "bybit_main",
"exchangeId": "bybit",
"apiKey": "<YOUR_API_KEY>",
"secret": "<YOUR_SECRET>",
"defaultType": "spot"
}
]
}
}
}{
"mcpServers": {
"ccxt-mcp": {
"command": "npx",
"args": [
"-y",
"@lazydino/ccxt-mcp",
"--config",
"<YOUR_PATH_TO_CCXT_CONFIG>"
]
}
}
}git clone https://github.com/lazy-dinosaur/ccxt-mcp.git
cd ccxt-mcp
cp config/ccxt-config.example.json config/ccxt-config.jsonAdd your exchange API keys to config/ccxt-config.json, and set mcpBearerToken in the same file (generate one with openssl rand -hex 32)
docker compose build
docker compose up -dThat serves MCP over HTTP+SSE on localhost:2298. For a client on another host, put Nginx in front of it:
sudo cp ccxt-mcp.nginx /etc/nginx/conf.d/ccxt-mcp.confEdit /etc/nginx/conf.d/ccxt-mcp.conf and set ssl_certificate and ssl_certificate_key
sudo nginx -t && sudo systemctl reload nginxIn your MCP client, add the SSE endpoint:
https://<YOUR_HOSTNAME_IP>:42299/sseSend the header Authorization: Bearer <YOUR_MCP_TOKEN> with it; the messages URL is https://<YOUR_HOSTNAME_IP>:42299/messages. <YOUR_HOSTNAME_IP> is the address of the machine running Nginx, and <YOUR_MCP_TOKEN> the mcpBearerToken you set.