fix(ml): make pair and timeframe optional in PredictRequest
- Change pair and timeframe fields from required to optional - Frontend only sends candles array, not pair/timeframe metadata - These fields are only used for logging, not prediction logic - Update logging to handle None values with 'unknown' fallback - Fixes 422 validation error on /predict endpoint
This commit is contained in:
parent
5a7c901980
commit
6d0d67e39b
2 changed files with 3 additions and 3 deletions
|
|
@ -71,8 +71,8 @@ class CandleData(BaseModel):
|
|||
|
||||
class PredictRequest(BaseModel):
|
||||
"""Request model for /predict endpoint."""
|
||||
pair: str = Field(..., description="Trading pair (e.g., EURUSD)")
|
||||
timeframe: str = Field(..., description="Timeframe (e.g., 1H, 4H, 1D)")
|
||||
pair: Optional[str] = Field(None, description="Trading pair (e.g., EURUSD)")
|
||||
timeframe: Optional[str] = Field(None, description="Timeframe (e.g., 1H, 4H, 1D)")
|
||||
candles: List[CandleData] = Field(..., min_length=1, description="Array of candle data")
|
||||
|
||||
|
||||
|
|
@ -518,7 +518,7 @@ async def predict(request: PredictRequest):
|
|||
detail="Pipeline configuration not loaded"
|
||||
)
|
||||
|
||||
logger.info(f"Predict request: {request.pair} {request.timeframe}, {len(request.candles)} candles")
|
||||
logger.info(f"Predict request: {request.pair or 'unknown'} {request.timeframe or 'unknown'}, {len(request.candles)} candles")
|
||||
|
||||
try:
|
||||
# Convert candles to list of dicts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue