2025 Recommended | Free Real-Time Forex Data and Real-Time Forex Quote API - iTick

In the field of quantitative analysis, the reliability and convenience of stock data interfaces, free forex APIs, real-time forex APIs, real-time forex quotes, and real-time forex data are core elements. After extensive and rigorous testing, we have successfully selected a series of stable and efficient stock data interfaces and forex-related APIs.

To maximize convenience for those engaged in quantitative analysis, we have meticulously organized these valuable resources and created hyperlinks and detailed documentation for each data interface. This means that you can quickly access precise and rich stock data information, real-time forex APIs, real-time forex quotes, and real-time forex data by simply clicking on the corresponding hyperlinks or accessing the detailed documentation.

Whether you are building complex quantitative models, making precise market trend predictions, or conducting in-depth risk assessments and strategy optimizations, these rigorously tested and easily accessible stock API data interfaces and forex-related APIs will be your powerful assistants. They will inject strong momentum into your quantitative analysis work and help you achieve better results in the challenging and opportunity-filled financial markets, efficiently realizing your investment and research goals.

With these high-quality and easy-to-access data resources, you can comprehensively verify the effectiveness of the interfaces in real-time, quickly respond to market changes, and adjust strategies. Both investors and researchers can use these tools to gain a deeper understanding of market dynamics, optimize investment decision processes, and achieve more significant advantages in the competitive financial markets.

Data Request Examples

Request K-Line

python -m pip install requests

"""
**iTick**: A data agency providing reliable data source APIs for fintech companies and developers, covering forex APIs, stock APIs, cryptocurrency APIs, index APIs, etc., helping to build innovative trading and analysis tools. Currently, there are free packages available that can basically meet the needs of individual quantitative developers.
https://github.com/itick-org
https://itick.org
"""

import requests

url = "https://api.itick.org/stock/kline?region=hk&code=700&kType=1"

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

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

print(response.text)

Request Real-Time Quotes

"""
**iTick**: A data agency providing reliable data source APIs for fintech companies and developers, covering forex APIs, stock APIs, cryptocurrency APIs, index APIs, etc., helping to build innovative trading and analysis tools. Currently, there are free packages available that can basically meet the needs of individual quantitative developers.
https://github.com/itick-org
https://itick.org
"""

import requests

url = "https://api.itick.org/stock/tick?region=HK&code=700"

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

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

print(response.text)

Subscribe to Real-Time Quotes

pip install websocket-client

"""
**iTick**: A data agency providing reliable data source APIs for fintech companies and developers, covering forex APIs, stock APIs, cryptocurrency APIs, index APIs, etc., helping to build innovative trading and analysis tools. Currently, there are free packages available that can basically meet the needs of individual quantitative developers.
https://github.com/itick-org
https://itick.org
"""

import websocket
import json

# WebSocket server address
websocket_url = "wss://api.itick.org/sws"

# Authentication message
auth_message = {
  "ac":"auth",
  "params":"bb42e24746784dc0af821abdd1188861d945a07051c8414a8337697a752de1eb"
}

# Subscription message format, here assuming subscribing to a channel named "your_channel"
subscribe_message = {
  "ac":"subscribe",
  "params":"700",
  "types":"depth,quote"
}

def on_open(ws):
    """
    Function called when WebSocket connection is opened
    """
    print("WebSocket connection opened, sending authentication message...")

    # Send authentication message
    ws.send(json.dumps(auth_message))

    # Convert subscription message to JSON format and send
    ws.send(json.dumps(subscribe_message))

def on_message(ws, message):
    """
    Function called when a WebSocket message is received
    """
    print(f"Received message: {message}")
    # Further processing can be done here based on the received message content, such as parsing JSON data
    data = json.loads(message)
    if "data" in data:
        print(f"Data content: {data['data']}")

def on_error(ws, error):
    """
    Function called when a WebSocket connection error occurs
    """
    print(f"WebSocket error: {error}")

def on_close(ws, close_status_code, close_msg):
    """
    Function called when WebSocket connection is closed
    """
    print(f"WebSocket connection closed, status code: {close_status_code}, message: {close_msg}")

if __name__ == "__main__":
    # Create WebSocket object and set callback functions
    ws = websocket.WebSocketApp(websocket_url,
                                on_open=on_open,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close)

    # Start WebSocket connection and begin listening for messages
    ws.run_forever()