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
Error encountered while running on Live Mode #10
Comments
That particular error is coming from your watchlist specification - This format is in place to ensure that backtesting is completed using the same data feed as will be used for live trading, since data may vary from different providers. |
Ah yes, I somehow assumed that the backtest feed was pointing to Oanda because I had set my Oanda account details in the
Any idea what the cause might be? Thanks! |
Could you please share your runfile? Specifically, have you set the |
Sure, here is my runfile
|
My suspicion is that the API token is being rejected for some reason, and the data is not being returned as expected. import v20
from autotrader.lib import environment_manager, read_yaml
global_config = read_yaml.read_yaml('./config' + '/GLOBAL.yaml')
broker_config = environment_manager.get_config('demo', global_config, 'Oanda')
API = broker_config["API"]
ACCESS_TOKEN = broker_config["ACCESS_TOKEN"]
port = broker_config["PORT"]
api = v20.Context(hostname=API, token=ACCESS_TOKEN, port=port)
response = api.instrument.candles('EUR_USD', granularity = 'M5', count = 500)
print(response) |
Sure. I'm hitting the live API instead of the demo API but works. Got a
|
In that case, could you replace |
Yup that's what I did, and I pasted the response just before your reply. |
That's very strange, not sure exactly what is going on. Could you try replacing the last two lines with the following, and comment the response: response = api.instrument.candles('EUR_USD', granularity = 'M5', count = 10)
print(response.body) |
Very strange indeed. Res body looks good too.
|
That does look as expected... I'm grasping for ideas here, so could you please try the following to see if there are any errors returned. print(response.body["candles"])
print(response.body["candles"][0]) |
Looks good.
I had no issues backtesting with Yahoo Finance feeds though. |
Yep, that's very strange. The initial error you posted is suggesting that the response object from the API does not contain any candles, but it looks like everything is working from the above. I very occasionally see the same error, but hitting run again usually has no problems. Is the error happening every time you run? Also, have you tried running a backtest with the Oanda feed, but with other start/end dates? |
Yup it doesn't make much sense. Yes, it is happening each time I run for Oanda feed. Yes, I also just tried running it different start/end dates.
Getting the same error too. The only other reason is the keys in |
Since the test script above returned a The last thing I can think of to help debug this error is to add a print statement on line 221 of autodata.py, located at print(response.body.keys()) Run AutoTrader again, then see what the output is. |
Ok I added this print statement and another one Getting a more informative error message now -
Strange I'm hitting authorization error here? |
Okay, sorry I missed this before, but set the at.configure(show_plot=True, verbosity=1, feed="Oanda", environment='real') Let me know if that works! |
Yes, that is it! Backtest works now :) Thank you! Btw, since I have you now, what is the |
Btw, I'm keen to help work on this project with you, if you're planning to extend the features |
Great! Very happy to hear. Good question, it is in pips. I've just updated the docs to reflect that. That would be great, contributions are very much welcomed! I am very busy with other commitments at the moment though, so wasn't planning any major additions. That said, there are always things which can be added/improved. Feel free to send me an email (kemackle98@gmail.com) if you would like to continue this discussion. Otherwise, open a pull request with any additions you make and would like to share. Thanks! |
Describe the bug
Could not run on Live Mode on Oanda.
To Reproduce
Here is a copy of my strategy yaml file
Expected behavior
To be able to run as expected on Live Mode.
Version of AutoTrader being used
Latest.
Any idea what the issue could be?
The text was updated successfully, but these errors were encountered: