Download Historical FX Data Using Oanda V20 API

A couple of weeks ago, a student of mine on Python Algo Trading: FX Trading with Oanda asked me how to download historical fx data from the Oanda V20 API. I developed the following simple Jupyter notebook to assist him his query.

The basic idea of this notebook is to extract 250 days of daily open, high, low, close price of EURUSD. The steps are

  1. Import the relevant libraries
  2. Instantiate with your access details
  3. Provide Oanda with the parameters
  4. Submit your request for data
  5. Once the FX data is returned, you can conduct more thorough analysis with it. This can be for technical indicators calculation, statistical analysis, or even apply machine learning to these raw data.

For code cell 2: You will need to provide your own account ID and access token.


If you like what you read, do remember to subscribe.

No Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

algorithmic trading
Seeking Alpha in Alternative Data

This is a webinar that I did with Quantopian on 14 Dec 2017.   The challenge for a quant is how to make sense and ultimately extract useful trading signals out of alternative data. In this webinar, Anthony Ng will use Quantopian’s alternative datasets and demonstrate one way to extract …

algorithmic trading
Multi-Assets Trading with Interactive Brokers

Background I have been using Interactive Brokers platform to teach my students how to trade for over 5 years. We covered topics ranging from commodities and futures trading, equity arbitrage trading, risk management, portfolio management, and more. The platform is features rich and provides a┬árealistic introduction to the world of …

algorithmic trading
Classification Based Machine Learning for Price Prediction

It is quite common to observe that a lot of the initial application of machine learning techniques are on directly the market price (Open, High, Low, Close, Volume). As understanding of machine learning increase, the sophistication level starts to increase. Quants are starting to look for alpha by adding factors …