Replies: 1 comment
-
This issue is not necessarily an error but a result of how we calculate asset allocation: we use the previous day's end-of-day (EOD) prices to determine order quantities, then execute these orders at the next day’s market open. Since the quantities are based on EOD prices, but executed using opening prices, a significant gap up could mean insufficient cash to buy the planned quantities. The rebalance() function includes a cash_reserve parameter to set a cash buffer, helping to mitigate this risk. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I think Minitrade is an excellent project that aligns very well with my needs. I'm grateful for the hard work and dedication you've put into building such a useful tool.
I'm playing with Multi-Asset Example in the documentation.
The example itself which uses bucket.weight_explicitly() works flawlessly, however, bucket.weight_equally() raises error:
RuntimeError: Not enough liquidity for , has 9310, needs 9344, aborting
From my observation, it seems that the rebalancing logic in minitrade might attempt to sell existing assets to free up capital for purchasing required assets. However, there might be a calculation issue in determining the exact amount of capital that can be reallocated. Specifically, the framework might be overestimating the available liquidity after sales, leading it to place orders that exceed actual available funds. This results in a “Not enough liquidity” error.
Would appreciate any guidance on this issue or insight into the rebalancing calculation approach to confirm if there is a workaround or planned fix. Thank you!
Source code
Error stack
Beta Was this translation helpful? Give feedback.
All reactions