Closed rubenmarias closed 1 month ago
Hi @rubenmarias
I've been able to reproduce the order denial, I used ETHUSDT as a placeholder instrument here but the starting conditions and maths should be the same I think.
After some buy and sell cycles the first occurrence is here:
2024-04-26T02:02:37.539078627Z [DEBUG] BACKTESTER-001.RiskEngine: Total: Money('0.17814000', ETH)
2024-04-26T02:02:37.539078627Z [DEBUG] BACKTESTER-001.RiskEngine: Locked: Money('0.00000000', ETH)
2024-04-26T02:02:37.539078627Z [DEBUG] BACKTESTER-001.RiskEngine: Free: Money('0.17814000', ETH)
2024-04-26T02:02:37.539078627Z [DEBUG] BACKTESTER-001.RiskEngine: Cumulative notional SELL: Money('0.20000000', ETH)
2024-04-26T02:02:37.539078627Z [WARN] BACKTESTER-001.RiskEngine: SubmitOrder for O-20240426-0202-001-000-625 DENIED: CUM_NOTIONAL_EXCEEDS_FREE_BALANCE: free=0.17814000 ETH, cum_notional=0.20000000 ETH
This looks like an order to sell 0.2 ETHUSDT when the available ETH balance is 0.17814000, does this match the observation you see at this timestamp?
Yes @cjdsellers, a couple things that I didn't mention:
thanks
Indeed, I see at that timestamp both the strategy inventory
and portfolio.net_position
both agree at LONG 0.20702.
Now fixed from ae9677a559c4be36fbeaf017a7ad92e23a82de63.
Bug Report
Expected Behavior
Sell order is submitted without being blocked by the risk engine
Actual Behavior
Risk engine denies an order due to
CUM_NOTIONAL_EXCEEDS_FREE_BALANCE
even though there is enough balance.Steps to Reproduce the Problem
Specifications
nautilus_trader
version: 1.191.0 dummy_strategy.txt quote_ticks_bug.csv