Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_max_lots

Calculate the maximum number of lots you can buy or sell in T-Invest by providing account ID, ticker, and optional price.

Instructions

Рассчитать максимальное количество лотов для покупки/продажи в Т-Инвестициях

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesИдентификатор счёта
tickerYesТикер инструмента
priceNoЦена для расчёта (по умолчанию — рыночная)

Implementation Reference

  • The tool registration and handler implementation for "get_max_lots".
    export function registerGetMaxLots(server: McpServer, client: TInvestClient): void {
      server.tool(
        'get_max_lots',
        'Рассчитать максимальное количество лотов для покупки/продажи в Т-Инвестициях',
        {
          accountId: z.string().describe('Идентификатор счёта'),
          ticker: z.string().describe('Тикер инструмента'),
          price: z.number().positive().optional().describe('Цена для расчёта (по умолчанию — рыночная)'),
        },
        READ_ONLY,
        async ({ accountId, ticker, price }) => {
          try {
            const item = await resolveTickerToInstrument(client, ticker);
            if (!item) {
              return { content: [{ type: 'text' as const, text: `Инструмент "${ticker}" не найден.` }], isError: true };
            }
    
            const body: Record<string, unknown> = { accountId, instrumentId: item.uid };
            if (price !== undefined) {
              body.price = toQuotation(price);
            }
    
            const response = await client.post<GetMaxLotsResponse>(
              API_PATHS.ORDERS.GET_MAX_LOTS,
              body,
            );
    
            const lines = [
              `${ticker}:`,
              `  Макс. покупка (рынок): ${response.buyMarketMax ?? 'н/д'} лот(ов)`,
              `  Макс. покупка (лимит): ${response.buyLimitMax ?? 'н/д'} лот(ов)`,
              `  Макс. продажа (рынок): ${response.sellMarketMax ?? 'н/д'} лот(ов)`,
              `  Макс. продажа (лимит): ${response.sellLimitMax ?? 'н/д'} лот(ов)`,
              `  Валюта: ${response.currency}`,
            ];
    
            return { content: [{ type: 'text' as const, text: lines.join('\n') }] };
          } catch (error) {
            return {
              content: [{ type: 'text' as const, text: `Ошибка: ${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/nonnname/t-invest-mcp-server'

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