Skip to main content
Glama

MCP Bitget Trading Server

by gagarinyury

subscribeToTicker

Subscribe to real-time ticker updates for specific trading pairs on Bitget cryptocurrency exchange. Choose instrument type (SPOT or UMCBL) to monitor market data instantly.

Instructions

Subscribe to real-time ticker updates

Input Schema

NameRequiredDescriptionDefault
instTypeNoInstrument type (default: SPOT)
symbolYesTrading pair symbol

Input Schema (JSON Schema)

{ "properties": { "instType": { "description": "Instrument type (default: SPOT)", "enum": [ "SPOT", "UMCBL" ], "type": "string" }, "symbol": { "description": "Trading pair symbol", "type": "string" } }, "required": [ "symbol" ], "type": "object" }

Implementation Reference

  • MCP tool handler for subscribeToTicker: extracts symbol and instType from arguments, calls the WebSocket client's subscribe method with 'ticker' channel, and returns success message.
    case 'subscribeToTicker': { const { symbol, instType = 'SPOT' } = args as any; this.wsClient.subscribe('ticker', symbol, instType); return { content: [ { type: 'text', text: `Subscribed to ticker updates for ${symbol} (${instType})`, }, ], } as CallToolResult; }
  • src/server.ts:257-268 (registration)
    Tool registration in the listTools handler, defining the name, description, and input schema for subscribeToTicker.
    { name: 'subscribeToTicker', description: 'Subscribe to real-time ticker updates', inputSchema: { type: 'object', properties: { symbol: { type: 'string', description: 'Trading pair symbol' }, instType: { type: 'string', enum: ['SPOT', 'UMCBL'], description: 'Instrument type (default: SPOT)' } }, required: ['symbol'] }, },
  • Core implementation in BitgetWebSocketClient: constructs the Bitget WS subscription message for the specified channel (e.g., 'ticker'), tracks subscription, sends it if connected or queues for reconnect.
    subscribe(channel: string, symbol: string, instType: 'SPOT' | 'UMCBL' | 'DMCBL' = 'SPOT'): void { const subscription: WSSubscription = { op: 'subscribe', args: [{ instType, channel, instId: symbol }] }; const subKey = `${instType}:${channel}:${symbol}`; this.subscriptions.add(subKey); if (this.isConnected && this.ws) { logger.debug('Subscribing to channel', { channel, symbol, instType }); this.ws.send(JSON.stringify(subscription)); } else { logger.warn('WebSocket not connected, subscription will be sent on reconnect', { channel, symbol }); } }

Other Tools

Related Tools

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/gagarinyury/MCP-bitget-trading'

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