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.

For more information about the FOREX Data dataset, including CLI commands and pricing, see the dataset listing.

About the Provider

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.

Getting Started

The following snippet demonstrates how to request data from the FOREX dataset:

from QuantConnect.DataSource import *

self.symbol = self.AddForex("EURUSD", Resolution.Daily, Market.Oanda).Symbol
using QuantConnect.DataSource;

_symbol = AddForex("EURUSD", Resolution.Daily, Market.Oanda).Symbol;

Data Summary

The following table describes the dataset properties:

Start DateJanuary 2007
Asset Coverage71 Currency pairs
Data DensityDense
ResolutionTick, Second, Minute, Hour, & Daily

Data Point Attributes

The FOREX dataset provides QuoteBar and Tick objects.

QuoteBar Attributes

QuoteBar objects have the following attributes:

Tick Attributes

Tick objects have the following attributes:

Supported Assets

The following table shows the available Forex pairs:

Requesting Data

To add FOREX data to your algorithm, call the AddForex method. Save a reference to the Forex Symbol so you can access the data later in your algorithm.

class ForexAlgorithm (QCAlgorithm):
    def Initialize(self) -> None:
        self.SetStartDate(2019, 2, 20)
        self.SetEndDate(2019, 2, 21)

        self.symbol = self.AddForex('EURUSD', Resolution.Minute, Market.Oanda).Symbol

namespace QuantConnect.Algorithm.CSharp
    public class ForexAlgorithm : QCAlgorithm
        private Symbol _symbol;

        public override void Initialize()
            SetStartDate(2019, 2, 20);
            SetEndDate(2019, 2, 21);

            _symbol = AddForex("EURUSD", Resolution.Minute, Market.Oanda).Symbol;


For more information about creating Forex subscriptions, see Requesting Data.

Accessing Data

To get the current Forex data, index the QuoteBars or Ticks properties of the current Slice with the Forex Symbol. Slice objects deliver unique events to your algorithm as they happen, but the Slice may not contain data for your security at every time step. To avoid issues, check if the Slice contains the data you want before you index it.

def OnData(self, slice: Slice) -> None:
    if self.symbol in slice.QuoteBars:
        quote_bar = slice.QuoteBars[self.symbol]
        self.Log(f"{self.symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    if self.symbol in slice.Ticks:
        ticks = slice.Ticks[self.symbol]
        for tick in ticks:
            self.Log(f"{self.symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
    if (slice.QuoteBars.ContainsKey(_symbol))
        var quoteBar = slice.QuoteBars[_symbol];
        Log($"{_symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");

    if (slice.Ticks.ContainsKey(_symbol))
        var ticks = slice.Ticks[_symbol];
        foreach (var tick in ticks)
            Log($"{_symbol} price at {slice.Time}: {tick.Price}");

You can also iterate through all of the data objects in the current Slice.

def OnData(self, slice: Slice) -> None:
    for symbol, quote_bar in slice.QuoteBars.items():
        self.Log(f"{symbol} bid at {slice.Time}: {quote_bar.Bid.Close}")

    for symbol, ticks in slice.Ticks.items():
        for tick in ticks:
            self.Log(f"{symbol} price at {slice.Time}: {tick.Price}")
public override void OnData(Slice slice)
    foreach (var kvp in slice.QuoteBars)
        var symbol = kvp.Key;
        var quoteBar = kvp.Value;
        Log($"{symbol} bid at {slice.Time}: {quoteBar.Bid.Close}");

    foreach (var kvp in slice.Ticks)
        var symbol = kvp.Key;
        var ticks = kvp.Value;
        foreach (var tick in ticks)
            Log($"{symbol} price at {slice.Time}: {tick.Price}");

For more information about accessing Forex data, see Handling Data.

Historical Data

To get historical Forex data, call the History method with the Forex Symbol. If there is no data in the period you request, the history result is empty.

# DataFrame
history_df = self.History(self.symbol, 100, Resolution.Minute)

# QuoteBar objects
history_quote_bars = self.History[QuoteBar](self.symbol, 100, Resolution.Minute)

# Tick objects
history_ticks = self.History[Tick](self.symbol, timedelta(seconds=10), Resolution.Tick)
// QuoteBar objects 
var historyQuoteBars = History<QuoteBar>(_symbol, 100, Resolution.Minute);

// Tick objects 
var historyTicks = History<Tick>(_symbol, TimeSpan.FromSeconds(10), Resolution.Tick);

For more information about historical data, see History Requests.

Remove Subscriptions

To remove a Forex pair subscription, call the RemoveSecurity method.


The RemoveSecurity method cancels your open orders for the security and liquidates your holdings.

Example Applications

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

  • Exploring the impact that daily worldwide news cycles has on international currencies
  • Carry Trade: borrow from a lower interest currency pair to fund the purchase of a currency pair with a higher interest rate

You can also see our Videos. You can also get in touch with us via Discord.

Did you find this page helpful?

Contribute to the documentation: