-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I start paper trade from the recent time? #49
Comments
try the new version and let me know if you still get this error: https://github.com/alpacahq/alpaca-backtrader-api/releases/tag/v0.8.0 |
I am still getting the error where it starts from yesterday. It doesn't seem to start at the right live time unless I include I am also getting an error where it doesn't detect that I have a position, when I clearly do and can see it on the Alpaca dashboard. I have seen this work before in the past so not sure if it's just my latest code which uses multiple data feeds, understanding that it should default to data0.
I am also getting this error on the first order, but it doesn't seem to break anything.
Sometimes I don't get the
Sometimes I get duplicate status:
The orders don't seem to break though - they seem to go through and complete ok, regardless of the notifications. Is there a way to print out why it is rejected? (Usually it's just cause of buying power.)
Here is my full code. Update with your keys and you can run like:
I am having quite a bit of trouble getting just a simple "buy when green and sell when red" strat to execute properly. When using Oanda it seems to execute as expected and I have gotten the raw alpaca-trade-api to work well, but I could use some help here with the errors. Thanks!
|
Hey @shlomikushchi, so I'm facing the same issue where if I'm trying to get live data for paper trading on the 16th of June it gives me data starting from the 15th of June. Also if I reset the API key the data request URL shows that the API is being asked for data starting from the 13th of June. Now since 13th and 14th are weekends it starts giving data from the 15th. This is the URL that I mentioned above: [https://api.polygon.io/v2/aggs/ticker/NVDA/range/1/minute/2020-06-13/2020-06-16?unadjusted=False&apiKey=XXXXXXXXXXXXXX] This is the sample code that I'm using: `import backtrader as bt class SmaCross(bt.SignalStrategy): is_live = True cerebro = bt.Cerebro() store = alpaca_backtrader_api.AlpacaStore(key_id=ALPACA_API_KEY, if is_live: DataFactory = store.getdata # or use alpaca_backtrader_api.AlpacaData cerebro.run() |
Hi, data from the past is probably required for your indicators. def notify_data(self, data, status, *args, **kwargs):
super().notify_data(data, status, *args, **kwargs)
print('*' * 5, 'DATA NOTIF:', data._getstatusname(status), *args) and when |
closing due to lack of activity |
I was under the impression that if you start paper trading and set
historical=False
with no date it should start getting data from the most recent time. When I try with other broker such as backtrader with Oanda, it does not seem necessary to setfromdate
.and then logging out the time in
next()
:Today is currently 5/12 18:05, but the data will feeding from 5/11 13:56.
Any suggestions? Also in general, I can't seem to get any sort of Renko chart to operate correctly e.g. it always looks and acts differently from what I'd see on TradingView and fires multiple signals for the same bar if anyone has any experience with that. Any help is greatly appreciated.
The text was updated successfully, but these errors were encountered: