feat: Add core trading modules for risk management, backtesting, and execution algorithms, alongside a new ML transparency widget and related frontend dependencies.
Some checks are pending
Documentation / build-docs (push) Waiting to run
Tests / test (macos-latest, 3.11) (push) Waiting to run
Tests / test (macos-latest, 3.12) (push) Waiting to run
Tests / test (macos-latest, 3.13) (push) Waiting to run
Tests / test (macos-latest, 3.14) (push) Waiting to run
Tests / test (ubuntu-latest, 3.11) (push) Waiting to run
Tests / test (ubuntu-latest, 3.12) (push) Waiting to run
Tests / test (ubuntu-latest, 3.13) (push) Waiting to run
Tests / test (ubuntu-latest, 3.14) (push) Waiting to run

This commit is contained in:
2025-12-31 21:25:06 -05:00
parent 099432bf3f
commit 7bd6be64a4
743 changed files with 8617 additions and 5042 deletions

View File

@@ -46,6 +46,17 @@ class OrderCreate(BaseModel):
price: Optional[Decimal] = None
strategy_id: Optional[int] = None
paper_trading: bool = True
# Advanced order parameters
take_profit_price: Optional[Decimal] = None
stop_loss_price: Optional[Decimal] = None
trail_percent: Optional[Decimal] = None # For trailing stop (e.g., 0.02 for 2%)
# For bracket orders
bracket_take_profit: Optional[Decimal] = None
bracket_stop_loss: Optional[Decimal] = None
# For OCO orders
oco_price: Optional[Decimal] = None # Second order price for OCO
# For iceberg orders
visible_quantity: Optional[Decimal] = None # Visible quantity for iceberg
class OrderResponse(BaseModel):
@@ -168,6 +179,36 @@ class BacktestRequest(BaseModel):
fee_rate: float = 0.001
class WalkForwardRequest(BaseModel):
"""Walk-forward analysis request."""
strategy_id: int
symbol: str
exchange: str
timeframe: str
start_date: datetime
end_date: datetime
train_period_days: int = 90
test_period_days: int = 30
step_days: int = 30
initial_capital: Decimal = Decimal("10000.0")
parameter_grid: Optional[Dict[str, List[Any]]] = None
optimization_metric: str = "sharpe_ratio"
class MonteCarloRequest(BaseModel):
"""Monte Carlo simulation request."""
strategy_id: int
symbol: str
exchange: str
timeframe: str
start_date: datetime
end_date: datetime
initial_capital: Decimal = Decimal("10000.0")
num_simulations: int = 1000
parameter_ranges: Optional[Dict[str, List[float]]] = None # {param_name: [min, max]}
random_seed: Optional[int] = None
class BacktestResponse(BaseModel):
"""Backtest response."""
backtest_id: Optional[int] = None