Skip to main content
Glama

get-leverage-tiers

Retrieve futures leverage tiers for specific trading pairs on cryptocurrency exchanges. Define exchange, symbol, and market type to access precise leverage data for informed trading decisions.

Instructions

Get futures leverage tiers for trading pairs

Input Schema

NameRequiredDescriptionDefault
exchangeYesExchange ID (e.g., binance, bybit)
marketTypeNoMarket type (default: future)future
symbolNoTrading pair symbol (optional, e.g., BTC/USDT)

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "exchange": { "description": "Exchange ID (e.g., binance, bybit)", "type": "string" }, "marketType": { "default": "future", "description": "Market type (default: future)", "enum": [ "future", "swap" ], "type": "string" }, "symbol": { "description": "Trading pair symbol (optional, e.g., BTC/USDT)", "type": "string" } }, "required": [ "exchange" ], "type": "object" }

Implementation Reference

  • The handler function that implements the core logic of the 'get-leverage-tiers' tool. It fetches leverage tiers for futures/swap markets using the exchange API, with caching and rate limiting.
    }, async ({ exchange, symbol, marketType }) => { try { return await rateLimiter.execute(exchange, async () => { // Get futures exchange const ex = getExchangeWithMarketType(exchange, marketType); const cacheKey = `leverage_tiers:${exchange}:${marketType}:${symbol || 'all'}`; const tiers = await getCachedData(cacheKey, async () => { log(LogLevel.INFO, `Fetching leverage tiers for ${symbol || 'all symbols'} on ${exchange} (${marketType})`); if (symbol) { return await ex.fetchMarketLeverageTiers(symbol); } else { return await ex.fetchLeverageTiers(); } }, 3600000); // Cache for 1 hour return { content: [{ type: "text", text: JSON.stringify(tiers, null, 2) }] }; }); } catch (error) { log(LogLevel.ERROR, `Error fetching leverage tiers: ${error instanceof Error ? error.message : String(error)}`); return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } });
  • Zod schema defining the input parameters for the 'get-leverage-tiers' tool: required exchange, optional symbol, and marketType.
    exchange: z.string().describe("Exchange ID (e.g., binance, bybit)"), symbol: z.string().optional().describe("Trading pair symbol (optional, e.g., BTC/USDT)"), marketType: z.enum(["future", "swap"]).default("future").describe("Market type (default: future)")
  • Registration of the 'get-leverage-tiers' tool on the MCP server within the registerPublicTools function.
    server.tool("get-leverage-tiers", "Get futures leverage tiers for trading pairs", { exchange: z.string().describe("Exchange ID (e.g., binance, bybit)"), symbol: z.string().optional().describe("Trading pair symbol (optional, e.g., BTC/USDT)"), marketType: z.enum(["future", "swap"]).default("future").describe("Market type (default: future)") }, async ({ exchange, symbol, marketType }) => { try { return await rateLimiter.execute(exchange, async () => { // Get futures exchange const ex = getExchangeWithMarketType(exchange, marketType); const cacheKey = `leverage_tiers:${exchange}:${marketType}:${symbol || 'all'}`; const tiers = await getCachedData(cacheKey, async () => { log(LogLevel.INFO, `Fetching leverage tiers for ${symbol || 'all symbols'} on ${exchange} (${marketType})`); if (symbol) { return await ex.fetchMarketLeverageTiers(symbol); } else { return await ex.fetchLeverageTiers(); } }, 3600000); // Cache for 1 hour return { content: [{ type: "text", text: JSON.stringify(tiers, null, 2) }] }; }); } catch (error) { log(LogLevel.ERROR, `Error fetching leverage tiers: ${error instanceof Error ? error.message : String(error)}`); return { content: [{ type: "text", text: `Error: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } });

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/doggybee/mcp-server-ccxt'

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