Skip to main content
Glama

get_macro_context

Retrieve macroeconomic indicators for cryptocurrency analysis, including Federal Funds Rate, DXY, yield curve, recession probability, and net crypto impact.

Instructions

Get macro economic context for crypto: Federal Funds Rate, DXY (dollar strength), yield curve, recession probability, and net macro impact on crypto.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the `get_macro_context` tool, which fetches macro data, evaluates crypto impacts, and generates a context summary and guidance.
    export async function getMacroContext(cache: CacheService): Promise<MacroContextOutput | ErrorOutput> {
      const cached = cache.get<MacroContextOutput>(CACHE_KEY);
      if (cached) return cached.data;
    
      try {
        const macro = await getMacroData();
    
        // Determine crypto impact
        const impact = determineCryptoImpact(macro.dxyTrend, macro.fedFundsTrend, macro.yieldCurveState);
    
        // Recession probability
        const recessionProb = determineRecessionProbability(macro.yieldCurveState, macro.fedFundsTrend);
    
        // Summary
        const summary = generateMacroSummary(macro, impact, recessionProb);
        const guidance = generateMacroGuidance(impact, recessionProb, macro.fedFundsTrend, macro.dxyTrend);
    
        const result: MacroContextOutput = {
          fed_funds_rate: macro.fedFundsRate ?? 0,
          fed_funds_trend: macro.fedFundsTrend,
          dxy_value: macro.dxyValue ?? 0,
          dxy_trend: macro.dxyTrend,
          yield_curve: macro.yieldCurve ?? 0,
          yield_curve_state: macro.yieldCurveState,
          recession_probability: recessionProb,
          macro_crypto_impact: impact,
          macro_summary: summary,
          agent_guidance: guidance,
        };
    
        cache.set(CACHE_KEY, result, getCacheTtl(BASE_TTL));
        return result;
      } catch (err) {
        return {
          error: true,
          error_source: 'get_macro_context',
          agent_guidance: 'Macro context unavailable (FRED API). Without macro backdrop, assume neutral-to-cautious conditions. Do not assume monetary policy is favorable — check manually before large allocations.',
          last_known_data: cache.get<MacroContextOutput>(CACHE_KEY)?.data ?? null,
          data_warnings: ['Macro data source temporarily unavailable. Retry shortly.'],
        };
      }
    }

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/0xHashy/fathom-fyi'

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