Closed a4399518s closed 3 months ago
Hi @a4399518s
There's not quite enough information here to look into this. If this was during a backtest and the free balance went negative then the exit is expected. If a cash account has been configured and there's some cross-asset interaction then it's potentially unsupported.
I can look into this further if you're able to provide a code snippet.
Bug Report
File "nautilus_trader/portfolio/portfolio.pyx", line 161, in nautilus_trader.portfolio.portfolio.Portfolio.initialize_orders File "nautilus_trader/portfolio/portfolio.pyx", line 204, in nautilus_trader.portfolio.portfolio.Portfolio.initialize_orders File "nautilus_trader/accounting/manager.pyx", line 168, in nautilus_trader.accounting.manager.AccountsManager.update_orders File "nautilus_trader/accounting/manager.pyx", line 244, in nautilus_trader.accounting.manager.AccountsManager._update_balance_locked File "nautilus_trader/accounting/accounts/cash.pyx", line 126, in nautilus_trader.accounting.accounts.cash.CashAccount.update_balance_locked File "nautilus_trader/accounting/accounts/cash.pyx", line 165, in nautilus_trader.accounting.accounts.cash.CashAccount._recalculate_balance File "nautilus_trader/model/objects.pyx", line 1593, in nautilus_trader.model.objects.AccountBalance.init File "nautilus_trader/core/correctness.pyx", line 58, in nautilus_trader.core.correctness.Condition.true ValueError:
free
amount was negativeExpected Behavior
Add here...
Actual Behavior
Add here...
Steps to Reproduce the Problem
code: File: /root/project/nautilus_trader/nautilus_trader/accounting/accounts/cash.pyx Line 100: Use the update_balance_locked method. Locked at 100 USDT. (Affected by the unit) Line 149: When using the _recalculate_balance method to adjust the balance, use USDT surplus of 10 - chain constant amount of 100 to get a negative number. The program is abnormally exited.
Specifications
nautilus_trader
version: