Live looks good and will be in full trade mode soon. Another Oanda API note:
The “environment” for the API itself is defaulted to practice, which is fine (and preferable even) but they sure don’t make it obvious to new coders how one goes about switching the environment from demo to live. Once you switch the API token itself and the account token, it will happily give you an authorization error.
“errorMessage”:“Insufficient authorization to perform request.”
Their documentation for trouble shooting?
1.The URL provided to the curl command is correct. Click here to learn how to configure curl examples that can be copied without further modification.
2.The authentication token is valid and has been added as a Bearer token in the HTTP Authorization header.
It’s easy to get lost here as they don’t provide any good examples of how one actually configures curl, or uses the url in their API call. The answer of course, is quite simple.
Practice code: api = oandapyV20.API(access_token=practice_access_token)
Live code: api = oandapyV20.API(environment = ‘live’,access_token=live_access_token)
the acess token of course being the one they generate for you for your specific account (xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx)
That’s it! just an additional parameter in the API call from nothing (default) to environment = ‘live’. No need to curl yourself, no need to ping some url and attach the key yourself, just a switch to turn on.
Heading into the next full week of trading next week (excited) and continuing to work on debugging.