Skip to main content
Glama
nonnname

T-Invest MCP Server

by nonnname

get_margin_attributes

Retrieve margin account attributes like liquid portfolio value and initial margin requirements from T-Invest to manage trading positions and risk exposure.

Instructions

Получить маржинальные атрибуты счёта (ликвидный портфель, начальная маржа) из Т-Инвестиций

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
accountIdYesИдентификатор счёта (можно получить через get_accounts)

Implementation Reference

  • The 'get_margin_attributes' tool is registered and implemented within the registerGetUserInfo function in src/tools/get-user-info.ts. It handles the API call to GetMarginAttributes and formats the response.
    server.tool(
      'get_margin_attributes',
      'Получить маржинальные атрибуты счёта (ликвидный портфель, начальная маржа) из Т-Инвестиций',
      {
        accountId: z.string().describe('Идентификатор счёта (можно получить через get_accounts)'),
      },
      READ_ONLY,
      async ({ accountId }) => {
        try {
          const response = await client.post<GetMarginAttributesResponse>(
            API_PATHS.USERS.GET_MARGIN_ATTRIBUTES,
            { accountId },
          );
    
          const lines: string[] = [];
          if (response.liquidPortfolio) lines.push(`Ликвидный портфель: ${formatMoney(response.liquidPortfolio)}`);
          if (response.startingMargin) lines.push(`Начальная маржа: ${formatMoney(response.startingMargin)}`);
          if (response.minimalMargin) lines.push(`Минимальная маржа: ${formatMoney(response.minimalMargin)}`);
          if (response.amountOfMissingFunds) lines.push(`Дефицит средств: ${formatMoney(response.amountOfMissingFunds)}`);
          if (response.fundsSufficiencyLevel) {
            lines.push(`Уровень достаточности: ${quotationToNumber(response.fundsSufficiencyLevel).toFixed(4)}`);
          }
    
          return {
            content: [{ type: 'text' as const, text: lines.length > 0 ? 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