feat: add full-margin position sizing mode across four exchanges
Env POSITION_SIZING_MODE switches risk vs full-margin (available*buffer, BTC/ETH 10x). Blocks trend/roll/key auto opens in full margin, purges breakout/fib monitors with WeChat notice, keeps RR check and initial SL snapshot for records. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -103,6 +103,17 @@ def _count_active_trends(conn, cfg: dict) -> int:
|
||||
|
||||
|
||||
def _roll_preview_response(cfg: dict, data: dict, json_mode: bool = False) -> dict:
|
||||
m = cfg.get("app_module")
|
||||
if m is not None:
|
||||
try:
|
||||
from position_sizing_lib import OPEN_SOURCE_ROLL, assert_open_source_allowed
|
||||
|
||||
mode = getattr(m, "POSITION_SIZING_MODE", None) or "risk"
|
||||
ok_src, src_msg = assert_open_source_allowed(mode, OPEN_SOURCE_ROLL)
|
||||
if not ok_src:
|
||||
return {"ok": False, "msg": src_msg}
|
||||
except Exception:
|
||||
pass
|
||||
get_db = cfg["get_db"]
|
||||
symbol = cfg["normalize_symbol_input"](data.get("symbol") or "")
|
||||
if not symbol:
|
||||
|
||||
Reference in New Issue
Block a user