Hi there, I am a newbie so please be gentle
I am following one of the strategies that Alpaca sent me an email about (A Simple Mean Reversion Stock Trading Script in C#) just using Paper/Test account and I am noticing that my Portfolio Balance is changing even after cancelling an order. Is there some fee or balance lag that I am not aware of?
Here is what my script does (basically. It runs once every minute during market periods.
- Gets current portfolio balance (amongst other things) and logs its value
- Checks for the presence of a previous order (ID stored locally) and if one exists and is not filled, tries to cancel it
- Gets Last 20 bars for a symbol
- Performs mean rev logic as per article mentioned above which may result in a buy or sell order
- If order, submit order and store Order ID locally
- Finish
What I am noticing, is that in Step 1 the Portfolio Balance is changing compared to the previous 1 minute (up, down and by different amounts) even if the order in Step 2 is not filled. I even check later on and that order ID is definitely in ‘canceled’ status. Can anyone explain what may be happening?
I can provide actual data if needed.
Thanks so much in advance all
Travis