About FOREX Data

The FOREX Data by OANDA serves 71 foreign exchange (FOREX) pairs, starts on various dates from January 2007, and is delivered on any frequency from tick to daily. This dataset is created by QuantConnect processing raw tick data from OANDA.


About OANDA

OANDA was co-founded by Dr. Stumm, a computer scientist and Dr. Olsen, an economist, in 1997. The company was born out of the belief that the Internet and technology would open up the markets for both currency data and trading. OANDA uses innovative computer and financial technology to provide Internet-based forex trading and currency information services to everyone, from individuals to large corporations, from portfolio managers to financial institutions. OANDA is a market maker and a trusted source for currency data. It has access to one of the world's largest historical, high-frequency, filtered currency databases.


About QuantConnect

QuantConnect was founded in 2012 to serve quants everywhere with the best possible algorithmic trading technology. Seeking to disrupt a notoriously closed-source industry, QuantConnect takes a radically open-source approach to algorithmic trading. Through the QuantConnect web platform, more than 50,000 quants are served every month.


Algorithm Example

from AlgorithmImports import *
from QuantConnect.DataSource import *

class ForexCarryTradeAlgorithm(QCAlgorithm):

    def initialize(self) -> None:

        self.set_start_date(2008, 1, 1) 
        self.set_cash(25000)
        
        # We will use hard-coded interest rates for each base currency
        self.rates = {
            "USDAUD": 1.5,    # Australia
            "USDCAD": 0.5,    # Canada
            "USDCNY": 4.35,   # China
            "USDEUR": 0.0,    # Euro Area
            "USDINR": 6.5,    # India
            "USDJPY": -0.1,   # Japan
            "USDMXN": 4.25,   # Mexico
            "USDTRY": 7.5,    # Turkey
            "USDZAR": 7.0     # South Africa
        }

        # Subscribe to forex data for trading
        for ticker in self.rates:
            self.add_forex(ticker, Resolution.DAILY, Market.OANDA)

        # Use a month counter as variable to control rebalancing
        self.month = -1

    def on_data(self, slice: Slice) -> None:
        # Monthly rebalance checker
        if self.month == self.time.month:
            return
        self.month = self.time.month
        
        # Long the pair with highest interest rate and sell the pair with the lowest to earn the max monetary inflation difference between the two
        sorted_rates = sorted(self.rates.items(), key = lambda x: x[1])
        self.set_holdings(sorted_rates[0][0], -0.5)
        self.set_holdings(sorted_rates[-1][0], 0.5)

Example Applications

The FOREX price data enables you to trade currency pairs in the global mark. Examples include the following strategies: