File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
src/quant_research_starter/api Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ """Pydantic schemas for API requests/responses."""
2+ from __future__ import annotations
3+ from typing import Optional , Any , Dict
4+ from pydantic import BaseModel , Field
5+
6+
7+ class Token (BaseModel ):
8+ access_token : str
9+ token_type : str = "bearer"
10+
11+
12+ class TokenData (BaseModel ):
13+ username : Optional [str ] = None
14+
15+
16+ class UserCreate (BaseModel ):
17+ username : str
18+ password : str
19+
20+
21+ class UserRead (BaseModel ):
22+ id : int
23+ username : str
24+ is_active : bool
25+ role : str
26+
27+
28+ class BacktestRequest (BaseModel ):
29+ data_file : Optional [str ] = None
30+ signals_file : Optional [str ] = None
31+ initial_capital : Optional [float ] = 1_000_000
32+ weight_scheme : Optional [str ] = "rank"
33+ rebalance_freq : Optional [str ] = "D"
34+
35+
36+ class BacktestStatus (BaseModel ):
37+ job_id : str
38+ status : str
39+
40+
41+ class BacktestResult (BaseModel ):
42+ metrics : Dict [str , Any ]
43+ portfolioSnapshots : Optional [list ] = Field (default_factory = list )
44+ trades : Optional [list ] = Field (default_factory = list )
You can’t perform that action at this time.
0 commit comments