This is script scrapes candle data for FX pairs from Oanda servers.
DISCLAIMER! Forex trading carries a heavy amount of risk. Any and everything outlined in this code is for educational purposes only. I am not responsible for any of your losses or any hardships you may face as a result of using this code. Again, this is meant to be used ONLY for educational purposes.
You will need to install oandapyV20. If you do not know how to setup a python environment, I reccomend using Anaconda or learning how to use virtualenv. There are numerous tutorials online for this.
Heads up, Oanda only allows a maximum of 4000 candles returned. If you require more, you will need to alter this script or run it multiple times with changes to the dates.
- Create a demo account with Oanda and obtain an api key.
- Place your api key in the script under "access_token".
- Adjust the script best on the type of data you would like. Ex.(Granularity, pair, timezone). Checkout Oanda's API endpoints for the type of data you want to grab. This should be pretty self-explanatory from the script. http://developer.oanda.com/rest-live-v20/introduction/
- Point your terminal to the project directory and run getCandleData.py in terminal with:
user$: python getCandleData.py
Data will be stored in a folder titled "dataStore" in whatever directory you placed the script.