My paper account worked fine but the code just went live recently and I noticed an issue.
My bot is set to trade 90% of my cash balance. When it exits a trade it waits 5 minutes and then initiates the buy order for the new ticker. The problem that only happens in a live account is that it does not make use of the completed trades funds. It only makes use of the 10% cash that was not used in the beginning trade.
I guess I need to know if there is a waiting period before I can use account.cash balance for the next trade? I am only ever making at most two trades per day (one sell, one buy).
@Austin Perhaps paste your code for help troubleshooting? A couple of things though.
cash is updated immediately after an order fills (credited for a sale and debited for a buy). There is no ‘waiting period’. Note this is after the order fills and NOT after the order is submitted. Are you waiting until the order fills? Secondly, in general don’t look at cash. That can be misleading if ever shorting stocks. The correct value to look at is
buying_power. That is the amount an account has to place new orders. It takes into consideration any open orders (
cash does not).
Thanks for the response. It turns out the real culprit was that the security I was trying to buy was being evaluated out to too many decimal places. I had to be sure to round it down to two places before Alpaca would accept the order.