Skip to main content
Glama

get_strategy_performance

Retrieve detailed performance metrics and daily NAV history for QuantToGo macro-factor trading strategies to analyze historical returns and generate performance charts.

Instructions

Get detailed performance data for a specific QuantToGo macro-factor strategy, including daily NAV (net asset value) history for charting. QuantToGo is a quantitative signal source where every signal is timestamped and immutable from the moment it's published. Use productId from list_strategies.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productIdYesStrategy product ID, e.g. 'PROD-E3X'
includeChartNoInclude daily NAV data points for charting

Implementation Reference

  • Handler function that executes get_strategy_performance tool logic. Makes parallel API calls to getProductDetail and getProductChart, constructs and returns detailed performance data including NAV history for charting.
      async ({ productId, includeChart }) => {
        const [detailRes, chartRes] = await Promise.all([
          callAPI("getProductDetail", { productId }) as Promise<{
            code: number;
            data: Record<string, unknown>;
          }>,
          includeChart
            ? (callAPI("getProductChart", { productId }) as Promise<{
                code: number;
                data: Record<string, unknown>;
              }>)
            : Promise.resolve(null),
        ]);
    
        if (detailRes.code !== 0 || !detailRes.data) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Strategy '${productId}' not found`,
              },
            ],
          };
        }
    
        const d = detailRes.data;
        const result: Record<string, unknown> = {
          productId: d.productId,
          name: d.name,
          market: d.market,
          description: d.description || d.shortDescription,
          totalReturn: d.totalReturn ?? d.totalReturn5Y,
          metricsYearLabel: d.metricsYearLabel,
          maxDrawdown: d.maxDrawdown,
          recent1dReturn: d.recent1dReturn,
          recent30dReturn: d.recent30dReturn,
          tradeCount: d.tradeCount ?? d.tradeCount5Y,
          status: d.status,
        };
    
        if (chartRes?.data) {
          const cd = chartRes.data;
          result.chart = {
            totalPoints: cd.totalPoints,
            lastUpdated: cd.lastUpdated,
            dataPoints: cd.dataPoints, // [{d, nav}, ...]
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • Input schema definition using Zod. Defines productId (required string) and includeChart (optional boolean with default true) parameters for the tool.
    {
      productId: z.string().describe("Strategy product ID, e.g. 'PROD-E3X'"),
      includeChart: z
        .boolean()
        .optional()
        .default(true)
        .describe("Include daily NAV data points for charting"),
    },
  • src/index.ts:96-165 (registration)
    Complete tool registration using server.tool() method. Registers 'get_strategy_performance' with description, input schema, and handler function.
    server.tool(
      "get_strategy_performance",
      "Get detailed performance data for a specific QuantToGo macro-factor strategy, including daily NAV (net asset value) history for charting. QuantToGo is a quantitative signal source where every signal is timestamped and immutable from the moment it's published. Use productId from list_strategies.",
      {
        productId: z.string().describe("Strategy product ID, e.g. 'PROD-E3X'"),
        includeChart: z
          .boolean()
          .optional()
          .default(true)
          .describe("Include daily NAV data points for charting"),
      },
      async ({ productId, includeChart }) => {
        const [detailRes, chartRes] = await Promise.all([
          callAPI("getProductDetail", { productId }) as Promise<{
            code: number;
            data: Record<string, unknown>;
          }>,
          includeChart
            ? (callAPI("getProductChart", { productId }) as Promise<{
                code: number;
                data: Record<string, unknown>;
              }>)
            : Promise.resolve(null),
        ]);
    
        if (detailRes.code !== 0 || !detailRes.data) {
          return {
            content: [
              {
                type: "text" as const,
                text: `Strategy '${productId}' not found`,
              },
            ],
          };
        }
    
        const d = detailRes.data;
        const result: Record<string, unknown> = {
          productId: d.productId,
          name: d.name,
          market: d.market,
          description: d.description || d.shortDescription,
          totalReturn: d.totalReturn ?? d.totalReturn5Y,
          metricsYearLabel: d.metricsYearLabel,
          maxDrawdown: d.maxDrawdown,
          recent1dReturn: d.recent1dReturn,
          recent30dReturn: d.recent30dReturn,
          tradeCount: d.tradeCount ?? d.tradeCount5Y,
          status: d.status,
        };
    
        if (chartRes?.data) {
          const cd = chartRes.data;
          result.chart = {
            totalPoints: cd.totalPoints,
            lastUpdated: cd.lastUpdated,
            dataPoints: cd.dataPoints, // [{d, nav}, ...]
          };
        }
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      }
    );
  • Helper function callAPI that makes POST requests to QuantToGo API endpoints. Used by the handler to fetch product details and chart data.
    async function callAPI(fn: string, body: Record<string, unknown> = {}): Promise<unknown> {
      const resp = await fetch(`${API_BASE}/${fn}`, {
        method: "POST",
        headers: { "Content-Type": "application/json" },
        body: JSON.stringify(body),
      });
      if (!resp.ok) throw new Error(`API ${fn} returned ${resp.status}`);
      return resp.json();
    }

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/QuantToGo/quanttogo-mcp'

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