Forex Quotes
Forex Quotes
Documentation
API Introduction
This API supports querying real-time market data for foreign exchange markets by specifying a currency pair code (e.g., FXINDEX, CNYRUB). The results cover key indicators such as real-time price, bid/ask prices, today's open/high/low, yesterday's close, as well as change amount and change rate, with timestamps to ensure timeliness.
Use Cases
- Financial News Display: Provide real-time foreign exchange rates and USD index trends for financial websites or apps.
- Cross-border Business Settlement: Assist enterprises with multi-currency cost estimation and exchange rate risk monitoring.
- Quantitative Trading Analysis: Serve as a fundamental data source for building backtesting and real-time monitoring models for forex strategies.
Request and Response Description
- Request Method: POST
- Core Parameter:
symbol(Required), specifies the foreign exchange pair code to query, e.g.,FXINDEX(USD Index) orCNYRUB(CNY to RUB). - Response Structure:
code/msg: API status code and description, 200 indicates success.data: Contains a detailed market quote object for the corresponding currency pair.price: Real-time price.bid/ask: Bid and ask prices.high/low/open/preclose: Today's high, low, open, and previous close prices.
Integration Suggestions
- Symbol Code Validation: Ensure that the
symbolpassed is in the service provider's supported code table; otherwise, it may return empty data or an error. - Caching Strategy: The foreign exchange market fluctuates frequently but not at high-frequency ticks. It is recommended to set second-level caching based on business needs to avoid invalid duplicate requests.
- Error Handling: When parsing data, please check the
codefield and properly handle cases where specific currency pair fields indatamight be empty (e.g., CNYRUB in the example).
Integration Examples
Includes ready-to-use Shell, Python, Go, Java, and PHP examples for direct integration.
Request Example
{
"symbol": "品种代码,如:FXINDEX,CNYRUB。详见代码表"
}Response Example
{
"msg": "成功",
"code": 200,
"taskNo": "202960247220113090298671",
"data": {
"FXINDEX": {
"update_time": 1713766948,
"bofu": "0.16380",
"high": "106.1425",
"low": "105.9787",
"price": "106.0533",
"change": "-0.0630",
"name": "美元指数",
"ask": "106.0533",
"bid": "106.0533",
"preclose": "106.1163",
"changeRate": "-0.0594",
"open": "106.0992",
"zhenfu": ""
},
"CNYRUB": {}
}
}Request Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.symbol | object | {...} |
| properties.symbol.type | string | string |
| properties.symbol.description | string | 品种代码,如:FXINDEX,CNYRUB。详见代码表 |
| required | array | "symbol" |
| required[] | string | symbol |
Response Fields
The fields below are derived from example JSON for integration reference only.
| Path | Type | Sample |
|---|---|---|
| type | string | object |
| properties | object | {...} |
| properties.msg | object | {...} |
| properties.msg.type | string | string |
| properties.msg.example | string | 成功 |
| properties.msg.description | string | 口返回码对应的描述信息 |
| properties.code | object | {...} |