Add martingale mode for risk-based percent sizing.

Enable in settings (default off): after N consecutive loss days, double the effective risk_loss_pct up to a configurable max; blocked when base pct > 3%.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-08-07 09:55:29 +08:00
parent 3d1f9f3d50
commit 0f552eb50e
9 changed files with 476 additions and 10 deletions
+3
View File
@@ -284,6 +284,9 @@ async def fleet_status(_tok: Annotated[str, Depends(require_fleet_token)]) -> di
"risk_perp_unit": _pick("risk_perp_unit", 1.0),
"risk_option_unit": _pick("risk_option_unit", 2.0),
"risk_exit_unit": _pick("risk_exit_unit", 15.0),
"martingale_enabled": st.get("martingale_enabled"),
"martingale_doubles": st.get("martingale_doubles"),
"risk_effective_loss_pct": st.get("risk_effective_loss_pct"),
},
"position": {
"status": pos.get("status") or ("open" if pos.get("has_position") else "flat"),