I still find thi s broker really tough to understand as explained below. As a result, my views of Oanda API has not changed. I am trying to help out those Americans who want to do algo trading. It seems Oanda is the last broker of it’s kind to support Python API for forex and CFD for US residents. Also, they are still a market maker so watch out in terms of trusting them. Based on my experience below, nothing huge has improved in terms of getting things working via their API. As you will read, the second link was helpful to make it work. The question is how long will these examples will still work until Oanda decide to change their API functionality yet again.
I think I finally got Oanda v20 running with Python. This broker is a complete nightmare with the various document (or lack of) to install/implement via GitHub. I tried many different ways but you may want to visit these links below:
You will need to ensure that you create your broker account and API tokens. These will be needed for the examples below. The link above provides a convenient Python script to create your V20.conf file. You may want to follow that process. There are also mentions of needing different virtual environments. I found this is not needed with the example code below.
The examples found in this link seems to work as long as your provide a valid V20 API token and account Id. One confusing part is use the AccountID which is the active_account found in the .conf file. I never used the username in any of the example above. As I am using Mac OS where the .v20.conf is created and stored in /Users/currentuser
The next though part is to filter through the response data.
As for the backtrader Python package, I did not find a Quickstart Tutorial for how to implement Oanda. Either that or it was too involved. I found another forum posting so I just decided to go native Oanda instead of using another Python package for access.
FACEBOOK ACCOUNT and TWITTER. Don't worry as I don't post stupid cat videos or what I eat!