get_market_regime
Identify current crypto market regimes (risk-on, risk-off, etc.) with confidence scores, evidence, and actionable guidance to inform trading decisions.
Instructions
Classify the current crypto market regime (risk-on, risk-off, transitional, euphoric, capitulation) with confidence score, evidence, historical analog, and actionable agent guidance.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/get-market-regime.ts:12-68 (handler)Handler function for the get_market_regime tool. It fetches market data, classifies the regime, and generates guidance based on the current market state.
export async function getMarketRegime(cache: CacheService): Promise<MarketRegimeOutput | ErrorOutput> { const cached = cache.get<MarketRegimeOutput>(CACHE_KEY); if (cached) return cached.data; try { const [globalData, fgData] = await Promise.all([ getGlobalData(), getFearGreed(7), ]); const fearGreed = parseInt(fgData.data[0].value, 10); const btcDominance = globalData.data.market_cap_percentage['btc'] ?? 0; const marketCapChange24h = globalData.data.market_cap_change_percentage_24h_usd; const totalMarketCap = globalData.data.total_market_cap['usd'] ?? 0; const { regime, confidence, evidence } = classifyRegime({ fearGreed, btcDominance, marketCapChange24h, }); const btcDominanceTrend = getBtcDominanceTrend(btcDominance); const historicalAnalog = matchHistoricalAnalog({ regime, fearGreed, btcDominanceTrend, }); const guidance = generateRegimeGuidance(regime, fearGreed, confidence, btcDominanceTrend); const result: MarketRegimeOutput = { regime, confidence, evidence, historical_analog: historicalAnalog, fear_greed_score: fearGreed, fear_greed_label: getFearGreedLabel(fearGreed), btc_dominance: Math.round(btcDominance * 100) / 100, btc_dominance_trend: btcDominanceTrend, total_market_cap_usd: totalMarketCap, market_cap_change_24h: Math.round(marketCapChange24h * 100) / 100, agent_guidance: guidance, }; cache.set(CACHE_KEY, result, getCacheTtl(BASE_TTL)); return result; } catch (err) { return { error: true, error_source: 'get_market_regime', agent_guidance: 'Market regime data unavailable. Fathom recommends delaying financially consequential decisions until data is restored. Treat current conditions as high-uncertainty.', last_known_data: cache.get<MarketRegimeOutput>(CACHE_KEY)?.data ?? null, data_warnings: ['Market regime data source temporarily unavailable. Retry shortly.'], }; } }