About FOREX Data

The FOREX Data by QuantConnect 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 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.


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)

        # 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: