get_strategy_status
Retrieve current grid trading strategy status including open orders, current price, and profit/loss estimates for specified exchange and trading pair.
Instructions
Get current grid strategy status: open orders, current price, and P&L estimate
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exchange | Yes | Exchange to query. Supported: mexc, gateio, bitget, kraken | |
| symbol | Yes | Trading pair symbol (e.g., BTC/USDT, INDY/USDT) |
Implementation Reference
- src/tools/strategy.ts:203-261 (handler)The complete implementation of get_strategy_status tool, including registration, schema definition (exchange and symbol parameters), and the handler logic that fetches current ticker price, open orders, calculates buy/sell spread, and returns comprehensive strategy status with order details.
server.tool( 'get_strategy_status', 'Get current grid strategy status: open orders, current price, and P&L estimate', { exchange: ExchangeParam, symbol: SymbolParam, }, async ({ exchange, symbol }) => { const validExchange = validateExchange(exchange); const validSymbol = validateSymbol(symbol); const connector = await getConnectorSafe(exchange); const [ticker, openOrders] = await Promise.all([ connector.getTicker(validSymbol), connector.getOpenOrders(validSymbol), ]); const buyOrders = openOrders.filter((o: any) => o.side === 'buy'); const sellOrders = openOrders.filter((o: any) => o.side === 'sell'); const spread = sellOrders.length > 0 && buyOrders.length > 0 ? Math.min(...sellOrders.map((o: any) => o.price)) - Math.max(...buyOrders.map((o: any) => o.price)) : null; return { content: [ { type: 'text' as const, text: JSON.stringify( { currentPrice: ticker.last, openOrders: { total: openOrders.length, buyOrders: buyOrders.length, sellOrders: sellOrders.length, }, gridSpread: spread, orders: openOrders.map((o: any) => ({ id: o.id, side: o.side, price: o.price, amount: o.amount, filled: o.filled, remaining: o.remaining, })), exchange: validExchange, symbol: validSymbol, timestamp: new Date().toISOString(), }, null, 2 ), }, ], }; } ); - src/utils/validators.ts:3-7 (schema)Schema definitions for ExchangeParam and SymbolParam used by get_strategy_status for input validation.
export const ExchangeParam = z .string() .describe('Exchange to query. Supported: mexc, gateio, bitget, kraken'); export const SymbolParam = z.string().describe('Trading pair symbol (e.g., BTC/USDT, INDY/USDT)'); - src/tools/index.ts:6-13 (registration)The registerStrategyTools function is imported and called to register all strategy tools including get_strategy_status.
import { registerStrategyTools } from './strategy.js'; export function registerTools(server: McpServer): void { registerMarketDataTools(server); registerAccountTools(server); registerTradingTools(server); registerCardanoTools(server); registerStrategyTools(server); - src/worker.ts:38-38 (registration)The get_strategy_status tool is listed in the MCP server capabilities card for discovery.
{ name: 'get_strategy_status' },