Their data are forex historical open high low close the form of ticks. For a free source it is good enough. I used to use Oanda’s historical data service but it seems that they moved it to a premium product. Let’s download data for a week and experiment a little bit.
These are data for one week for one currency pair. But don’t worry, we are going optimize this. For now, let’s open the file and inspect. As you can understade each line has a timestamp and the how much was the price to buy or sell. Formats downloaded by other services are pretty similar. There are many ways to load these data into Python but the most preferable when it comes to data slicing and manipulating is using Pandas.
Manipulating data using Pandas The data we downloaded are in ticks. This will make our download scale down from 25MB to just 35KB which translate to HUGE performance and memory benefits. Let’s group all these data in 15 minutes. Time to fall in love with resample.
Not only you have all the information you need but now it is extremely fast to load it. We can write a simple momentum algorithm that checks if there was a huge movement the last 15 minutes and if that was the case, let’s buy. We will dive into this in a later post. You can see the code as always on github. Coming up next, building a backtesting system from scratch!