Skip to main content
Glama
TeleKashOracle

telekash-mcp-server

get_history

Retrieve historical probability changes and trend data for prediction markets to analyze shifts in odds, sentiment, and market consensus over time.

Instructions

Get historical probability changes and trend data for a prediction market over time.

Returns probability snapshots showing how odds, sentiment, and market consensus have shifted over 1h, 24h, 7d, or 30d. Use for trend analysis, momentum detection, volatility assessment, and understanding how predictions evolve. Essential for backtesting strategies, identifying probability swings, and spotting market-moving events.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
market_idYesThe market UUID or external_id (ticker)
timeframeNoTime range for history (default: 24h)

Implementation Reference

  • The get_history tool handler, which queries the 'telekash_probability_history' table for historical probability and volume data for a given market.
    async function getHistory(
      supabase: SupabaseClient,
      args: { market_id: string; timeframe?: string },
    ): Promise<ToolResult> {
      const { market_id, timeframe = "24h" } = args;
      const market = await findMarket(supabase, market_id);
      if (!market) return err("Market not found");
    
      const timeframeMs: Record<string, number> = {
        "1h": 3600000,
        "24h": 86400000,
        "7d": 604800000,
        "30d": 2592000000,
      };
      const startTime = new Date(
        Date.now() - (timeframeMs[timeframe] || timeframeMs["24h"]),
      ).toISOString();
    
      const { data: historyData } = await supabase
        .from("telekash_probability_history")
        .select("probability, volume, recorded_at")
        .eq("market_id", market.id)
        .gte("recorded_at", startTime)
        .order("recorded_at", { ascending: true });
    
      // eslint-disable-next-line @typescript-eslint/no-explicit-any
      const history = (historyData || []).map((h: any) => ({
        probability: Math.round(h.probability * 100),
        volume: h.volume || 0,
        timestamp: h.recorded_at,
      }));
    
      let trend = "stable";
      if (history.length >= 2) {
        const change =
          history[history.length - 1].probability - history[0].probability;
        trend = change > 1 ? "up" : change < -1 ? "down" : "stable";
      }
    
      return json({
        market_id: market.id,
        title: market.title,
        timeframe,
        data_points: history.length,
        trend,
        history,
        current: {
          yes_probability: Math.round((market.external_odds?.yes || 0.5) * 100),
          no_probability: Math.round((market.external_odds?.no || 0.5) * 100),
          volume: market.raw_data?.volume || 0,
          timestamp: market.updated_at,
        },
      });
    }
  • The registration of 'get_history' within the tool dispatcher in worker/src/tools.ts.
    case "get_history":
      return getHistory(
        supabase,
        args as { market_id: string; timeframe?: string },
      );

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

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