惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Fortinet All Blogs
MyScale Blog
MyScale Blog
Microsoft Security Blog
Microsoft Security Blog
量子位
B
Blog
aimingoo的专栏
aimingoo的专栏
Apple Machine Learning Research
Apple Machine Learning Research
阮一峰的网络日志
阮一峰的网络日志
The GitHub Blog
The GitHub Blog
T
The Exploit Database - CXSecurity.com
N
News | PayPal Newsroom
Cloudbric
Cloudbric
A
About on SuperTechFans
AI
AI
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Recent Commits to openclaw:main
Recent Commits to openclaw:main
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
C
Cyber Attacks, Cyber Crime and Cyber Security
L
LINUX DO - 最新话题
T
The Blog of Author Tim Ferriss
Simon Willison's Weblog
Simon Willison's Weblog
有赞技术团队
有赞技术团队
H
Heimdal Security Blog
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
D
Docker
Security Archives - TechRepublic
Security Archives - TechRepublic
N
News and Events Feed by Topic
IT之家
IT之家
Know Your Adversary
Know Your Adversary
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
C
Cisco Blogs
博客园 - 叶小钗
美团技术团队
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
L
LangChain Blog
The Hacker News
The Hacker News
Y
Y Combinator Blog
I
Intezer
The Register - Security
The Register - Security
F
Full Disclosure
V
V2EX
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Last Week in AI
Last Week in AI
Martin Fowler
Martin Fowler

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Real-Time Forex Data API by Infoway
Infoway API · 2026-06-18 · via DEV Community

Infoway API aggregates Forex price data from major market makers and delivers it through a unified REST and WebSocket interface. For forex, this means genuine real-time rates with latency consistently under 100ms and an SLA of 99.6% uptime.

The forex feed covers 42 currency pairs across all major and several exotic pairs:

Symbol Pair
EURUSD Euro / US Dollar
GBPUSD British Pound / US Dollar
USDJPY US Dollar / Japanese Yen
USDCHF US Dollar / Swiss Franc
AUDUSD Australian Dollar / US Dollar
NZDUSD New Zealand Dollar / US Dollar
USDCAD US Dollar / Canadian Dollar
USDCNY US Dollar / Chinese Yuan
USDCNH US Dollar / Offshore Chinese Yuan
USDHKD US Dollar / Hong Kong Dollar
USDSGD US Dollar / Singapore Dollar
USDTHB US Dollar / Thai Baht
USDTWD US Dollar / Taiwan Dollar
USDRUB US Dollar / Russian Ruble
EURJPY Euro / Japanese Yen
EURGBP Euro / British Pound
EURCHF Euro / Swiss Franc
EURAUD Euro / Australian Dollar
EURCAD Euro / Canadian Dollar
EURNZD Euro / New Zealand Dollar
GBPJPY British Pound / Japanese Yen
GBPCHF British Pound / Swiss Franc
GBPAUD British Pound / Australian Dollar
GBPCAD British Pound / Canadian Dollar
GBPNZD British Pound / New Zealand Dollar
AUDJPY Australian Dollar / Japanese Yen
AUDCHF Australian Dollar / Swiss Franc
AUDCAD Australian Dollar / Canadian Dollar
AUDNZD Australian Dollar / New Zealand Dollar
AUDDKK Australian Dollar / Danish Krone
CADJPY Canadian Dollar / Japanese Yen
CADCHF Canadian Dollar / Swiss Franc
CADUSD Canadian Dollar / US Dollar
CHFJPY Swiss Franc / Japanese Yen
CHFUSD Swiss Franc / US Dollar
NZDJPY New Zealand Dollar / Japanese Yen
NZDCAD New Zealand Dollar / Canadian Dollar
SGDUSD Singapore Dollar / US Dollar
CNYUSD Chinese Yuan / US Dollar
JPYUSD Japanese Yen / US Dollar
USDEUR US Dollar / Euro
USDGBP US Dollar / British Pound

Beyond forex, the same API key gives you access to equities (US, HK, China A-shares, Japan, India), crypto, commodities, precious metals, and CFDs — all through the same interface. If your application eventually grows to cover more than just currencies, you won't need to stitch together multiple providers.

Getting Started

Sign up at the Infoway website to get your API key. New accounts automatically receive a 7-day trial — no credit card required. Your key shows up in the dashboard immediately, and you can start making requests within minutes.

Every request needs the API key passed as a request header:

apiKey: YOUR_API_KEY_HERE

REST API Examples

The forex endpoints use the /common/ path prefix. Here's how to pull data for the most common use cases.

Latest Trade Price

The trade endpoint returns the most recent transaction for one or more currency pairs.

import requests

url = "https://data.infoway.io/common/batch_trade/EURUSD,GBPUSD,USDJPY"

headers = {
    "User-Agent": "Mozilla/5.0",
    "Accept": "application/json",
    "apiKey": "YOUR_API_KEY_HERE"
}

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

Response:

{
  "ret": 200,
  "msg": "success",
  "traceId": "a1b2c3d4-1234-5678-abcd-ef0123456789",
  "data": [
    {
      "s": "EURUSD",
      "t": 1781672609412,
      "p": "1.08423",
      "v": "1.0",
      "vw": "1.08423",
      "td": 1
    },
    {
      "s": "GBPUSD",
      "t": 1781672609318,
      "p": "1.27185",
      "v": "1.0",
      "vw": "1.27185",
      "td": 2
    },
    {
      "s": "USDJPY",
      "t": 1781672609501,
      "p": "149.832",
      "v": "1.0",
      "vw": "149.832",
      "td": 0
    }
  ]
}

Field Description
s Symbol
t Timestamp (milliseconds)
p Trade price
v Volume
vw Trade value
td Direction: 0 = default, 1 = buy, 2 = sell

You can query up to 100 symbols in a single request by comma-separating them in the URL path.

Candlestick / OHLCV Data

The candle endpoint supports 12 timeframes from 1-minute to yearly. It uses a POST request with a JSON body.

import requests
import json

url = "https://data.infoway.io/common/v2/batch_kline"

headers = {
    "User-Agent": "Mozilla/5.0",
    "Accept": "application/json",
    "Content-Type": "application/json",
    "apiKey": "YOUR_API_KEY_HERE"
}

payload = {
    "klineType": 1,      # 1 = 1-min, 2 = 5-min, 5 = 1-hour, 8 = daily
    "klineNum": 20,      # Number of candles to return (max 500 per symbol)
    "codes": "EURUSD,GBPUSD"
}

response = requests.post(url, headers=headers, data=json.dumps(payload))
print(response.json())

Response:

{
  "ret": 200,
  "msg": "success",
  "traceId": "b2c3d4e5-2345-6789-bcde-f01234567890",
  "data": [
    {
      "s": "EURUSD",
      "respList": [
        {
          "t": "1781671920",
          "o": "1.08401",
          "h": "1.08435",
          "l": "1.08398",
          "c": "1.08423",
          "v": "142.0",
          "vw": "154.08",
          "pc": "0.02%",
          "pca": "0.00022"
        }
      ]
    }
  ]
}

Field Description
t Candle open time (Unix seconds)
o Open
h High
l Low
c Close
v Volume
vw Trade value
pc Change %
pca Change (absolute)

To pull historical candles, add a timestamp field to the request body. The API will return candles going back from that Unix timestamp:

payload = {
    "klineType": 8,           # Daily candles
    "klineNum": 500,
    "codes": "EURUSD",
    "timestamp": 1770000000   # Pull up to 500 daily candles ending at this time
}

Minute-level history goes back 3 years. Daily and above have no lookback restriction.

Order Book (Bid/Ask)

The depth endpoint returns the current best bid and ask for one or more pairs.

import requests

url = "https://data.infoway.io/common/batch_depth/EURUSD,USDJPY"

headers = {
    "User-Agent": "Mozilla/5.0",
    "Accept": "application/json",
    "apiKey": "YOUR_API_KEY_HERE"
}

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

Response:

{
  "ret": 200,
  "msg": "success",
  "traceId": "c3d4e5f6-3456-7890-cdef-012345678901",
  "data": [
    {
      "s": "EURUSD",
      "t": 1781672693007,
      "a": [
        ["1.08431"],
        ["0.0"]
      ],
      "b": [
        ["1.08415"],
        ["0.0"]
      ]
    }
  ]
}

a is the ask (sell side), b is the bid (buy side). Each contains a price array and a volume array, matched by index position.

WebSocket for Real-Time Streaming

REST polling works well for dashboards that refresh every few seconds, but if you're building something that needs to react to price moves in real time — an alert system, an automated strategy, a trading terminal — you want a persistent WebSocket connection instead.

The WebSocket endpoint for forex (and all common-type products like commodities and precious metals) is:

wss://data.infoway.io/ws?business=common&apikey=YOUR_API_KEY_HERE

Once connected, the server pushes updates to you as they happen. No polling, no repeated round trips.

Here's a production-ready Python client that subscribes to live trades, order book updates, and 1-minute candles for a set of forex pairs, with automatic reconnection on disconnect:

import asyncio
import json
import uuid
import logging
from typing import Optional
import websockets
from websockets.exceptions import ConnectionClosed

logging.basicConfig(
    level=logging.INFO,
    format="%(asctime)s %(levelname)s %(message)s"
)
logger = logging.getLogger("forex-ws")

PAIRS = "EURUSD,GBPUSD,USDJPY,AUDUSD,USDCAD"

class ForexWebSocketClient:
    """Real-time forex streaming client with auto-reconnect."""

    def __init__(self, api_key: str):
        self.url = f"wss://data.infoway.io/ws?business=common&apikey={api_key}"
        self.ws: Optional[websockets.WebSocketClientProtocol] = None
        self.running = True
        self.reconnect_base = 5
        self.reconnect_max = 60
        self.heartbeat_interval = 30
        self._heartbeat_task: Optional[asyncio.Task] = None

    def _trace(self) -> str:
        return str(uuid.uuid4())

    async def _send(self, msg: dict) -> None:
        if self.ws:
            await self.ws.send(json.dumps(msg))

    async def _subscribe(self) -> None:
        # Subscribe to live trades
        await self._send({
            "code": 10000,
            "trace": self._trace(),
            "data": {"codes": PAIRS}
        })
        await asyncio.sleep(5)

        # Subscribe to order book
        await self._send({
            "code": 10003,
            "trace": self._trace(),
            "data": {"codes": PAIRS}
        })
        await asyncio.sleep(5)

        # Subscribe to 1-minute candles
        await self._send({
            "code": 10006,
            "trace": self._trace(),
            "data": {
                "arr": [{"type": 1, "codes": PAIRS}]
            }
        })
        logger.info("Subscribed to %s", PAIRS)

    def _start_heartbeat(self) -> None:
        if self._heartbeat_task and not self._heartbeat_task.done():
            self._heartbeat_task.cancel()

        async def beat():
            while True:
                await asyncio.sleep(self.heartbeat_interval)
                if not self.ws or self.ws.close_code is not None:
                    break
                try:
                    await self._send({"code": 10010, "trace": self._trace()})
                    logger.debug("Heartbeat sent")
                except Exception:
                    break

        self._heartbeat_task = asyncio.create_task(beat())

    def _handle(self, raw: str) -> None:
        try:
            msg = json.loads(raw)
        except json.JSONDecodeError:
            logger.error("Bad message: %s", raw)
            return

        code = msg.get("code")
        data = msg.get("data", {})

        if code == 10002:       # Trade push
            logger.info("Trade  %s @ %s", data.get("s"), data.get("p"))
        elif code == 10005:     # Depth push
            logger.info("Depth  %s bid=%s ask=%s",
                        data.get("s"),
                        data.get("b", [[None]])[0][0],
                        data.get("a", [[None]])[0][0])
        elif code == 10008:     # Candle push
            logger.info("Candle %s o=%s h=%s l=%s c=%s",
                        data.get("s"), data.get("o"),
                        data.get("h"), data.get("l"), data.get("c"))
        elif code == 10010:
            logger.debug("Heartbeat ack")
        elif code in (10001, 10004, 10007):
            logger.info("Subscription confirmed (code=%s)", code)
        else:
            logger.debug("Message: %s", raw)

    async def _connect_once(self) -> None:
        async with websockets.connect(self.url) as ws:
            self.ws = ws
            logger.info("Connected to %s", self.url)
            await self._subscribe()
            self._start_heartbeat()
            try:
                async for message in ws:
                    self._handle(message)
            finally:
                if self._heartbeat_task:
                    self._heartbeat_task.cancel()
                self.ws = None

    async def start(self) -> None:
        backoff = self.reconnect_base
        while self.running:
            try:
                await self._connect_once()
                backoff = self.reconnect_base
            except ConnectionClosed as e:
                logger.warning("Connection closed: %s", e)
                backoff = self.reconnect_base
            except Exception as e:
                logger.error("Connection error: %s", e)

            if not self.running:
                break
            logger.info("Reconnecting in %ss...", backoff)
            await asyncio.sleep(backoff)
            backoff = min(backoff * 2, self.reconnect_max)

    def stop(self) -> None:
        self.running = False


async def main():
    client = ForexWebSocketClient(api_key="YOUR_API_KEY_HERE")
    await client.start()


if __name__ == "__main__":
    try:
        asyncio.run(main())
    except KeyboardInterrupt:
        logger.info("Stopped")

WebSocket Protocol Reference

Code Direction Description
10000 Client → Server Subscribe to trades
10001 Server → Client Trade subscription confirmed
10002 Server → Client Trade data push
10003 Client → Server Subscribe to order book
10004 Server → Client Order book subscription confirmed
10005 Server → Client Order book push
10006 Client → Server Subscribe to candles
10007 Server → Client Candle subscription confirmed
10008 Server → Client Candle push
10010 Both Heartbeat

One connection supports subscribing to up to 600 symbols simultaneously. The server will drop the connection if no heartbeat is received within 60 seconds, so make sure your client sends one every 30 seconds.

Frequently Asked Questions

When is the forex market open?

The forex market trades 24 hours a day, five days a week. It opens Sunday evening (New York time) with the Sydney session, and the major liquidity windows are the London session (roughly 3am–12pm ET) and the New York session (8am–5pm ET). The overlap between London and New York (8am–12pm ET) is typically when spreads are tightest and volume is highest.

How do I query multiple currency pairs at once?

Comma-separate the symbols in the REST endpoint path or in the codes field of your WebSocket subscription message. REST supports up to 100 symbols per request. WebSocket supports up to 600 per connection.

What is the latency on the price feed?

Under normal market conditions, the measured latency between a market event and data availability via WebSocket is under 100ms. REST requests add a round-trip on top of that, so WebSocket is the right choice for latency-sensitive applications.

Does Infoway API provide historical forex data?

Yes. You can pull minute-level historical data going back 3 years by passing a timestamp parameter in the candle request body. Daily and weekly candles have no lookback limit.

What's the difference between USDCNY and USDCNH?

CNY is the onshore Chinese yuan (traded on the mainland, subject to PBOC controls). CNH is the offshore yuan traded in Hong Kong and other international markets — it moves more freely based on global supply and demand. The two rates often diverge slightly, and that spread itself can be a useful signal.

Is there a free trial?

Yes — register on the Infoway website and you'll get a 7-day trial automatically. No credit card, no identity verification required. The trial lets you query all markets and data types, with a rate limit of 60 REST requests per minute and up to 10 WebSocket subscriptions. Feel free to reach out to our support team on Telegram if you have any questions during the trial.