Quantitative Trading: Download Historical K-Line Data for Forex, Gold, Futures, and Precious Metals - iTick

Recently, I've been working on a quantitative trading strategy for gold futures data. It's almost finished, but I lack good data for testing and validation. After searching around, I found several platforms that provide historical K-line data for gold futures, such as Wind, iTick, Tonglian Data, JoinQuant, OANDA, and ForexFeed. They all have detailed integration methods. However, iTick suits me best. It's free, provides stable real-time quotes, and has detailed integration examples that are easy to use. Below is a comparison of these data providers...

Comparison of Financial Data Providers

  1. Wind: Wind is a well-known financial data service provider offering global financial data, research, and analysis tools. Its data covers multiple fields, including stocks, bonds, futures, indices, and macroeconomics, widely used by financial institutions, investors, and analysts.

Official website: https://www.wind.com.cn/

  1. Tonglian Data: Tonglian Data is a leading financial data service provider in China, offering a full range of financial data services, including real-time quotes, historical data, and data cleaning. Its data covers multiple financial fields, including stocks, futures, and funds.

Official website: https://www.allinfinance.com

  1. JoinQuant: JoinQuant is a data service platform focused on quantitative trading, providing rich financial data, strategy research, and backtesting tools to help users develop and optimize quantitative trading strategies.

Official website: https://www.joinquant.com/

  1. iTick: iTick is a data agency providing reliable data source APIs for fintech companies and developers, covering Forex API, stock API, cryptocurrency API, index API, etc., helping to build innovative trading and analysis tools. Currently, there is a free package available that can meet the needs of individual quantitative developers.

Official website: https://itick.org

API address: https://github.com/itick-org

  1. OANDA: OANDA is one of the largest brokers in the Forex market, and its Forex quote API is one of the most popular in the market. It provides global Forex quote data, including currency pair quotes, trading volume, bid and ask prices, etc. Additionally, OANDA's API can retrieve historical data and offers SDKs and sample code in multiple languages for easy use by developers.

Official website: https://www.oanda.net/

  1. ForexFeed: ForexFeed is a company specializing in providing Forex quote data. Its Forex quote API has extremely high data accuracy and real-time performance. The API can retrieve real-time quotes from over 80 global Forex markets, including Forex, indices, futures, and other asset types. ForexFeed supports multiple protocols and data formats to flexibly meet different user needs.

Official website: https://forexfeed.co/

Request K-Line Data

python -m pip install requests

"""
**iTick**: iTick is a data agency providing reliable data source APIs for fintech companies and developers, covering Forex API, stock API, cryptocurrency API, index API, etc., helping to build innovative trading and analysis tools. Currently, there is a free package available that can meet the needs of individual quantitative developers.
Open-source stock data API address:
https://github.com/itick-org
Apply for a free API key at:
https://itick.org
"""

import requests

url = "https://api.itick.org/forex/kline?region=gb&code=EURUSD&kType=1"

headers = {
     "accept": "application/json",
     "token": "bb42e24746784dc0af821abdd1188861d945a07051c8414a8337697a752de1eb"
}

response = requests.get(url, headers=headers)

print(response.text)