MidasBot: bot trading crypto IA + stratégies Ichimoku validées
- Infra: Freqtrade (futures dry-run) + Redis + dashboard + Docker Compose - Couche IA: ai_analyzer (Claude via abonnement, MCP TradingView, backfill biais) - Stratégies: SampleStrategy, AiBiasStrategy, IchimokuLS (long/short, validée train/test + données vierges + walk-forward), MTFIchimoku, variantes hyperopt - Arbitrage CEX (dry-run), backtesting, walk-forward, volatility targeting - IchimokuLS en dry-run live (config_live.json) Claude-Session: https://claude.ai/code/session_01VHETcFacdnDhQzthLpdYFR
This commit is contained in:
58
ai_analyzer/models.py
Normal file
58
ai_analyzer/models.py
Normal file
@@ -0,0 +1,58 @@
|
||||
"""Schémas de données partagés (Pydantic) pour la couche IA."""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Literal, Optional
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
|
||||
Direction = Literal["bullish", "bearish", "neutral"]
|
||||
|
||||
|
||||
class MarketBias(BaseModel):
|
||||
"""Biais de marché produit par Claude pour une paire."""
|
||||
|
||||
pair: str = Field(..., description="Paire, ex. 'BTC/USDT'")
|
||||
direction: Direction = Field(..., description="Sens du biais")
|
||||
confidence: float = Field(..., ge=0.0, le=1.0, description="Confiance [0..1]")
|
||||
rationale: str = Field(..., description="Justification courte et factuelle")
|
||||
key_support: Optional[float] = Field(None, description="Support clé (prix)")
|
||||
key_resistance: Optional[float] = Field(None, description="Résistance clé (prix)")
|
||||
|
||||
|
||||
class MarketBiasBatch(BaseModel):
|
||||
"""Lot de biais (un appel Claude couvre toutes les paires)."""
|
||||
|
||||
biases: list[MarketBias]
|
||||
|
||||
def by_pair(self) -> dict[str, MarketBias]:
|
||||
return {b.pair: b for b in self.biases}
|
||||
|
||||
@staticmethod
|
||||
def json_schema() -> dict:
|
||||
"""Schéma JSON passé à `claude -p --json-schema` (sous-ensemble supporté)."""
|
||||
return {
|
||||
"type": "object",
|
||||
"additionalProperties": False,
|
||||
"required": ["biases"],
|
||||
"properties": {
|
||||
"biases": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"additionalProperties": False,
|
||||
"required": ["pair", "direction", "confidence", "rationale"],
|
||||
"properties": {
|
||||
"pair": {"type": "string"},
|
||||
"direction": {
|
||||
"type": "string",
|
||||
"enum": ["bullish", "bearish", "neutral"],
|
||||
},
|
||||
"confidence": {"type": "number"},
|
||||
"rationale": {"type": "string"},
|
||||
"key_support": {"type": "number"},
|
||||
"key_resistance": {"type": "number"},
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user