Skip to main content
Glama
questflowai

Aster Finance MCP Server

by questflowai

ticker_bookTicker

Get the best bid and ask prices with quantities for cryptocurrency trading symbols to monitor real-time order book liquidity and market depth.

Instructions

Best price/qty on the order book for a symbol or symbols.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
symbolNoTrading symbol

Implementation Reference

  • Handler for the 'ticker_bookTicker' tool. Dispatches a GET request to the Aster Futures API endpoint '/fapi/v1/ticker/bookTicker' using the shared makeRequest utility, with optional 'symbol' argument.
    case 'ticker_bookTicker':
      return makeRequest('GET', '/fapi/v1/ticker/bookTicker', args);
  • Tool registration including name, description, and input schema definition for 'ticker_bookTicker'. Input schema allows optional 'symbol' parameter.
    {
      name: 'ticker_bookTicker',
      description: 'Best price/qty on the order book for a symbol or symbols.',
      inputSchema: {
        type: 'object',
        properties: {
          symbol: { type: 'string', description: 'Trading symbol' },
        },
      },
    },
  • src/index.ts:48-537 (registration)
    The ListToolsRequestSchema handler registers all available tools, including 'ticker_bookTicker', by returning the tools array with their schemas.
    this.server.setRequestHandler(ListToolsRequestSchema, async () => {
      return {
        tools: [
          // Market Data
          { name: 'ping', description: 'Test connectivity to the Rest API.', inputSchema: { type: 'object', properties: {} } },
          { name: 'time', description: 'Get the current server time.', inputSchema: { type: 'object', properties: {} } },
          { name: 'exchangeInfo', description: 'Get current exchange trading rules and symbol information.', inputSchema: { type: 'object', properties: {} } },
          {
            name: 'depth',
            description: 'Get the order book for a symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol, e.g., BTCUSDT' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1000.' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'trades',
            description: 'Get recent market trades.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1000.' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'historicalTrades',
            description: 'Get older market historical trades.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1000.' },
                fromId: { type: 'number', description: 'TradeId to fetch from.' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'aggTrades',
            description: 'Get compressed, aggregate market trades.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                fromId: { type: 'number', description: 'ID to get aggregate trades from INCLUSIVE.' },
                startTime: { type: 'number', description: 'Timestamp in ms to get aggregate trades from INCLUSIVE.' },
                endTime: { type: 'number', description: 'Timestamp in ms to get aggregate trades until INCLUSIVE.' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1000.' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'klines',
            description: 'Get Kline/candlestick bars for a symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                interval: { type: 'string', description: 'Kline interval (e.g., 1m, 5m, 1h, 1d)' },
                startTime: { type: 'number', description: 'Start time in ms' },
                endTime: { type: 'number', description: 'End time in ms' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1500.' },
              },
              required: ['symbol', 'interval'],
            },
          },
          {
            name: 'indexPriceKlines',
            description: 'Kline/candlestick bars for the index price of a pair.',
            inputSchema: {
              type: 'object',
              properties: {
                pair: { type: 'string', description: 'Trading pair, e.g., BTCUSDT' },
                interval: { type: 'string', description: 'Kline interval' },
                startTime: { type: 'number', description: 'Start time in ms' },
                endTime: { type: 'number', description: 'End time in ms' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1500.' },
              },
              required: ['pair', 'interval'],
            },
          },
          {
            name: 'markPriceKlines',
            description: 'Kline/candlestick bars for the mark price of a symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                interval: { type: 'string', description: 'Kline interval' },
                startTime: { type: 'number', description: 'Start time in ms' },
                endTime: { type: 'number', description: 'End time in ms' },
                limit: { type: 'number', description: 'Number of results. Default 500, max 1500.' },
              },
              required: ['symbol', 'interval'],
            },
          },
          {
            name: 'premiumIndex',
            description: 'Get Mark Price and Funding Rate.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
              },
            },
          },
          {
            name: 'fundingRate',
            description: 'Get funding rate history.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
                startTime: { type: 'number', description: 'Start time in ms' },
                endTime: { type: 'number', description: 'End time in ms' },
                limit: { type: 'number', description: 'Number of results. Default 100, max 1000.' },
              },
            },
          },
          {
            name: 'fundingInfo',
            description: 'Get funding rate config.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
              },
            },
          },
          {
            name: 'ticker_24hr',
            description: '24 hour rolling window price change statistics.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
              },
            },
          },
          {
            name: 'ticker_price',
            description: 'Latest price for a symbol or symbols.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
              },
            },
          },
          {
            name: 'ticker_bookTicker',
            description: 'Best price/qty on the order book for a symbol or symbols.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string', description: 'Trading symbol' },
              },
            },
          },
          // Account/Trades
          {
            name: 'setPositionMode',
            description: "Change user's position mode (Hedge Mode or One-way Mode).",
            inputSchema: {
              type: 'object',
              properties: {
                dualSidePosition: { type: 'string', description: '"true" for Hedge Mode; "false" for One-way Mode' },
              },
              required: ['dualSidePosition'],
            },
          },
          { name: 'getPositionMode', description: "Get user's position mode.", inputSchema: { type: 'object', properties: {} } },
          {
            name: 'setMultiAssetsMode',
            description: "Change user's Multi-Assets mode.",
            inputSchema: {
              type: 'object',
              properties: {
                multiAssetsMargin: { type: 'string', description: '"true" for Multi-Assets Mode; "false" for Single-Asset Mode' },
              },
              required: ['multiAssetsMargin'],
            },
          },
          { name: 'getMultiAssetsMode', description: "Get user's Multi-Assets mode.", inputSchema: { type: 'object', properties: {} } },
          {
            name: 'placeOrder',
            description: 'Send in a new order.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                side: { type: 'string', enum: ['BUY', 'SELL'] },
                positionSide: { type: 'string', enum: ['BOTH', 'LONG', 'SHORT'] },
                type: { type: 'string', enum: ['LIMIT', 'MARKET', 'STOP', 'STOP_MARKET', 'TAKE_PROFIT', 'TAKE_PROFIT_MARKET', 'TRAILING_STOP_MARKET'] },
                timeInForce: { type: 'string', enum: ['GTC', 'IOC', 'FOK', 'GTX'] },
                quantity: { type: 'number' },
                price: { type: 'number' },
                stopPrice: { type: 'number' },
              },
              required: ['symbol', 'side', 'type'],
            },
          },
          {
            name: 'placeBatchOrders',
            description: 'Place multiple orders.',
            inputSchema: {
              type: 'object',
              properties: {
                batchOrders: {
                  type: 'array',
                  items: {
                    type: 'object',
                    properties: {
                      symbol: { type: 'string' },
                      side: { type: 'string', enum: ['BUY', 'SELL'] },
                      type: { type: 'string' },
                      quantity: { type: 'number' },
                      price: { type: 'number' },
                    },
                    required: ['symbol', 'side', 'type', 'quantity'],
                  },
                },
              },
              required: ['batchOrders'],
            },
          },
          {
            name: 'transferAsset',
            description: 'Transfer between futures and spot.',
            inputSchema: {
              type: 'object',
              properties: {
                asset: { type: 'string' },
                amount: { type: 'number' },
                clientTranId: { type: 'string' },
                kindType: { type: 'string', enum: ['FUTURE_SPOT', 'SPOT_FUTURE'] },
              },
              required: ['asset', 'amount', 'clientTranId', 'kindType'],
            },
          },
          {
            name: 'queryOrder',
            description: "Check an order's status.",
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                orderId: { type: 'number' },
                origClientOrderId: { type: 'string' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'cancelOrder',
            description: 'Cancel an active order.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                orderId: { type: 'number' },
                origClientOrderId: { type: 'string' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'cancelAllOpenOrders',
            description: 'Cancel all open orders on a symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'cancelBatchOrders',
            description: 'Cancel multiple orders.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                orderIdList: { type: 'array', items: { type: 'number' } },
                origClientOrderIdList: { type: 'array', items: { type: 'string' } },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'countdownCancelAll',
            description: 'Auto-cancel all open orders.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                countdownTime: { type: 'number', description: 'Countdown time in milliseconds.' },
              },
              required: ['symbol', 'countdownTime'],
            },
          },
          {
            name: 'queryOpenOrder',
            description: 'Query current open order.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                orderId: { type: 'number' },
                origClientOrderId: { type: 'string' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'getAllOpenOrders',
            description: 'Get all open orders on a symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
            },
          },
          {
            name: 'getAllOrders',
            description: 'Get all account orders; active, canceled, or filled.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                orderId: { type: 'number' },
                startTime: { type: 'number' },
                endTime: { type: 'number' },
                limit: { type: 'number' },
              },
              required: ['symbol'],
            },
          },
          { name: 'getBalance', description: 'Get futures account balance.', inputSchema: { type: 'object', properties: {} } },
          { name: 'getAccountInfo', description: 'Get current account information.', inputSchema: { type: 'object', properties: {} } },
          {
            name: 'setLeverage',
            description: "Change user's initial leverage.",
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                leverage: { type: 'number', minimum: 1, maximum: 125 },
              },
              required: ['symbol', 'leverage'],
            },
          },
          {
            name: 'setMarginType',
            description: 'Change margin type.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                marginType: { type: 'string', enum: ['ISOLATED', 'CROSSED'] },
              },
              required: ['symbol', 'marginType'],
            },
          },
          {
            name: 'modifyPositionMargin',
            description: 'Modify isolated position margin.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                positionSide: { type: 'string', enum: ['BOTH', 'LONG', 'SHORT'] },
                amount: { type: 'number' },
                type: { type: 'number', enum: [1, 2], description: '1: Add, 2: Reduce' },
              },
              required: ['symbol', 'amount', 'type'],
            },
          },
          {
            name: 'getPositionMarginHistory',
            description: 'Get position margin change history.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                type: { type: 'number', enum: [1, 2] },
                startTime: { type: 'number' },
                endTime: { type: 'number' },
                limit: { type: 'number' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'getPositionInfo',
            description: 'Get current position information.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
            },
          },
          {
            name: 'getTradeList',
            description: 'Get trades for a specific account and symbol.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                startTime: { type: 'number' },
                endTime: { type: 'number' },
                fromId: { type: 'number' },
                limit: { type: 'number' },
              },
              required: ['symbol'],
            },
          },
          {
            name: 'getIncomeHistory',
            description: 'Get income history.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                incomeType: { type: 'string' },
                startTime: { type: 'number' },
                endTime: { type: 'number' },
                limit: { type: 'number' },
              },
            },
          },
          {
            name: 'getLeverageBrackets',
            description: 'Get notional and leverage brackets.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
            },
          },
          {
            name: 'getAdlQuantile',
            description: 'Get Position ADL Quantile Estimation.',
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
            },
          },
          {
            name: 'getForceOrders',
            description: "Get user's force orders.",
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
                autoCloseType: { type: 'string', enum: ['LIQUIDATION', 'ADL'] },
                startTime: { type: 'number' },
                endTime: { type: 'number' },
                limit: { type: 'number' },
              },
            },
          },
          {
            name: 'getCommissionRate',
            description: "Get user's commission rate.",
            inputSchema: {
              type: 'object',
              properties: {
                symbol: { type: 'string' },
              },
              required: ['symbol'],
            },
          },
        ],
      };
    });
  • Shared helper function 'makeRequest' used by all tool handlers, including 'ticker_bookTicker', to make authenticated HTTP requests to the Aster API.
    const makeRequest = async (method: 'GET' | 'POST' | 'DELETE', path: string, params: any, isSigned = false) => {
      try {
        let config: any = {
          method,
          url: path,
        };
    
        if (isSigned) {
          if (!API_KEY || !API_SECRET) {
            throw new McpError(ErrorCode.InvalidRequest, 'API_KEY and API_SECRET must be configured.');
          }
          params.timestamp = Date.now();
          const queryString = new URLSearchParams(params).toString();
          const signature = crypto.createHmac('sha256', API_SECRET).update(queryString).digest('hex');
          params.signature = signature;
          
          config.headers = { 'X-MBX-APIKEY': API_KEY };
        }
        
        if (method === 'GET' || method === 'DELETE') {
          config.params = params;
        } else { // POST
          config.data = new URLSearchParams(params).toString();
          config.headers = { ...config.headers, 'Content-Type': 'application/x-www-form-urlencoded' };
        }
    
        const response = await this.axiosInstance.request(config);
        return { content: [{ type: 'text', text: JSON.stringify(response.data, null, 2) }] };
      } catch (error) {
        if (axios.isAxiosError(error)) {
          throw new McpError(
            ErrorCode.InternalError,
            `Aster API error: ${error.response?.data?.msg || error.message}`
          );
        }
        throw error;
      }
    };

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/questflowai/aster-mcp-server'

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