Closed elyobo closed 9 years ago
@toloco It might be an idea to change the main README.md as well, as the instructions given don't work for the sandbox environment. The account ID that you get from Oanda doesn't seem to exist in the sandbox environment, so it's necessary to create an account using the API and then use that account ID.
I can update the PR to include README.md changes as well to mention the process for the sandbox if you like.
Updated the readme.
Good one!
But rather to add another parameter for the environ I prefer to check if account_id and access_token are None to not check the credentials. Looks a bit cleaner to me.
What do you think?
Makes sense. I've stripped out the extra parameter, changed the account check in init to only run if an account ID is provided (as this does work in the sandbox as well, once you've created a valid account) and changed the session stabiliser to only add the header if an access token was provided.
Tests likewise corrected and the commits squashed down to one for merging.
The Oanda sandbox environment doesn't support users' normal account ID, so in order to work in the sandbox we need to support the account creation API.
This change adds create_account (only useful in the sandbox) and get_accounts (useful in all environments).
This can be used to work in the sandbox as follows.