"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(backtest): price micro equity-index contracts at the micro rate
t2c1d6d9488e8
diff --git a/agent/backtest/engines/global_futures.py b/agent/backtest/engines/global_futures.pyindex 2afdf3131..c0cc37583 100644--- a/agent/backtest/engines/global_futures.py+++ b/agent/backtest/engines/global_futures.py@@ -81,7 +81,7 @@ _PRICE_LIMIT: dict[str, float] = {_COMMISSION_PER_CONTRACT: dict[str, float] = {"ES": 2.25, "NQ": 2.25, "YM": 2.25, "RTY": 2.25,- "MES": 0.62, "MNQ": 0.62,+ "MES": 0.62, "MNQ": 0.62, "MYM": 0.62, "M2K": 0.62,"CL": 2.25, "NG": 2.25,"GC": 2.25, "SI": 2.25, "HG": 2.25,"MGC": 0.62,diff --git a/agent/tests/test_global_futures_engine.py b/agent/tests/test_global_futures_engine.pyindex 537d85792..ec1a7bc52 100644--- a/agent/tests/test_global_futures_engine.py+++ b/agent/tests/test_global_futures_engine.py@@ -201,6 +201,22 @@ class TestCommission:comm = engine.calc_commission(5, 5000.0, 1, is_open=True)assert comm == pytest.approx(5.0)+ @pytest.mark.parametrize("symbol", ["MYMZ4", "M2KZ4"])+ def test_every_micro_equity_index_pays_the_micro_rate(self, symbol: str) -> None:+ """The micro equity-index contracts are priced like their siblings.++ MES/MNQ already carried the micro rate; MYM/M2K used to fall through+ to the full-size default and cost 4x what the same family pays.+ """+ engine = _make_engine()+ comm = engine.calc_commission_for_symbol(symbol, 1, 5000.0, is_open=True)+ assert comm == pytest.approx(0.62)++ def test_unlisted_product_keeps_the_default(self) -> None:+ engine = _make_engine()+ comm = engine.calc_commission_for_symbol("XYZF25", 1, 5000.0, is_open=True)+ assert comm == pytest.approx(2.50)+# ---------------------------------------------------------------------------# Contract multiplier