I’m trying to run my strategy on Blueshift for my Alpaca paper trading account.
The strategy trades 2 times per month.
I’m getting “Token Expired” error after some several days of running and Blueshift stops the strategy.
Thanks for highlighting the issue. It appears Alpaca has some internal rule for expiry time for the tokens. I suggest you generate the token at start of the week (Monday). In our experience, this usually lasts the whole week (till Friday market close).
Also at present we have a max 1 week limitation on algo execution on blueshift. However, if your strategy is not dependent on its past state (e.g. signals are dependent on algo profit history etc.) then it is no big deal. Re-lauching every monday should work fine.
Please reach out to us at blueshift-support@quantinsti.com for further support or discussion on this issue. We will be happy to help.
Restarting the algo is a bit uncomfortable, but there is another(bigger) issue with this.
order_target_percent doesn't consider positions bought before the algo starts. As a result strategy rebalancing code that uses order_target_percent is always buying new positions instead of rebalancing existing positions.
I don't know if this is an expected behavior or a bug, but it's a show stopper for our strategy in its current form. Just wondering if I should avoid using order_target_percent in the algo or there are other possibilities to fix this?
I see the pain point. In your case, the strategy is indeed dependent on the past state as it is using a targetting order function. Do you mind dropping a mail to blueshift-support@quantinsti.com and we will take the discussion forward there. Thx vm.