feat: M2 Money Supply integration for Safe Paper Trading

- Added macro sentiment analysis to paper-trading-safe API
- Integrates Fear & Greed Index and M2 Money Supply data
- Confidence adjustments based on macro conditions
- Enhanced UI with macro sentiment panel showing F&G and M2 signals
- Displays original vs adjusted confidence with macro impact
- Shows M2 correlation timeline (3-6 month peak impact)
- Macro adjustments applied: +/-10% for extreme F&G, +/-5% for M2
This commit is contained in:
mindesbunister
2025-08-06 00:45:53 +02:00
parent 174c155e26
commit ce42b8cade

View File

@@ -1212,6 +1212,11 @@ export default function SafePaperTradingPage() {
<div className="bg-gray-700/50 rounded p-3">
<p className="text-gray-400 text-sm">Confidence</p>
<p className="font-bold text-lg text-blue-400">{currentAnalysis.confidence}%</p>
{currentAnalysis.originalConfidence && currentAnalysis.originalConfidence !== currentAnalysis.confidence && (
<p className="text-xs text-gray-500">
(Original: {currentAnalysis.originalConfidence}%, Macro: {currentAnalysis.macroAdjustment?.netAdjustment > 0 ? '+' : ''}{currentAnalysis.macroAdjustment?.netAdjustment}%)
</p>
)}
</div>
<div className="bg-gray-700/50 rounded p-3">
<p className="text-gray-400 text-sm">Timeframes</p>
@@ -1284,6 +1289,78 @@ export default function SafePaperTradingPage() {
</pre>
</div>
{/* Macro Sentiment Panel */}
{currentAnalysis.macroSentiment && (
<div className="bg-gradient-to-r from-purple-900/30 to-blue-900/30 rounded p-4 mt-4 border border-purple-500/30">
<h4 className="text-white font-medium mb-3 flex items-center">
💰 Macro Sentiment Analysis
{currentAnalysis.macroAdjustment?.applied && (
<span className="ml-2 text-xs bg-purple-600 px-2 py-1 rounded">
{currentAnalysis.macroAdjustment.netAdjustment > 0 ? '+' : ''}{currentAnalysis.macroAdjustment.netAdjustment}%
</span>
)}
</h4>
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
{/* Fear & Greed Index */}
<div className="bg-gray-800/50 rounded p-3">
<p className="text-gray-400 text-xs">Fear & Greed Index</p>
<div className="flex items-center space-x-2">
<span className={`text-lg font-bold ${
currentAnalysis.macroSentiment.fearAndGreed?.value <= 25 ? 'text-red-400' :
currentAnalysis.macroSentiment.fearAndGreed?.value <= 45 ? 'text-orange-400' :
currentAnalysis.macroSentiment.fearAndGreed?.value >= 75 ? 'text-green-400' :
currentAnalysis.macroSentiment.fearAndGreed?.value >= 55 ? 'text-yellow-400' :
'text-gray-400'
}`}>
{currentAnalysis.macroSentiment.fearAndGreed?.value || 'N/A'}
</span>
<span className="text-xs text-gray-400">
{currentAnalysis.macroSentiment.fearAndGreed?.classification || 'unknown'}
</span>
</div>
</div>
{/* M2 Money Supply */}
<div className="bg-gray-800/50 rounded p-3">
<p className="text-gray-400 text-xs">M2 Money Supply</p>
<div className="flex items-center space-x-2">
<span className={`text-sm font-bold ${
currentAnalysis.macroSentiment.m2MoneySupply?.cryptoSignal?.signal === 'BULLISH' ? 'text-green-400' :
currentAnalysis.macroSentiment.m2MoneySupply?.cryptoSignal?.signal === 'BEARISH' ? 'text-red-400' :
'text-gray-400'
}`}>
{currentAnalysis.macroSentiment.m2MoneySupply?.cryptoSignal?.signal || 'N/A'}
</span>
<span className="text-xs text-gray-400">
({currentAnalysis.macroSentiment.m2MoneySupply?.cryptoSignal?.confidence || 0}%)
</span>
</div>
{currentAnalysis.macroSentiment.m2MoneySupply?.cryptoSignal?.timeframe && (
<p className="text-xs text-purple-400 mt-1">
{currentAnalysis.macroSentiment.m2MoneySupply.cryptoSignal.timeframe}
</p>
)}
</div>
</div>
{/* Macro Adjustments Applied */}
{currentAnalysis.macroAdjustment?.applied && (
<div className="mt-3 bg-gray-800/30 rounded p-2">
<p className="text-xs text-gray-400 mb-1">Macro Adjustments Applied:</p>
<ul className="text-xs text-gray-300 space-y-1">
{currentAnalysis.macroAdjustment.adjustments.map((adjustment, index) => (
<li key={index} className="flex items-start">
<span className="text-purple-400 mr-1"></span>
{adjustment}
</li>
))}
</ul>
</div>
)}
</div>
)}
{/* Toggle Detailed Analysis */}
<button
onClick={() => setShowDetailedAnalysis(!showDetailedAnalysis)}