feat: apply dynamic margin ratio in bot position sizing

Made-with: Cursor
This commit is contained in:
21in7
2026-03-01 20:39:07 +09:00
parent 795689ac49
commit ab580b18af
2 changed files with 13 additions and 8 deletions

View File

@@ -6,16 +6,16 @@ from src.config import Config
def test_config_loads_symbol():
os.environ["SYMBOL"] = "XRPUSDT"
os.environ["LEVERAGE"] = "10"
os.environ["RISK_PER_TRADE"] = "0.02"
cfg = Config()
assert cfg.symbol == "XRPUSDT"
assert cfg.leverage == 10
assert cfg.risk_per_trade == 0.02
def test_config_notion_keys():
os.environ["NOTION_TOKEN"] = "secret_test"
os.environ["NOTION_DATABASE_ID"] = "db_test_id"
def test_config_dynamic_margin_params():
os.environ["MARGIN_MAX_RATIO"] = "0.50"
os.environ["MARGIN_MIN_RATIO"] = "0.20"
os.environ["MARGIN_DECAY_RATE"] = "0.0006"
cfg = Config()
assert cfg.notion_token == "secret_test"
assert cfg.notion_database_id == "db_test_id"
assert cfg.margin_max_ratio == 0.50
assert cfg.margin_min_ratio == 0.20
assert cfg.margin_decay_rate == 0.0006