# 开始

提供了从创建账户、生成API Key到执行第一个请求的完整教程

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## **欢迎**

欢迎使用iTick，通过本指引你可以快速了解如何接入iTick 、Api，了解iTick详细的功能，为你了解实时股市行情、分析市场趋势、加密货币行情等金融相关数据提供专业的支持。

<div align="right" data-full-width="true"><figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2FUHBNSlVIl0MkDXOGllFE%2Fdesktop-ui-dark.webp?alt=media&amp;token=58a97e81-beda-4c96-b3a6-ae1caa20fd49" alt="iTick 外汇API、股票API、指数API"><figcaption></figcaption></figure></div>

## **介绍**

iTick基于rest api、websocket api 提供专业全方位的A股、港股、美股、外汇、加密货币实时数据信息，提供数据服务：

<table><thead><tr><th>服务</th><th>A股</th><th>港股</th><th>美股</th><th>新股</th><th>日股</th><th width="83">外汇</th><th>加密货币</th></tr></thead><tbody><tr><td>产品信息</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td></tr><tr><td>市场假期</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td></tr><tr><td>实时报价</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td></tr><tr><td>实时盘口</td><td>V</td><td>V</td><td>X</td><td>V</td><td>V</td><td>V</td><td>V</td></tr><tr><td>历史k线</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td><td>V</td></tr></tbody></table>

## **服务对象**

1. **开发者：**&#x671F;望构建股票交易工具的开发者。&#x20;
2. **教育机构：**&#x81F4;力于研究股市、比特币数据模型的相关教育机构。
3. **量化团队：**&#x81F4;力于开发量化交易策略和算法的量化团队。
4. **金融公司：**&#x63D0;供金融科技解决方案和服务的公司。
5. **专业机构：**&#x9700;要准确、及时的金融市场数据支持的专业机构。


# 说明

iTick 金融数据产品服务总览：数据覆盖范围、API 类型、更新频率、数据精度与服务等级协议(SLA)详细说明。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

iTick 提供全面的 API 套件，包括 FIX、REST 和 Websocket API，可满足机构级客户的需求。我们的 iTick API 解决方案具有高度可扩展性，可让客户访问实时市场数据和见解。客户可以轻松地将我们的 iTick API 与其现有系统和应用程序集成，从而简化工作流程。 [英文文档](https://itick.readme.io)、[繁体文档](https://itick-hk.readme.io)

## 特点

🙋‍♀️ 开发者友好：标准易用接口风格，简明的文档以及丰富的各类示例，帮助开发者快速接入。

🌈 产品分类丰富：支持主流市场股票（美国、香港、中国、新加坡、日本等）、全球外汇、指数以及加密货币的实时、历史数据。

👩‍💻 支持多场景接入：丰富的接口数据，可以满足到小型的量化团队、金融科技公司以及专业的分析机构对数据的要求。

🍿 专业的服务质量：提供专业的数据来源，多地区加速以及数据链路的热备份技术，确保数据的实时以及稳定可靠。

🧙 灵活定制化服务：对于机构用户以及专业用户，支持提供定制化的数据方案，满足机构与专业用户的需求。

## API接入

### REST API

我们的 REST API 提供了一种简单而安全的方式来获取各类产品的报价与K线数据。REST API 可以通过市场数据端点公开访问端点，这些端点需要对请求进行签名。

### Websocket API

使用异步方法（发布/订阅）高效地推送订单、交易、市场和其他相关信息的通知。通过订阅感兴趣的特定主题，用户可以接收实时更新，而无需不断轮询。

### FIX API

iTick FIX 连接是一种行业标准解决方案，可帮助我们的机构客户充分利用我们的高可用性系统。它专门设计用于处理大量吞吐量，支持端到端访问我们丰富的流动性信息。

> 📘 目前仅提供机构客户使用，请联系客服
>
> Telegram: [iticksupport](https://t.me/iticksupport)
>
> WhatsApp: [+852 59046663](https://wa.me/85259046663)

## 技术支援

### 一般询问

营业时间：周一至周五，上午 9:00 至下午 6:00（香港时间）

首选联系方式: <support@itick.org>

请按照以下格式提供您的询问：

主题：

环境：生产

身份：电子邮件

请求正文：

问题：

紧急生产交易问题\
营业时间：5\*8

对于非办公时间的紧急事项，请登录 itick.org 并通过即时消息与我们在线客户支持团队联系。


# 获取授权

获取 ITick API 授权认证：API Key 申请流程、认证方式、权限管理与使用限制说明，快速开始接入金融数据服务。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/getting-started)

## 1、账号准备

打开官网 [iTick Website](https://www.itick.org/)，点击右上角的立即获取

![](https://files.readme.io/b8196f75f1bd05467f85b6488f40ccf61486d3f5cd296b00a27fb9bad855cc5c-image.png)

使用 Google账号或者Github账号登录

![](https://files.readme.io/bbd5e258edd1dd54d0e8ce9ae5428367719604e597d74b8cb7eed2117c8a1128-image.png)

<br>

## 2、APIKey获取

登陆之后，访问[iTick控制台](https://www.itick.org/)，点击控制台进入控制台。查看APIKey。\
APIKey为每个账号唯一作为访问服务的凭证，请妥善保管，谨防丢失或共享他人，造成不必要的损失。如有以上情形请及时联系工作人员。

![](https://files.readme.io/82eded6226ab8371095b9d50b7d89d08d5f07aca03bedf8b85877599d4e1d1f0-image.png)

![](https://files.readme.io/5ca3a0bc9868b76b179c3d8431c6795958b0deae327d75474587f0838ec8ffe5-image.png)

<br>

## 3、服务简介

目前iTick支持rest服务、webs socket订阅以及FIX协议，三种种方式对外服务；\
rest api：股票（A股、美股、港股）、外汇、贵金属、加密货币、指数的最新报价、盘口以及各种周期的K线；\
webSocket api：股票（A股、美股、港股）、外汇、贵金属、加密货币、指数的实时报价推送；\
fix api：目前支只对机构用户开放；\
你可以根据实际情况选择不同的产品服务。


# 产品清单

iTick有API接口对应的股票、基金、期货、指数、加密货币等产品的标准代码与基础信息列表

## 标的清单

<https://docs.google.com/spreadsheets/d/16Zb0IKifo8_jM9YQutCmNWleuISFizymH-87NiKapy0>

### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.or</mark>](https://docs.itick.org/)<mark style="color:red;">g</mark>

### 更多标的

> 📘 支持全部美股、港股、A股、全球外汇、贵金属、指数以及加密货币等，具体其他地区的股票支持请联系客服咨询
>
> Telegram: [iticksupport](https://t.me/iticksupport)
>
> WhatsApp: [+852 59046663](https://wa.me/85259046663)


# 错误代码

iTick API 完整错误代码参考中心。当您遇到请求失败、认证失败、配额超限等问题时，可在此找到即时帮助

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

| 错误代码 | 错误信息                                     | 错误说明                         |
| ---- | ---------------------------------------- | ---------------------------- |
| E001 | not found this produce                   | 标的物产品不存在，需要检查code是否正确或联系客户增加 |
| E002 | auth failed                              | 授权失败                         |
| E003 | exceeding the maximum subscription limit | 超出最大订阅产品数量，需要联系客服或者升级套餐      |


# K线结构

iTick K 线数据结构详解：时间粒度、OHLCV 字段、复权类型、数据质量与实时 K 线推送机制，适用于量化分析与图表展示。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## K线数据结构

| 字段 | 字段含义  | 字段描述               |
| -- | ----- | ------------------ |
| o  | K线开盘价 |                    |
| c  | K线收盘价 |                    |
| h  | K线最高价 |                    |
| l  | K线最低价 |                    |
| v  | 成交数量  |                    |
| tu | 成交金额  |                    |
| s  | 标的    | 订阅kline时存在，查询接口不存在 |

## K线类型定义

| 字段 | 字段含义  | 字段描述 |
| -- | ----- | ---- |
| 1  | 1分钟k  |      |
| 2  | 5分钟k  |      |
| 3  | 15分钟k |      |
| 4  | 30分钟k |      |
| 5  | 1小时k  |      |
| 6  | 2小时k  |      |
| 7  | 4小时k  |      |
| 8  | 1天k   |      |
| 9  | 1周k   |      |
| 10 | 1月k   |      |

<br>

> 🐳 2小时k、4小时k只有数字币产品支持


# Base

## GET /symbol/list

> Product List

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Base"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/symbol/list":{"get":{"summary":"Product List","deprecated":false,"description":"","tags":["Base"],"parameters":[{"name":"type","in":"query","description":"Product Categories: stock, forex, indices, crypto","required":true,"schema":{"type":"string"}},{"name":"region","in":"query","description":"Regions: Stocks include (HK, SZ, SH, US, SG), Forex (gb), Indices (gb), Digital currencies (ba)","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","type":"object","properties":{"c":{"type":"string","description":"Product Code"},"t":{"type":"string","description":"Product Category"},"e":{"type":"string","description":"Exchange"},"n":{"type":"string","description":"Product Name"}},"required":["c","t","e","n"]}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /symbol/info

> Product Information

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Base"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/symbol/info":{"get":{"summary":"Product Information","deprecated":false,"description":"","tags":["Base"],"parameters":[{"name":"type","in":"query","description":"Product Category","required":true,"schema":{"type":"string"}},{"name":"region","in":"query","description":"Belongs to Region HK, SZ, SH, US","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"","required":false,"schema":{"type":"string"}},{"name":"exchange","in":"query","description":"","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","type":"object","properties":{"c":{"type":"string","description":"Product Code"},"t":{"type":"string","description":"Product Category"},"e":{"type":"string","description":"Exchange"},"n":{"type":"string","description":"Product Name"}},"required":["c","t","e","n"]}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```


# Stock

## GET /stock/base

> Product Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/base":{"get":{"summary":"Product Query","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"$ref":"#/components/schemas/Base","description":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Base":{"type":"object","properties":{"s":{"type":"string","description":"Product Code"},"nc":{"type":"string","description":"Simplified Chinese Underlying Name"},"ne":{"type":"string","description":"English Underlying Name"},"nh":{"type":"string","description":"Traditional Chinese Underlying Name"},"e":{"type":"string","description":"Exchange of the Underlying Asset"},"c":{"type":"string","description":"Trading Currency"},"l":{"type":"integer","description":"Shares per Lot"},"t":{"type":"integer","description":"Total Share Capital"},"cs":{"type":"integer","description":"Circulating Share Capital"},"hs":{"type":"integer","description":"Hong Kong Stock Capital (Only Hong Kong Stocks)"},"ep":{"type":"integer","description":"Earnings Per Share"},"ept":{"type":"integer","description":"Earnings Per Share (TTM)"},"bps":{"type":"integer","description":"Net Asset Value Per Share"},"dy":{"type":"integer","description":"Dividends"},"b":{"type":"string","description":"Sector of the Underlying Asset"},"sd":{"type":"string","description":"If the underlying asset is a stock, the available types of derivative market data are: 1 - Options; 2 - Warrants"}},"required":["s","nc","ne","nh","e","c","l","t","cs","hs","ep","ept","bps","dy","b","sd"]}}}}
```

## GET /stock/tick

> Real-time Transaction

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/tick":{"get":{"summary":"Real-time Transaction","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /stock/depth

> Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/depth":{"get":{"summary":"Real-time Order Book","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```

## GET /stock/kline

> Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/kline":{"get":{"summary":"Candlestick Query","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"array","items":{"$ref":"#/components/schemas/Kline"},"description":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Kline":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}}}}}
```

## GET /stock/quote

> Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/quote":{"get":{"summary":"Real-time Quotation","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /stock/klines

> Batch Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/klines":{"get":{"summary":"Batch Candlestick Query","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code 0: Success"},"msg":{"type":"string","description":"Exception Information exists when not equal to 0"},"data":{"type":"object","properties":{"code":{"type":"array","items":{"$ref":"#/components/schemas/Kline"}}},"description":"Response Data","required":["code"]}},"required":["code","data","msg"],"description":"Return Result"}}},"headers":{}}}}}},"components":{"schemas":{"Kline":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}}}}}
```

## GET /stock/ticks

> Batch Real-time Transactions

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/ticks":{"get":{"summary":"Batch Real-time Transactions","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /stock/quotes

> Batch Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/quotes":{"get":{"summary":"Batch Real-time Quotation","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /stock/depths

> Batch Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Stock"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/stock/depths":{"get":{"summary":"Batch Real-time Order Book","deprecated":false,"description":"","tags":["Stock"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```


# Forex

## GET /forex/base

> Product Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/base":{"get":{"summary":"Product Query","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","title":"Product Code"},"nc":{"type":"string","title":"Simplified Chinese Underlying Name"},"ne":{"type":"string","title":"English Underlying Name"},"nh":{"type":"string","title":"Traditional Chinese Underlying Name"},"e":{"type":"string","title":"Exchange of the Underlying Asset"},"c":{"type":"string","title":"Trading Currency","description":"CNY:USD；SGD:HKD"},"l":{"type":"integer","title":"Shares per Lot"},"t":{"type":"integer","title":"Total Share Capital"},"cs":{"type":"integer","title":"Circulating Share Capital"},"hs":{"type":"integer","title":"Hong Kong Stock Capital (Only Hong Kong Stocks)"},"ep":{"type":"number","title":"Earnings Per Share"},"ept":{"type":"number","title":"Earnings Per Share (TTM)"},"bps":{"type":"number","title":"Net Asset Value Per Share"},"dy":{"type":"number","title":"Dividends"},"b":{"type":"string","title":"Sector of the Underlying Asset"},"sd":{"type":"string","title":"If the underlying asset is an underlying stock, the types of derivative market data available","description":"1 - Options; 2 - Warrants"}},"required":["s","nc","ne","nh","e","c","l","t","cs","hs","ep","ept","bps","dy","b","sd"],"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /forex/tick

> Real-time Transaction

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/tick":{"get":{"summary":"Real-time Transaction","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /forex/depth

> Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/depth":{"get":{"summary":"Real-time Order Book","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","title":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","title":"Level"},"p":{"type":"integer","title":"Price"},"v":{"type":"number","title":"Order Volume"},"o":{"type":"number","title":"Order Quantity"}},"required":["po","p","v","o"]},"title":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","title":"Level"},"p":{"type":"number","title":"Price"},"v":{"type":"number","title":"Order Volume"},"o":{"type":"number","title":"Order Quantity"}},"required":["po","p","v","o"]},"title":"Buy Side"}},"required":["s","a","b"],"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /forex/kline

> Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/kline":{"get":{"summary":"Candlestick Query","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"array","items":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}},"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /forex/quote

> Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/quote":{"get":{"summary":"Real-time Quotation","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /forex/klines

> Batch Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/klines":{"get":{"summary":"Batch Candlestick Query","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code 0: Success"},"msg":{"type":"string","description":"Exception Information exists when not equal to 0"},"data":{"type":"object","properties":{"code":{"type":"array","items":{"$ref":"#/components/schemas/Kline"}}},"description":"Response Data","required":["code"]}},"required":["code","data","msg"],"description":"Return Result"}}},"headers":{}}}}}},"components":{"schemas":{"Kline":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}}}}}
```

## GET /forex/ticks

> Batch Real-time Transactions

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/ticks":{"get":{"summary":"Batch Real-time Transactions","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /forex/quotes

> Batch Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/quotes":{"get":{"summary":"Batch Real-time Quotation","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /forex/depths

> Batch Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Forex"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/forex/depths":{"get":{"summary":"Batch Real-time Order Book","deprecated":false,"description":"","tags":["Forex"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```


# Indices

## GET /indices/base

> Product Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/base":{"get":{"summary":"Product Query","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","title":"Product Code"},"nc":{"type":"string","title":"Simplified Chinese Underlying Name"},"ne":{"type":"string","title":"English Underlying Name"},"nh":{"type":"string","title":"Traditional Chinese Underlying Name"},"e":{"type":"string","title":"Exchange of the Underlying Asset"},"c":{"type":"string","title":"Trading Currency","description":"CNY:USD；SGD:HKD"},"l":{"type":"integer","title":"Shares per Lot"},"t":{"type":"integer","title":"Total Share Capital"},"cs":{"type":"integer","title":"Circulating Share Capital"},"hs":{"type":"integer","title":"Hong Kong Stock Capital (Only Hong Kong Stocks)"},"ep":{"type":"number","title":"Earnings Per Share"},"ept":{"type":"number","title":"Earnings Per Share (TTM)"},"bps":{"type":"number","title":"Net Asset Value Per Share"},"dy":{"type":"number","title":"Dividends"},"b":{"type":"string","title":"Sector of the Underlying Asset"},"sd":{"type":"string","title":"If the underlying asset is an underlying stock, the types of derivative market data available","description":"1 - Options; 2 - Warrants"}},"required":["s","nc","ne","nh","e","c","l","t","cs","hs","ep","ept","bps","dy","b","sd"],"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /indices/tick

> Real-time Transaction

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/tick":{"get":{"summary":"Real-time Transaction","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /indices/depth

> Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/depth":{"get":{"summary":"Real-time Order Book","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":false,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","title":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","title":"Level"},"p":{"type":"integer","title":"Price"},"v":{"type":"number","title":"Order Volume"},"o":{"type":"number","title":"Order Quantity"}},"required":["po","p","v","o"]},"title":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","title":"Level"},"p":{"type":"number","title":"Price"},"v":{"type":"number","title":"Order Volume"},"o":{"type":"number","title":"Order Quantity"}},"required":["po","p","v","o"]},"title":"Buy Side"}},"required":["s","a","b"],"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /indices/kline

> Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/kline":{"get":{"summary":"Candlestick Query","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","title":"Response Code","description":"0: Success"},"msg":{"type":"string","title":"Exception Information","description":"Exists when not equal to 0"},"data":{"type":"array","items":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}},"title":"Response Data"}},"required":["code","msg","data"]}}},"headers":{}}}}}}}
```

## GET /indices/quote

> Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/quote":{"get":{"summary":"Real-time Quotation","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Tick"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## GET /indices/ticks

> Batch Real-time Transactions

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/ticks":{"get":{"summary":"Batch Real-time Transactions","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /indices/quotes

> Batch Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/quotes":{"get":{"summary":"Batch Real-time Quotation","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /indices/depths

> Batch Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Indices"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/indices/depths":{"get":{"summary":"Batch Real-time Order Book","deprecated":false,"description":"","tags":["Indices"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```


# Crypto

## GET /crypto/base

> Product Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/base":{"get":{"summary":"Product Query","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Product Code"},"nc":{"type":"string","description":"Simplified Chinese Underlying Name"},"ne":{"type":"string","description":"English Underlying Name"},"nh":{"type":"string","description":"Traditional Chinese Underlying Name"},"e":{"type":"string","description":"Exchange of the Underlying Asset"},"c":{"type":"string","description":"Trading Currency, CNY:USD; SGD:HKD"},"l":{"type":"integer","description":"Shares per Lot"},"t":{"type":"integer","description":"Total Share Capital"},"cs":{"type":"integer","description":"Circulating Share Capital"},"hs":{"type":"integer","description":"Hong Kong Stock Capital (Only Hong Kong Stocks)"},"ep":{"type":"number","description":"Earnings Per Share"},"ept":{"type":"number","description":"Earnings Per Share (TTM)"},"bps":{"type":"number","description":"Net Asset Value Per Share"},"dy":{"type":"number","description":"Dividends"},"b":{"type":"string","description":"Sector of the Underlying Asset"},"sd":{"type":"string","description":"If the underlying asset is a stock, the available types of derivative market data are: 1 - Options; 2 - Warrants"}},"required":["s","nc","ne","nh","e","c","l","t","cs","hs","ep","ept","bps","dy","b","sd"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/tick

> Real-time Transaction

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/tick":{"get":{"summary":"Real-time Transaction","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/depth

> Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/depth":{"get":{"summary":"Real-time Order Book","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```

## GET /crypto/kline

> Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/kline":{"get":{"summary":"Candlestick Query","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code 0: Success"},"msg":{"type":"string","description":"Exception Information exists when not equal to 0"},"data":{"type":"array","items":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}},"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/quote

> Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/quote":{"get":{"summary":"Real-time Quotation","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"code","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/klines

> Batch Candlestick Query

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/klines":{"get":{"summary":"Batch Candlestick Query","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}},{"name":"kType","in":"query","description":"Cycle 1 minute, 2 five minutes, 3 ten minutes, 4 thirty minutes, 5 one hour, 6 two hours, 7 four hours, 8 one day, 9 one week, 10 one month","required":true,"schema":{"type":"string"}},{"name":"et","in":"query","description":"Query deadline","required":false,"schema":{"type":"string"}},{"name":"limit","in":"query","description":"Query number","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code 0: Success"},"msg":{"type":"string","description":"Exception Information exists when not equal to 0"},"data":{"type":"object","properties":{"code":{"type":"array","items":{"$ref":"#/components/schemas/Kline"}}},"description":"Response Data","required":["code"]}},"required":["code","data","msg"],"description":"Return Result"}}},"headers":{}}}}}},"components":{"schemas":{"Kline":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}}}}}
```

## GET /crypto/ticks

> Batch Real-time Transactions

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/ticks":{"get":{"summary":"Batch Real-time Transactions","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/quotes

> Batch Real-time Quotation

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/quotes":{"get":{"summary":"Batch Real-time Quotation","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Response Data"}},"required":["code","msg","data"],"description":"Return Result"}}},"headers":{}}}}}}}
```

## GET /crypto/depths

> Batch Real-time Order Book

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"Crypto"}],"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/crypto/depths":{"get":{"summary":"Batch Real-time Order Book","deprecated":false,"description":"","tags":["Crypto"],"parameters":[{"name":"region","in":"query","description":"Market Code","required":true,"schema":{"type":"string"}},{"name":"codes","in":"query","description":"Product Code","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response Code, 0: Success"},"msg":{"type":"string","description":"Exception Information, exists when not equal to 0"},"data":{"description":"Response Data","$ref":"#/components/schemas/Depth"}},"required":["code","msg","data"]}}},"headers":{}}}}}},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```


# Default module

## GET /symbol/holidays

> Market Holidays

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"servers":[{"url":"https://api.itick.org","description":"正式环境"}],"security":[],"paths":{"/symbol/holidays":{"get":{"summary":"Market Holidays","deprecated":false,"description":"","tags":[],"parameters":[],"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"integer","description":"Response code, 0: success"},"msg":{"type":"string","description":"Exception information, exists when not 0"},"data":{"type":"array","items":{"type":"object","properties":{"c":{"type":"string","description":"Market code"},"r":{"type":"string","description":"Market country name"},"tz":{"type":"integer","description":"Market time zone"},"et":{"type":"string","description":"Intraday trading hours"},"v":{"type":"string","description":"Holiday dates within the year"},"ey":{"type":"string","description":"Year"}}},"description":"Response data"}},"required":["code","data"]}}},"headers":{}}}}}}}
```


# Models

## The Kline object

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"components":{"schemas":{"Kline":{"type":"object","properties":{"tu":{"type":"number","description":"Transaction Amount"},"c":{"type":"number","description":"Closing Price of the Candlestick"},"t":{"type":"integer","description":"Timestamp"},"v":{"type":"integer","description":"Transaction Volume"},"h":{"type":"number","description":"Highest Price of the Candlestick"},"l":{"type":"number","description":"Lowest Price of the Candlestick"},"o":{"type":"number","description":"Opening Price of the Candlestick"}}}}}}
```

## The Base object

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"components":{"schemas":{"Base":{"type":"object","properties":{"s":{"type":"string","description":"Product Code"},"nc":{"type":"string","description":"Simplified Chinese Underlying Name"},"ne":{"type":"string","description":"English Underlying Name"},"nh":{"type":"string","description":"Traditional Chinese Underlying Name"},"e":{"type":"string","description":"Exchange of the Underlying Asset"},"c":{"type":"string","description":"Trading Currency"},"l":{"type":"integer","description":"Shares per Lot"},"t":{"type":"integer","description":"Total Share Capital"},"cs":{"type":"integer","description":"Circulating Share Capital"},"hs":{"type":"integer","description":"Hong Kong Stock Capital (Only Hong Kong Stocks)"},"ep":{"type":"integer","description":"Earnings Per Share"},"ept":{"type":"integer","description":"Earnings Per Share (TTM)"},"bps":{"type":"integer","description":"Net Asset Value Per Share"},"dy":{"type":"integer","description":"Dividends"},"b":{"type":"string","description":"Sector of the Underlying Asset"},"sd":{"type":"string","description":"If the underlying asset is a stock, the available types of derivative market data are: 1 - Options; 2 - Warrants"}},"required":["s","nc","ne","nh","e","c","l","t","cs","hs","ep","ept","bps","dy","b","sd"]}}}}
```

## The Tick object

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"components":{"schemas":{"Tick":{"type":"object","properties":{"s":{"type":"string","description":"Symbol Code"},"ld":{"type":"integer","description":"Latest Price"},"t":{"type":"integer","description":"Timestamp of the Latest Transaction"},"v":{"type":"number","description":"Transaction Volume"},"tu":{"type":"number","description":"Transaction Amount"},"ts":{"type":"integer","description":"Trading Status of the Asset"}},"required":["s","ld","t","v","tu","ts"],"description":"Tick"}}}}
```

## The Depth object

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"components":{"schemas":{"Depth":{"type":"object","properties":{"s":{"type":"string","description":"Underlying Code"},"a":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Sell Side"},"b":{"type":"array","items":{"type":"object","properties":{"po":{"type":"integer","description":"Level"},"p":{"type":"number","description":"Price"},"v":{"type":"number","description":"Order Volume"},"o":{"type":"number","description":"Order Quantity"}},"required":["po","p","v","o"]},"description":"Buy Side"}},"required":["s","a","b"]}}}}
```


# 基础数据

获取股票、基金、外汇、加密货币等金融基础数据，包含交易所列表、交易日历、标的列表、分类代码等核心参考数据 API，支持金融系统开发与数据整合。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## Base

### GET 产品清单

GET /symbol/list

#### Params

| Name   | Location | Type   | Required | Description                                     |
| ------ | -------- | ------ | -------- | ----------------------------------------------- |
| type   | query    | string | yes      | 产品类别，stock、forex、indices、crypto                 |
| region | query    | string | yes      | 所属区域 股票包括（HK、SZ、SH、US、SG），外汇（gb），指数（gb），数字币（ba） |
| code   | query    | string | no       | none                                            |

> Response Examples

```json
{
  "code": 200,
  "status": "ok",
  "data": [
    {
      "c": "700",
      "n": "TENCENT HOLDINGS LIMITED",
      "t": "stock",
      "e": "HKEX"
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | string  | true     | none         |       | 异常信息,不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» c   | string  | true     | none         |       | 产品代码        |
| »» t   | string  | true     | none         |       | 产品类别        |
| »» e   | string  | true     | none         |       | 交易所         |
| »» n   | string  | true     | none         |       | 产品名称        |

### GET 市场假期

GET /symbol/holidays

> Response Examples

```json
{
  "code": 200,
  "status": "ok",
  "data": [
    {
      "c": "AU",
      "r": "Australia",
      "v": "[\"2025-01-01\", \"2025-01-27\", \"2025-04-18\", \"2025-04-21\", \"2025-04-25\", \"2025-06-09\", \"2025-12-25\", \"2025-12-26\"]",
      "et": "09:30 - 16:00",
      "ey": "2025",
      "vr": null,
      "tz": 10
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | string    | false    | none         |       | 异常信息,不为0时存在 |
| » data | \[object] | true     | none         |       | 响应数据        |
| »» c   | string    | false    | none         |       | 市场代码        |
| »» r   | string    | false    | none         |       | 市场国家名称      |
| »» tz  | integer   | false    | none         |       | 市场时区        |
| »» et  | string    | false    | none         |       | 日内交易时间      |
| »» v   | string    | false    | none         |       | 年内假期日期      |
| »» ey  | string    | false    | none         |       | 年份          |

### GET 产品信息

GET /symbol/info

#### Params

| Name     | Location | Type   | Required | Description      |
| -------- | -------- | ------ | -------- | ---------------- |
| type     | query    | string | yes      | 产品类别             |
| region   | query    | string | yes      | 所属区域 HK、SZ、SH、US |
| code     | query    | string | no       | none             |
| exchange | query    | string | no       | none             |

> Response Examples

```json
{
  "code": 200,
  "status": "ok",
  "data": [
    {
      "c": "700",
      "n": "TENCENT HOLDINGS LIMITED",
      "t": "stock",
      "e": "HKEX"
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | string  | true     | none         |       | 异常信息,不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» c   | string  | true     | none         |       | 产品代码        |
| »» t   | string  | true     | none         |       | 产品类别        |
| »» e   | string  | true     | none         |       | 交易所         |
| »» n   | string  | true     | none         |       | 产品名称        |

## Data Schema


# 股票数据

提供实时、历史、复权股票数据，包含 A 股、港股、美股行情，股票列表、财务指标、分红送配等完整股票数据 API 接口，适用于量化交易与金融分析。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## Stock

### GET K线查询

GET /stock/kline

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| code   | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type     | Required | Restrictions | Title | description |
| ------ | -------- | -------- | ------------ | ----- | ----------- |
| » code | integer  | true     | none         |       | 响应码,0:成功    |
| » msg  | null     | true     | none         |       | 异常信息,不为0时存在 |
| » data | \[Kline] | true     | none         |       | 响应数据        |
| »» tu  | number   | false    | none         |       | 成交金额        |
| »» c   | number   | false    | none         |       | 该K线收盘价      |
| »» t   | integer  | false    | none         |       | 时间戳         |
| »» v   | integer  | false    | none         |       | 成交数量        |
| »» h   | number   | false    | none         |       | 该K线最高价      |
| »» l   | number   | false    | none         |       | 该K线最低价      |
| »» o   | number   | false    | none         |       | 该K线开盘价      |

### GET 实时报价

GET /stock/quote

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时成交

GET /stock/tick

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时盘口

GET /stock/depth

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

### GET 批量实时成交

GET /stock/ticks

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时报价

GET /stock/quotes

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量K线查询

GET /stock/klines

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| codes  | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name    | Type     | Required | Restrictions | Title | description |
| ------- | -------- | -------- | ------------ | ----- | ----------- |
| » code  | integer  | true     | none         |       | 响应码 0:成功    |
| » msg   | string   | false    | none         |       | 异常信息 不为0时存在 |
| » data  | object   | true     | none         |       | 响应数据        |
| »» code | \[Kline] | true     | none         |       | none        |
| »»» tu  | number   | false    | none         |       | 成交金额        |
| »»» c   | number   | false    | none         |       | 该K线收盘价      |
| »»» t   | integer  | false    | none         |       | 时间戳         |
| »»» v   | integer  | false    | none         |       | 成交数量        |
| »»» h   | number   | false    | none         |       | 该K线最高价      |
| »»» l   | number   | false    | none         |       | 该K线最低价      |
| »»» o   | number   | false    | none         |       | 该K线开盘价      |

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description                       |
| ------ | ------- | -------- | ------------ | ----- | --------------------------------- |
| » code | integer | true     | none         |       | 响应码,0:成功                          |
| » msg  | string  | true     | none         |       | 异常信息,不为0时存在                       |
| » data | Base    | true     | none         |       | 响应数据                              |
| »» s   | string  | true     | none         |       | 产品代码                              |
| »» nc  | string  | true     | none         |       | 中文简体标的名称                          |
| »» ne  | string  | true     | none         |       | 英文标的名称                            |
| »» nh  | string  | true     | none         |       | 中文繁体标的名称                          |
| »» e   | string  | true     | none         |       | 标的所属交易所                           |
| »» c   | string  | true     | none         |       | 交易币种                              |
| »» l   | integer | true     | none         |       | 每手股数                              |
| »» t   | integer | true     | none         |       | 总股本                               |
| »» cs  | integer | true     | none         |       | 流通股本                              |
| »» hs  | integer | true     | none         |       | 港股股本 (仅港股)                        |
| »» ep  | integer | true     | none         |       | 每股盈利                              |
| »» ept | integer | true     | none         |       | 每股盈利 (TTM)                        |
| »» bps | integer | true     | none         |       | 每股净资产                             |
| »» dy  | integer | true     | none         |       | 股息                                |
| »» b   | string  | true     | none         |       | 标的所属板块                            |
| »» sd  | string  | true     | none         |       | 如果标的是正股，可提供的衍生品行情类型,1 - 期权；2 - 轮证 |

### GET 批量实时盘口

GET /stock/depths

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

## Data Schema

### Kline <a href="#tocs_kline" id="tocs_kline"></a>

```json
{
  "tu": 0,
  "c": 0,
  "t": 0,
  "v": 0,
  "h": 0,
  "l": 0,
  "o": 0
}

```

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| tu   | number  | false    | none         |       | 成交金额        |
| c    | number  | false    | none         |       | 该K线收盘价      |
| t    | integer | false    | none         |       | 时间戳         |
| v    | integer | false    | none         |       | 成交数量        |
| h    | number  | false    | none         |       | 该K线最高价      |
| l    | number  | false    | none         |       | 该K线最低价      |
| o    | number  | false    | none         |       | 该K线开盘价      |

### Base <a href="#tocs_base" id="tocs_base"></a>

```json
{
  "s": "string",
  "nc": "string",
  "ne": "string",
  "nh": "string",
  "e": "string",
  "c": "string",
  "l": 0,
  "t": 0,
  "cs": 0,
  "hs": 0,
  "ep": 0,
  "ept": 0,
  "bps": 0,
  "dy": 0,
  "b": "string",
  "sd": "string"
}

```

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description                       |
| ---- | ------- | -------- | ------------ | ----- | --------------------------------- |
| s    | string  | true     | none         |       | 产品代码                              |
| nc   | string  | true     | none         |       | 中文简体标的名称                          |
| ne   | string  | true     | none         |       | 英文标的名称                            |
| nh   | string  | true     | none         |       | 中文繁体标的名称                          |
| e    | string  | true     | none         |       | 标的所属交易所                           |
| c    | string  | true     | none         |       | 交易币种                              |
| l    | integer | true     | none         |       | 每手股数                              |
| t    | integer | true     | none         |       | 总股本                               |
| cs   | integer | true     | none         |       | 流通股本                              |
| hs   | integer | true     | none         |       | 港股股本 (仅港股)                        |
| ep   | integer | true     | none         |       | 每股盈利                              |
| ept  | integer | true     | none         |       | 每股盈利 (TTM)                        |
| bps  | integer | true     | none         |       | 每股净资产                             |
| dy   | integer | true     | none         |       | 股息                                |
| b    | string  | true     | none         |       | 标的所属板块                            |
| sd   | string  | true     | none         |       | 如果标的是正股，可提供的衍生品行情类型,1 - 期权；2 - 轮证 |

### Tick <a href="#tocs_tick" id="tocs_tick"></a>

```json
{
  "s": "string",
  "ld": 0,
  "t": 0,
  "v": 0,
  "tu": 0,
  "ts": 0
}

```

Tick

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| s    | string  | true     | none         |       | symbol标的代码  |
| ld   | integer | true     | none         |       | 最新价         |
| t    | integer | true     | none         |       | 最新成交的时间戳    |
| v    | number  | true     | none         |       | 成交量         |
| tu   | number  | true     | none         |       | 成交额         |
| ts   | integer | true     | none         |       | 标的交易状态      |

### Depth <a href="#tocs_depth" id="tocs_depth"></a>

```json
{
  "s": "string",
  "a": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ],
  "b": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ]
}

```

#### Attribute

| Name | Type      | Required | Restrictions | Title | Description |
| ---- | --------- | -------- | ------------ | ----- | ----------- |
| s    | string    | true     | none         |       | 标的代码        |
| a    | \[object] | true     | none         |       | 卖盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |
| b    | \[object] | true     | none         |       | 买盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |


# 指数数据

获取全球股票指数实时行情与历史数据，覆盖沪深指数、标普 500、纳斯达克等主要指数行情、成分股、权重数据 API，助力市场监控与指数化投资。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## Indices

### GET 标的查询

GET /indices/base

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "839.HK",
    "nc": "中教控股",
    "ne": "CHINA EDU GROUP",
    "nh": "中教控股",
    "e": "SEHK",
    "c": "HKD",
    "l": 1000,
    "t": 2713791221,
    "cs": 2713791221,
    "hs": 2713791221,
    "ep": 0.5555219630532146,
    "ept": 0.5984943570767414,
    "bps": 6.618762900073513,
    "dy": 0.3387696962454725,
    "b": "HKEquity"
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title               | description     |
| ------ | ------- | -------- | ------------ | ------------------- | --------------- |
| » code | integer | true     | none         | 响应码                 | 0:成功            |
| » msg  | null    | true     | none         | 异常信息                | 不为0时存在          |
| » data | object  | true     | none         | 响应数据                | none            |
| »» s   | string  | true     | none         | 产品代码                | none            |
| »» nc  | string  | true     | none         | 中文简体标的名称            | none            |
| »» ne  | string  | true     | none         | 英文标的名称              | none            |
| »» nh  | string  | true     | none         | 中文繁体标的名称            | none            |
| »» e   | string  | true     | none         | 标的所属交易所             | none            |
| »» c   | string  | true     | none         | 交易币种                | CNY:USD；SGD:HKD |
| »» l   | integer | true     | none         | 每手股数                | none            |
| »» t   | integer | true     | none         | 总股本                 | none            |
| »» cs  | integer | true     | none         | 流通股本                | none            |
| »» hs  | integer | true     | none         | 港股股本 (仅港股)          | none            |
| »» ep  | number  | true     | none         | 每股盈利                | none            |
| »» ept | number  | true     | none         | 每股盈利 (TTM)          | none            |
| »» bps | number  | true     | none         | 每股净资产               | none            |
| »» dy  | number  | true     | none         | 股息                  | none            |
| »» b   | string  | true     | none         | 标的所属板块              | none            |
| »» sd  | string  | true     | none         | 如果标的是正股，可提供的衍生品行情类型 | 1 - 期权；2 - 轮证   |

### GET K线查询

GET /indices/kline

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| code   | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         | 响应码   | 0:成功        |
| » msg  | null      | true     | none         | 异常信息  | 不为0时存在      |
| » data | \[object] | true     | none         | 响应数据  | none        |
| »» tu  | integer   | true     | none         |       | none        |
| »» c   | number    | true     | none         |       | none        |
| »» t   | integer   | true     | none         |       | none        |
| »» v   | integer   | true     | none         |       | none        |
| »» h   | number    | true     | none         |       | none        |
| »» l   | number    | true     | none         |       | none        |
| »» o   | number    | true     | none         |       | none        |

### GET 实时成交

GET /indices/tick

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时报价

GET /indices/quote

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时盘口

GET /indices/depth

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | no       | 市场代码        |
| code   | query    | string | no       | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         | 响应码   | 0:成功        |
| » msg  | null      | true     | none         | 异常信息  | 不为0时存在      |
| » data | object    | true     | none         | 响应数据  | none        |
| »» s   | string    | true     | none         | 标的代码  | none        |
| »» a   | \[object] | true     | none         | 卖盘    | none        |
| »»» po | integer   | true     | none         | 档位    | none        |
| »»» p  | integer   | true     | none         | 价格    | none        |
| »»» v  | number    | true     | none         | 挂单量   | none        |
| »»» o  | number    | true     | none         | 订单数量  | none        |
| »» b   | \[object] | true     | none         | 买盘    | none        |
| »»» po | integer   | true     | none         | 档位    | none        |
| »»» p  | number    | true     | none         | 价格    | none        |
| »»» v  | number    | true     | none         | 挂单量   | none        |
| »»» o  | number    | true     | none         | 订单数量  | none        |

### GET 批量K线查询

GET /indices/klines

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| codes  | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name    | Type     | Required | Restrictions | Title | description |
| ------- | -------- | -------- | ------------ | ----- | ----------- |
| » code  | integer  | true     | none         |       | 响应码 0:成功    |
| » msg   | string   | false    | none         |       | 异常信息 不为0时存在 |
| » data  | object   | true     | none         |       | 响应数据        |
| »» code | \[Kline] | true     | none         |       | none        |
| »»» tu  | number   | false    | none         |       | 成交金额        |
| »»» c   | number   | false    | none         |       | 该K线收盘价      |
| »»» t   | integer  | false    | none         |       | 时间戳         |
| »»» v   | integer  | false    | none         |       | 成交数量        |
| »»» h   | number   | false    | none         |       | 该K线最高价      |
| »»» l   | number   | false    | none         |       | 该K线最低价      |
| »»» o   | number   | false    | none         |       | 该K线开盘价      |

### GET 批量实时成交

GET /indices/ticks

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时报价

GET /indices/quotes

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时盘口

GET /indices/depths

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

## Data Schema

### Kline <a href="#tocs_kline" id="tocs_kline"></a>

```json
{
  "tu": 0,
  "c": 0,
  "t": 0,
  "v": 0,
  "h": 0,
  "l": 0,
  "o": 0
}

```

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| tu   | number  | false    | none         |       | 成交金额        |
| c    | number  | false    | none         |       | 该K线收盘价      |
| t    | integer | false    | none         |       | 时间戳         |
| v    | integer | false    | none         |       | 成交数量        |
| h    | number  | false    | none         |       | 该K线最高价      |
| l    | number  | false    | none         |       | 该K线最低价      |
| o    | number  | false    | none         |       | 该K线开盘价      |

### Tick <a href="#tocs_tick" id="tocs_tick"></a>

```json
{
  "s": "string",
  "ld": 0,
  "t": 0,
  "v": 0,
  "tu": 0,
  "ts": 0
}

```

Tick

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| s    | string  | true     | none         |       | symbol标的代码  |
| ld   | integer | true     | none         |       | 最新价         |
| t    | integer | true     | none         |       | 最新成交的时间戳    |
| v    | number  | true     | none         |       | 成交量         |
| tu   | number  | true     | none         |       | 成交额         |
| ts   | integer | true     | none         |       | 标的交易状态      |

### Depth <a href="#tocs_depth" id="tocs_depth"></a>

```json
{
  "s": "string",
  "a": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ],
  "b": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ]
}

```

#### Attribute

| Name | Type      | Required | Restrictions | Title | Description |
| ---- | --------- | -------- | ------------ | ----- | ----------- |
| s    | string    | true     | none         |       | 标的代码        |
| a    | \[object] | true     | none         |       | 卖盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |
| b    | \[object] | true     | none         |       | 买盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |


# 外汇数据

接入实时外汇汇率数据与历史行情，包含主流货币对报价、汇率转换、中间价查询等外汇数据 API，适用于外汇交易、跨境支付与金融计算。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## Forex

### GET K线查询

GET /forex/kline

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| code   | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         | 响应码   | 0:成功        |
| » msg  | null      | true     | none         | 异常信息  | 不为0时存在      |
| » data | \[object] | true     | none         | 响应数据  | none        |
| »» tu  | integer   | true     | none         |       | none        |
| »» c   | number    | true     | none         |       | none        |
| »» t   | integer   | true     | none         |       | none        |
| »» v   | integer   | true     | none         |       | none        |
| »» h   | number    | true     | none         |       | none        |
| »» l   | number    | true     | none         |       | none        |
| »» o   | number    | true     | none         |       | none        |

### GET 实时报价

GET /forex/quote

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时成交

GET /forex/tick

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码,0:成功    |
| » msg  | null    | true     | none         |       | 异常信息,不为0时存在 |
| » data | Tick    | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量K线查询

GET /forex/klines

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| codes  | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name    | Type     | Required | Restrictions | Title | description |
| ------- | -------- | -------- | ------------ | ----- | ----------- |
| » code  | integer  | true     | none         |       | 响应码 0:成功    |
| » msg   | string   | false    | none         |       | 异常信息 不为0时存在 |
| » data  | object   | true     | none         |       | 响应数据        |
| »» code | \[Kline] | true     | none         |       | none        |
| »»» tu  | number   | false    | none         |       | 成交金额        |
| »»» c   | number   | false    | none         |       | 该K线收盘价      |
| »»» t   | integer  | false    | none         |       | 时间戳         |
| »»» v   | integer  | false    | none         |       | 成交数量        |
| »»» h   | number   | false    | none         |       | 该K线最高价      |
| »»» l   | number   | false    | none         |       | 该K线最低价      |
| »»» o   | number   | false    | none         |       | 该K线开盘价      |

### GET 实时盘口

GET /forex/depth

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         | 响应码   | 0:成功        |
| » msg  | null      | true     | none         | 异常信息  | 不为0时存在      |
| » data | object    | true     | none         | 响应数据  | none        |
| »» s   | string    | true     | none         | 标的代码  | none        |
| »» a   | \[object] | true     | none         | 卖盘    | none        |
| »»» po | integer   | true     | none         | 档位    | none        |
| »»» p  | integer   | true     | none         | 价格    | none        |
| »»» v  | number    | true     | none         | 挂单量   | none        |
| »»» o  | number    | true     | none         | 订单数量  | none        |
| »» b   | \[object] | true     | none         | 买盘    | none        |
| »»» po | integer   | true     | none         | 档位    | none        |
| »»» p  | number    | true     | none         | 价格    | none        |
| »»» v  | number    | true     | none         | 挂单量   | none        |
| »»» o  | number    | true     | none         | 订单数量  | none        |

### GET 批量实时成交

GET /forex/ticks

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时报价

GET /forex/quotes

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 标的查询

GET /forex/base

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "839.HK",
    "nc": "中教控股",
    "ne": "CHINA EDU GROUP",
    "nh": "中教控股",
    "e": "SEHK",
    "c": "HKD",
    "l": 1000,
    "t": 2713791221,
    "cs": 2713791221,
    "hs": 2713791221,
    "ep": 0.5555219630532146,
    "ept": 0.5984943570767414,
    "bps": 6.618762900073513,
    "dy": 0.3387696962454725,
    "b": "HKEquity"
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type    | Required | Restrictions | Title               | description     |
| ------ | ------- | -------- | ------------ | ------------------- | --------------- |
| » code | integer | true     | none         | 响应码                 | 0:成功            |
| » msg  | null    | true     | none         | 异常信息                | 不为0时存在          |
| » data | object  | true     | none         | 响应数据                | none            |
| »» s   | string  | true     | none         | 产品代码                | none            |
| »» nc  | string  | true     | none         | 中文简体标的名称            | none            |
| »» ne  | string  | true     | none         | 英文标的名称              | none            |
| »» nh  | string  | true     | none         | 中文繁体标的名称            | none            |
| »» e   | string  | true     | none         | 标的所属交易所             | none            |
| »» c   | string  | true     | none         | 交易币种                | CNY:USD；SGD:HKD |
| »» l   | integer | true     | none         | 每手股数                | none            |
| »» t   | integer | true     | none         | 总股本                 | none            |
| »» cs  | integer | true     | none         | 流通股本                | none            |
| »» hs  | integer | true     | none         | 港股股本 (仅港股)          | none            |
| »» ep  | number  | true     | none         | 每股盈利                | none            |
| »» ept | number  | true     | none         | 每股盈利 (TTM)          | none            |
| »» bps | number  | true     | none         | 每股净资产               | none            |
| »» dy  | number  | true     | none         | 股息                  | none            |
| »» b   | string  | true     | none         | 标的所属板块              | none            |
| »» sd  | string  | true     | none         | 如果标的是正股，可提供的衍生品行情类型 | 1 - 期权；2 - 轮证   |

### GET 批量实时盘口

GET /forex/depths

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

## Data Schema

### Kline <a href="#tocs_kline" id="tocs_kline"></a>

```json
{
  "tu": 0,
  "c": 0,
  "t": 0,
  "v": 0,
  "h": 0,
  "l": 0,
  "o": 0
}

```

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| tu   | number  | false    | none         |       | 成交金额        |
| c    | number  | false    | none         |       | 该K线收盘价      |
| t    | integer | false    | none         |       | 时间戳         |
| v    | integer | false    | none         |       | 成交数量        |
| h    | number  | false    | none         |       | 该K线最高价      |
| l    | number  | false    | none         |       | 该K线最低价      |
| o    | number  | false    | none         |       | 该K线开盘价      |

### Tick <a href="#tocs_tick" id="tocs_tick"></a>

```json
{
  "s": "string",
  "ld": 0,
  "t": 0,
  "v": 0,
  "tu": 0,
  "ts": 0
}

```

Tick

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| s    | string  | true     | none         |       | symbol标的代码  |
| ld   | integer | true     | none         |       | 最新价         |
| t    | integer | true     | none         |       | 最新成交的时间戳    |
| v    | number  | true     | none         |       | 成交量         |
| tu   | number  | true     | none         |       | 成交额         |
| ts   | integer | true     | none         |       | 标的交易状态      |

### Depth <a href="#tocs_depth" id="tocs_depth"></a>

```json
{
  "s": "string",
  "a": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ],
  "b": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ]
}

```

#### Attribute

| Name | Type      | Required | Restrictions | Title | Description |
| ---- | --------- | -------- | ------------ | ----- | ----------- |
| s    | string    | true     | none         |       | 标的代码        |
| a    | \[object] | true     | none         |       | 卖盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |
| b    | \[object] | true     | none         |       | 买盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |


# 加密货币

提供实时与历史加密货币行情数据，涵盖比特币、以太坊等主流币种行情、K 线、深度、交易对信息，支持数字货币交易所数据 API 接入与加密市场分析。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## Crypto

### GET K线查询

GET /crypto/kline

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| code   | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码 0:成功    |
| » msg  | null      | true     | none         |       | 异常信息 不为0时存在 |
| » data | \[object] | true     | none         |       | 响应数据        |
| »» tu  | number    | true     | none         |       | 成交金额        |
| »» c   | number    | true     | none         |       | 该K线收盘价      |
| »» t   | integer   | true     | none         |       | 时间戳         |
| »» v   | number    | true     | none         |       | 成交数量        |
| »» h   | number    | true     | none         |       | 该K线最高价      |
| »» l   | number    | true     | none         |       | 该K线最低价      |
| »» o   | number    | true     | none         |       | 该K线开盘价      |

### GET 批量K线查询

GET /crypto/klines

#### Params

| Name   | Location | Type   | Required | Description                                        |
| ------ | -------- | ------ | -------- | -------------------------------------------------- |
| region | query    | string | yes      | 市场代码                                               |
| codes  | query    | string | yes      | 产品代码                                               |
| kType  | query    | string | yes      | 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月 |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": [
    {
      "tu": 7,
      "c": 1.568,
      "t": 1729090560000,
      "v": 4,
      "h": 1.568,
      "l": 1.568,
      "o": 1.568
    }
  ]
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name    | Type     | Required | Restrictions | Title | description |
| ------- | -------- | -------- | ------------ | ----- | ----------- |
| » code  | integer  | true     | none         |       | 响应码 0:成功    |
| » msg   | string   | false    | none         |       | 异常信息 不为0时存在 |
| » data  | object   | true     | none         |       | 响应数据        |
| »» code | \[Kline] | true     | none         |       | none        |
| »»» tu  | number   | false    | none         |       | 成交金额        |
| »»» c   | number   | false    | none         |       | 该K线收盘价      |
| »»» t   | integer  | false    | none         |       | 时间戳         |
| »»» v   | integer  | false    | none         |       | 成交数量        |
| »»» h   | number   | false    | none         |       | 该K线最高价      |
| »»» l   | number   | false    | none         |       | 该K线最低价      |
| »»» o   | number   | false    | none         |       | 该K线开盘价      |

### GET 实时报价

GET /crypto/quote

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时成交

GET /crypto/tick

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时成交

GET /crypto/ticks

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 批量实时报价

GET /crypto/quotes

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "ld": 67600,
    "t": 1729087440311,
    "v": 0.02989,
    "tu": 2020.564,
    "ts": 0
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description |
| ------ | ------- | -------- | ------------ | ----- | ----------- |
| » code | integer | true     | none         |       | 响应码，0:成功    |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在 |
| » data | object  | true     | none         |       | 响应数据        |
| »» s   | string  | true     | none         |       | symbol标的代码  |
| »» ld  | integer | true     | none         |       | 最新价         |
| »» t   | integer | true     | none         |       | 最新成交的时间戳    |
| »» v   | number  | true     | none         |       | 成交量         |
| »» tu  | number  | true     | none         |       | 成交额         |
| »» ts  | integer | true     | none         |       | 标的交易状态      |

### GET 实时盘口

GET /crypto/depth

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BTCUSDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

### GET 批量实时盘口

GET /crypto/depths

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| codes  | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "BA_BTC_USDT",
    "a": [
      {
        "po": 1,
        "p": 67800,
        "v": 0.36339,
        "o": 0.36339
      },
      {
        "po": 2,
        "p": 67800.04,
        "v": 0.00037,
        "o": 0.00037
      },
      {
        "po": 3,
        "p": 67800.28,
        "v": 0.00018,
        "o": 0.00018
      },
      {
        "po": 4,
        "p": 67800.51,
        "v": 0.00019,
        "o": 0.00019
      },
      {
        "po": 5,
        "p": 67800.52,
        "v": 0.0001,
        "o": 0.0001
      }
    ],
    "b": [
      {
        "po": 1,
        "p": 67799.99,
        "v": 2.49817,
        "o": 2.49817
      },
      {
        "po": 2,
        "p": 67799.98,
        "v": 0.06575,
        "o": 0.06575
      },
      {
        "po": 3,
        "p": 67799.96,
        "v": 0.09079,
        "o": 0.09079
      },
      {
        "po": 4,
        "p": 67799.95,
        "v": 0.1001,
        "o": 0.1001
      },
      {
        "po": 5,
        "p": 67799.05,
        "v": 0.0001,
        "o": 0.0001
      }
    ]
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

| Name   | Type      | Required | Restrictions | Title | description |
| ------ | --------- | -------- | ------------ | ----- | ----------- |
| » code | integer   | true     | none         |       | 响应码,0:成功    |
| » msg  | null      | true     | none         |       | 异常信息,不为0时存在 |
| » data | Depth     | true     | none         |       | 响应数据        |
| »» s   | string    | true     | none         |       | 标的代码        |
| »» a   | \[object] | true     | none         |       | 卖盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |
| »» b   | \[object] | true     | none         |       | 买盘          |
| »»» po | integer   | true     | none         |       | 档位          |
| »»» p  | number    | true     | none         |       | 价格          |
| »»» v  | number    | true     | none         |       | 挂单量         |
| »»» o  | number    | true     | none         |       | 订单数量        |

### GET 标的查询

GET /crypto/base

#### Params

| Name   | Location | Type   | Required | Description |
| ------ | -------- | ------ | -------- | ----------- |
| region | query    | string | yes      | 市场代码        |
| code   | query    | string | yes      | 产品代码        |

> Response Examples

```json
{
  "code": 0,
  "msg": null,
  "data": {
    "s": "839.HK",
    "nc": "中教控股",
    "ne": "CHINA EDU GROUP",
    "nh": "中教控股",
    "e": "SEHK",
    "c": "HKD",
    "l": 1000,
    "t": 2713791221,
    "cs": 2713791221,
    "hs": 2713791221,
    "ep": 0.5555219630532146,
    "ept": 0.5984943570767414,
    "bps": 6.618762900073513,
    "dy": 0.3387696962454725,
    "b": "HKEquity"
  }
}
```

#### Responses

| HTTP Status Code | Meaning                                                 | Description | Data schema |
| ---------------- | ------------------------------------------------------- | ----------- | ----------- |
| 200              | [OK](https://tools.ietf.org/html/rfc7231#section-6.3.1) | none        | Inline      |

#### Responses Data Schema

HTTP Status Code **200**

*返回结果*

| Name   | Type    | Required | Restrictions | Title | description                       |
| ------ | ------- | -------- | ------------ | ----- | --------------------------------- |
| » code | integer | true     | none         |       | 响应码，0:成功                          |
| » msg  | null    | true     | none         |       | 异常信息，不为0时存在                       |
| » data | object  | true     | none         |       | 响应数据                              |
| »» s   | string  | true     | none         |       | 产品代码                              |
| »» nc  | string  | true     | none         |       | 中文简体标的名称                          |
| »» ne  | string  | true     | none         |       | 英文标的名称                            |
| »» nh  | string  | true     | none         |       | 中文繁体标的名称                          |
| »» e   | string  | true     | none         |       | 标的所属交易所                           |
| »» c   | string  | true     | none         |       | 交易币种, CNY:USD；SGD:HKD             |
| »» l   | integer | true     | none         |       | 每手股数                              |
| »» t   | integer | true     | none         |       | 总股本                               |
| »» cs  | integer | true     | none         |       | 流通股本                              |
| »» hs  | integer | true     | none         |       | 港股股本 (仅港股)                        |
| »» ep  | number  | true     | none         |       | 每股盈利                              |
| »» ept | number  | true     | none         |       | 每股盈利 (TTM)                        |
| »» bps | number  | true     | none         |       | 每股净资产                             |
| »» dy  | number  | true     | none         |       | 股息                                |
| »» b   | string  | true     | none         |       | 标的所属板块                            |
| »» sd  | string  | true     | none         |       | 如果标的是正股，可提供的衍生品行情类型,1 - 期权；2 - 轮证 |

## Data Schema

### Kline <a href="#tocs_kline" id="tocs_kline"></a>

```json
{
  "tu": 0,
  "c": 0,
  "t": 0,
  "v": 0,
  "h": 0,
  "l": 0,
  "o": 0
}

```

#### Attribute

| Name | Type    | Required | Restrictions | Title | Description |
| ---- | ------- | -------- | ------------ | ----- | ----------- |
| tu   | number  | false    | none         |       | 成交金额        |
| c    | number  | false    | none         |       | 该K线收盘价      |
| t    | integer | false    | none         |       | 时间戳         |
| v    | integer | false    | none         |       | 成交数量        |
| h    | number  | false    | none         |       | 该K线最高价      |
| l    | number  | false    | none         |       | 该K线最低价      |
| o    | number  | false    | none         |       | 该K线开盘价      |

### Depth <a href="#tocs_depth" id="tocs_depth"></a>

```json
{
  "s": "string",
  "a": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ],
  "b": [
    {
      "po": 0,
      "p": 0,
      "v": 0,
      "o": 0
    }
  ]
}

```

#### Attribute

| Name | Type      | Required | Restrictions | Title | Description |
| ---- | --------- | -------- | ------------ | ----- | ----------- |
| s    | string    | true     | none         |       | 标的代码        |
| a    | \[object] | true     | none         |       | 卖盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |
| b    | \[object] | true     | none         |       | 买盘          |
| » po | integer   | true     | none         |       | 档位          |
| » p  | number    | true     | none         |       | 价格          |
| » v  | number    | true     | none         |       | 挂单量         |
| » o  | number    | true     | none         |       | 订单数量        |


# 股票报价

股票实时报价 WebSocket API：A 股、港股、美股实时行情推送，支持逐笔成交、五档盘口、分时数据与自定义标的订阅。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## 股票 WebSocket 文档

iTick.org Stocks WebSocket API 提供对深圳交易所、上海交易所、香港交易所以及美国等最新股市数据的流式访问。 您可以通过以操作形式发送指令来指定要使用的频道。当您订阅的频道中发生事件时，我们的 WebSockets 会发出事件以通知您。

我们的 WebSocket API 基于授权，授权可控制您可以连接到哪些 WebSocket 集群以及您可以访问哪些类型的数据。 您可以登录查看包含您的 API 密钥并根据您的授权进行个性化的示例。

### 第 1 步：连接

使用高级计划，您将能够使用单个连接到集群。如果另一个连接同时尝试连接到集群，则当前连接将被断开。 如果您需要同时连接到此集群的更多连接，您可以联系支持人员。

连接到集群：

```shell
wscat -c wss://api.itick.org/stock -H "token: 2abf6c0*************************dd8a1930a2f48ba14a"
```

连接后您将收到以下消息：

```json
{
  "code":1,
  "msg": "Connected Successfully"
}
```

<br>

### 第 2 步：验证

验证成功后，您将收到以下消息：

```json
{
  "code":1,
  "resAc":"auth",
  "msg": "authenticated"
}
```

验证失败，会断开连接，流程终止

```json
{
  "code":0,
  "resAc":"auth",
  "msg": "auth failed"
}
```

<br>

### 第 3 步：订阅

验证身份后，即可请求流。您可以在同一请求中请求多个流。

```json
{
  "ac":"subscribe",
  "params":"AAPL$US,TSLA$US",
  "types":"depth,quote"
}
```

> params：标的Code，支持订阅多个，注意：多市场订阅时，产品参数 = code & region，例如：AAPL$US\
> types: 订阅的类型，depth盘口、quote报价、tick成交

<br>

订阅成功返回内容。

```json
{
  "code":1,
  "resAc":"subscribe",
  "msg": "subscribe Successfully"
}
```

<br>

订阅失败返回内容。如下：分别是超出套餐计划最大数量，订阅参数错误。

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "exceeding the maximum subscription limit"
}
```

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "cannot be resolved action"
}
```

<br>

### 第 4 步：响应内容

iTick.org WebSocket 客户端必须能够每秒处理许多传入消息。由于 WebSocket 协议的性质，如果客户端从服务器获取消息的速度很慢，iTick.org 的服务器必须缓冲消息，并以客户端可以接收的速度发送消息。如果客户端长时间以太慢的速度消费消息， iTick.org的服务器端缓冲区可能会变得太大。如果发生这种情况，iTick.org 将终止 WebSocket 连接。如果您经常遇到这种情况，请考虑订阅较少的符号或频道。

订阅成功后数据按照如下内容发送。

#### 成交响应内容

```json
{
    "code": 1,
    "data": {
        "s": "AAPL.US",
        "ld": 225.215,
        "v": 16742235,
        "t": 1731689407000,
        "type": "tick"
    }
}
```

<br>

#### 报价响应内容

```json
{
    "code": 1,
    "data": {
        "s": "AAPL.US",
        "ld": 225.215,
        "o": 226.27,
        "h": 226.92,
        "l": 224.44,
        "t": 1731689407000,
        "v": 16742235,
        "tu": 3774688301.452,
        "ts": 0,
        "type": "quote"
    }
}
```

<br>

#### 盘口响应内容

```json
{
    "code": 1,
    "data": {
        "s": "AAPL.US",
        "a": [
            {
                "po": 1,
                "p": 3034.01,
                "v": 10.6023,
                "o": 10.6023
            },
            {
                "po": 2,
                "p": 3034.03,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 3,
                "p": 3034.18,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 4,
                "p": 3034.26,
                "v": 0.0018,
                "o": 0.0018
            },
            {
                "po": 5,
                "p": 3034.27,
                "v": 0.21,
                "o": 0.21
            }
        ],
        "b": [
            {
                "po": 1,
                "p": 3034,
                "v": 20.9758,
                "o": 20.9758
            },
            {
                "po": 2,
                "p": 3033.99,
                "v": 1.8408,
                "o": 1.8408
            },
            {
                "po": 3,
                "p": 3033.98,
                "v": 0.003,
                "o": 0.003
            },
            {
                "po": 4,
                "p": 3033.97,
                "v": 0.0065,
                "o": 0.0065
            },
            {
                "po": 5,
                "p": 3033.94,
                "v": 0.003,
                "o": 0.003
            }
        ],
        "type": "depth"
    }
}
```

<br>

#### K线响应内容

```json
{
    "code": 0,
    "msg": null,
    "data": {
        "s":"AAPL.US",
        "t":1,
        "k":
        {
            "tu": 157513,
            "c": 3059.39,
            "t": 1731660060000,
            "v": 28,
            "h": 3061.41,
            "l": 3055.24,
            "o": 3055.36
        }
     }
}
```

> t Kline 周期： 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月

<br>

### 第 5 步：保持心跳

客户端向服务器发送

```json
{
  "ac":"ping",
  "params":"1731688569840"
}
```

服务端向客户端发送

```json
{
  "resAc":"pong",
  "data": {"params":"1731688569840"}
}
```

> ping、pong的时间戳需要保持一致


# 指数报价

覆盖上证指数、沪深300、道琼斯、标普500、纳斯达克、恒生等主流核心指数，推送最新价、涨跌幅、成交量等关键数据，毫秒级低延迟。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## 指数 WebSocket 文档

iTick.org Indices WebSocket API 提供全球指数最新数据的流式访问。 您可以通过以操作形式发送指令来指定要使用的频道。当您订阅的频道中发生事件时，我们的 WebSockets 会发出事件以通知您。

我们的 WebSocket API 基于授权，授权可控制您可以连接到哪些 WebSocket 集群以及您可以访问哪些类型的数据。 您可以登录查看包含您的 API 密钥并根据您的授权进行个性化的示例。

### 第 1 步：连接

使用高级计划，您将能够使用单个连接到集群。如果另一个连接同时尝试连接到集群，则当前连接将被断开。 如果您需要同时连接到此集群的更多连接，您可以联系支持人员。

连接到集群：

```shell
wscat -c wss://api.itick.org/indices -H "token: 2abf6c0*************************dd8a1930a2f48ba14a"
```

连接后您将收到以下消息：

```json
{
  "code":1,
  "msg": "Connected Successfully"
}
```

<br>

### 第 2 步：验证

验证成功后，您将收到以下消息：

```json
{
  "code":1,
  "resAc":"auth",
  "msg": "authenticated"
}
```

验证失败，会断开连接，流程终止

```json
{
  "code":0,
  "resAc":"auth",
  "msg": "auth failed"
}
```

<br>

### 第 3 步：订阅

验证身份后，即可请求流。您可以在同一请求中请求多个流。

```json
{
  "ac":"subscribe",
  "params":"US100",
  "types":"quote"
}
```

> params：标的Code，支持订阅多个\
> types: 订阅的类型，depth盘口、quote报价、tick成交

<br>

订阅成功返回内容。

```json
{
  "code":1,
  "resAc":"subscribe",
  "msg": "subscribe Successfully"
}
```

<br>

订阅失败返回内容。如下：分别是超出套餐计划最大数量，订阅参数错误。

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "exceeding the maximum subscription limit"
}
```

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "cannot be resolved action"
}
```

<br>

### 第 4 步：响应内容

iTick.org WebSocket 客户端必须能够每秒处理许多传入消息。由于 WebSocket 协议的性质，如果客户端从服务器获取消息的速度很慢，iTick.org 的服务器必须缓冲消息，并以客户端可以接收的速度发送消息。如果客户端长时间以太慢的速度消费消息， iTick.org的服务器端缓冲区可能会变得太大。如果发生这种情况，iTick.org 将终止 WebSocket 连接。如果您经常遇到这种情况，请考虑订阅较少的符号或频道。

订阅成功后数据按照如下内容发送。

#### 成交响应内容

```json
{
    "code": 1,
    "data": {
        "s": "US100",
        "ld": 225.215,
        "v": 16742235,
        "t": 1731689407000,
        "type": "tick"
    }
}
```

<br>

#### 报价响应内容

```json
{
    "code": 1,
    "data": {
        "s": "US100",
        "ld": 225.215,
        "o": 226.27,
        "h": 226.92,
        "l": 224.44,
        "t": 1731689407000,
        "v": 16742235,
        "tu": 3774688301.452,
        "ts": 0,
        "type": "quote"
    }
}
```

<br>

#### 盘口响应内容

```json
{
    "code": 1,
    "data": {
        "s": "US100",
        "a": [
            {
                "po": 1,
                "p": 3034.01,
                "v": 10.6023,
                "o": 10.6023
            },
            {
                "po": 2,
                "p": 3034.03,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 3,
                "p": 3034.18,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 4,
                "p": 3034.26,
                "v": 0.0018,
                "o": 0.0018
            },
            {
                "po": 5,
                "p": 3034.27,
                "v": 0.21,
                "o": 0.21
            }
        ],
        "b": [
            {
                "po": 1,
                "p": 3034,
                "v": 20.9758,
                "o": 20.9758
            },
            {
                "po": 2,
                "p": 3033.99,
                "v": 1.8408,
                "o": 1.8408
            },
            {
                "po": 3,
                "p": 3033.98,
                "v": 0.003,
                "o": 0.003
            },
            {
                "po": 4,
                "p": 3033.97,
                "v": 0.0065,
                "o": 0.0065
            },
            {
                "po": 5,
                "p": 3033.94,
                "v": 0.003,
                "o": 0.003
            }
        ],
        "type": "depth"
    }
}
```

<br>

#### K线响应内容

```json
{
    "code": 0,
    "msg": null,
    "data": {
        "s":"US100",
        "t":1,
        "k":
        {
            "tu": 157513,
            "c": 3059.39,
            "t": 1731660060000,
            "v": 28,
            "h": 3061.41,
            "l": 3055.24,
            "o": 3055.36
        }
     }
}
```

> t Kline 周期： 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月

<br>

### 第 5 步：保持心跳

客户端向服务器发送

```json
{
  "ac":"ping",
  "params":"1731688569840"
}
```

服务端向客户端发送

```json
{
  "resAc":"pong",
  "data": {"params":"1731688569840"}
}
```

> ping、pong的时间戳需要保持一致


# 外汇报价

外汇实时报价 WebSocket API：全球主流货币对实时汇率推送，支持直盘/交叉盘报价、汇率中间价与流动性深度数据。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## 外汇 WebSocket 文档

iTick.org Forex WebSocket API 提供全球最新外汇数据的流式访问。 您可以通过以操作形式发送指令来指定要使用的频道。当您订阅的频道中发生事件时，我们的 WebSockets 会发出事件以通知您。

我们的 WebSocket API 基于授权，授权可控制您可以连接到哪些 WebSocket 集群以及您可以访问哪些类型的数据。 您可以登录查看包含您的 API 密钥并根据您的授权进行个性化的示例。

### 第 1 步：连接

使用高级计划，您将能够使用单个连接到集群。如果另一个连接同时尝试连接到集群，则当前连接将被断开。 如果您需要同时连接到此集群的更多连接，您可以联系支持人员。

连接到集群：

```shell
wscat -c wss://api.itick.org/forex -H "token: 2abf6c0*************************dd8a1930a2f48ba14a"
```

连接后您将收到以下消息：

```json
{
  "code":1,
  "msg": "Connected Successfully"
}
```

<br>

### 第 2 步：验证

验证成功后，您将收到以下消息：

```json
{
  "code":1,
  "resAc":"auth",
  "msg": "authenticated"
}
```

验证失败，会断开连接，流程终止

```json
{
  "code":0,
  "resAc":"auth",
  "msg": "auth failed"
}
```

<br>

### 第 3 步：订阅

验证身份后，即可请求流。您可以在同一请求中请求多个流。

```json
{
  "ac":"subscribe",
  "params":"EURUSD,GBPUSD",
  "types":"quote"
}
```

> params：标的Code，支持订阅多个\
> types: 订阅的类型，depth盘口、quote报价、tick成交

<br>

订阅成功返回内容。

```json
{
  "code":1,
  "resAc":"subscribe",
  "msg": "subscribe Successfully"
}
```

<br>

订阅失败返回内容。如下：分别是超出套餐计划最大数量，订阅参数错误。

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "exceeding the maximum subscription limit"
}
```

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "cannot be resolved action"
}
```

<br>

### 第 4 步：响应内容

iTick.org WebSocket 客户端必须能够每秒处理许多传入消息。由于 WebSocket 协议的性质，如果客户端从服务器获取消息的速度很慢，iTick.org 的服务器必须缓冲消息，并以客户端可以接收的速度发送消息。如果客户端长时间以太慢的速度消费消息， iTick.org的服务器端缓冲区可能会变得太大。如果发生这种情况，iTick.org 将终止 WebSocket 连接。如果您经常遇到这种情况，请考虑订阅较少的符号或频道。

订阅成功后数据按照如下内容发送。

#### 成交响应内容

```json
{
    "code": 1,
    "data": {
        "s": "EURUSD",
        "ld": 225.215,
        "v": 16742235,
        "t": 1731689407000,
        "type": "tick"
    }
}
```

<br>

#### 报价响应内容

```json
{
    "code": 1,
    "data": {
        "s": "EURUSD",
        "ld": 225.215,
        "o": 226.27,
        "h": 226.92,
        "l": 224.44,
        "t": 1731689407000,
        "v": 16742235,
        "tu": 3774688301.452,
        "ts": 0,
        "type": "quote"
    }
}
```

<br>

#### 盘口响应内容

```json
{
    "code": 1,
    "data": {
        "s": "EURUSD",
        "a": [
            {
                "po": 1,
                "p": 3034.01,
                "v": 10.6023,
                "o": 10.6023
            }
        ],
        "b": [
            {
                "po": 1,
                "p": 3034,
                "v": 20.9758,
                "o": 20.9758
            }
        ],
        "type": "depth"
    }
}
```

<br>

#### K线响应内容

```json
{
    "code": 0,
    "msg": null,
    "data": {
        "s":"EURUSD",
        "t":1,
        "k":
        {
            "tu": 157513,
            "c": 3059.39,
            "t": 1731660060000,
            "v": 28,
            "h": 3061.41,
            "l": 3055.24,
            "o": 3055.36
        }
     }
}
```

> t Kline 周期： 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月

<br>

### 第 5 步：保持心跳

客户端向服务器发送

```json
{
  "ac":"ping",
  "params":"1731688569840"
}
```

服务端向客户端发送

```json
{
  "resAc":"pong",
  "data": {"params":"1731688569840"}
}
```

> ping、pong的时间戳需要保持一致


# 加密货币实时行情 WebSocket API - 比特币/以太坊等数字货币实时推送

加密货币实时行情 WebSocket API：比特币、以太坊等主流数字货币实时价格推送，支持 K线、深度数据、交易对信息与多交易所聚合行情。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

## 加密货币 WebSocket 文档

iTick.org Crypto WebSocket API 提供全球主流加密货币最新数据的流式访问。 您可以通过以操作形式发送指令来指定要使用的频道。当您订阅的频道中发生事件时，我们的 WebSockets 会发出事件以通知您。

我们的 WebSocket API 基于授权，授权可控制您可以连接到哪些 WebSocket 集群以及您可以访问哪些类型的数据。 您可以登录查看包含您的 API 密钥并根据您的授权进行个性化的示例。

### 第 1 步：连接

使用高级计划，您将能够使用单个连接到集群。如果另一个连接同时尝试连接到集群，则当前连接将被断开。 如果您需要同时连接到此集群的更多连接，您可以联系支持人员。

连接到集群：

```shell
wscat -c wss://api.itick.org/crypto -H "token: 2abf6c0*************************dd8a1930a2f48ba14a"
```

连接后您将收到以下消息：

```json
{
  "code":1,
  "msg": "Connected Successfully"
}
```

<br>

### 第 2 步：验证

验证成功后，您将收到以下消息：

```json
{
  "code":1,
  "resAc":"auth",
  "msg": "authenticated"
}
```

验证失败，会断开连接，流程终止

```json
{
  "code":0,
  "resAc":"auth",
  "msg": "auth failed"
}
```

<br>

### 第 3 步：订阅

验证身份后，即可请求流。您可以在同一请求中请求多个流。

```json
{
  "ac":"subscribe",
  "params":"BTCUSDT,ETHUSDT",
  "types":"quote"
}
```

> params：标的Code，支持订阅多个\
> types: 订阅的类型，depth盘口、quote报价、tick成交

<br>

订阅成功返回内容。

```json
{
  "code":1,
  "resAc":"subscribe",
  "msg": "subscribe Successfully"
}
```

<br>

订阅失败返回内容。如下：分别是超出套餐计划最大数量，订阅参数错误。

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "exceeding the maximum subscription limit"
}
```

```json
{
  "code":0,
  "resAc":"subscribe",
  "msg": "cannot be resolved action"
}
```

<br>

### 第 4 步：响应内容

iTick.org WebSocket 客户端必须能够每秒处理许多传入消息。由于 WebSocket 协议的性质，如果客户端从服务器获取消息的速度很慢，iTick.org 的服务器必须缓冲消息，并以客户端可以接收的速度发送消息。如果客户端长时间以太慢的速度消费消息， iTick.org的服务器端缓冲区可能会变得太大。如果发生这种情况，iTick.org 将终止 WebSocket 连接。如果您经常遇到这种情况，请考虑订阅较少的符号或频道。

订阅成功后数据按照如下内容发送。

#### 成交响应内容

```json
{
    "code": 1,
    "data": {
        "s": "ETH_USDT",
        "ld": 225.215,
        "v": 16742235,
        "t": 1731689407000,
        "type": "tick"
    }
}
```

<br>

#### 报价响应内容

```json
{
    "code": 1,
    "data": {
        "s": "ETH_USDT",
        "ld": 3034,
        "t": 1731690011321,
        "v": 0.6186,
        "tu": 1876.832564,
        "ts": 0,
        "type": "quote"
    }
}
```

<br>

#### 盘口响应内容

```json
{
    "code": 1,
    "data": {
        "s": "ETH_USDT",
        "a": [
            {
                "po": 1,
                "p": 3034.01,
                "v": 10.6023,
                "o": 10.6023
            },
            {
                "po": 2,
                "p": 3034.03,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 3,
                "p": 3034.18,
                "v": 0.0017,
                "o": 0.0017
            },
            {
                "po": 4,
                "p": 3034.26,
                "v": 0.0018,
                "o": 0.0018
            },
            {
                "po": 5,
                "p": 3034.27,
                "v": 0.21,
                "o": 0.21
            }
        ],
        "b": [
            {
                "po": 1,
                "p": 3034,
                "v": 20.9758,
                "o": 20.9758
            },
            {
                "po": 2,
                "p": 3033.99,
                "v": 1.8408,
                "o": 1.8408
            },
            {
                "po": 3,
                "p": 3033.98,
                "v": 0.003,
                "o": 0.003
            },
            {
                "po": 4,
                "p": 3033.97,
                "v": 0.0065,
                "o": 0.0065
            },
            {
                "po": 5,
                "p": 3033.94,
                "v": 0.003,
                "o": 0.003
            }
        ],
        "type": "depth"
    }
}
```

<br>

#### K线响应内容

```json
{
    "code": 0,
    "msg": null,
    "data": {
        "s":"ETH_USDT",
        "t":1,
        "k":
        {
            "tu": 157513,
            "c": 3059.39,
            "t": 1731660060000,
            "v": 28,
            "h": 3061.41,
            "l": 3055.24,
            "o": 3055.36
        }
     }
}
```

> t Kline 周期： 周期 1分钟、2五分钟、3十分钟、4三十分钟、5一小时、6两小时、7四小时、8一天、9一周、10一月

<br>

### 第 5 步：保持心跳

客户端向服务器发送

```json
{
  "ac":"ping",
  "params":"1731688569840"
}
```

服务端向客户端发送

```json
{
  "resAc":"pong",
  "data": {"params":"1731688569840"}
}
```

> ping、pong的时间戳需要保持一致


# 对接说明

ITick FIX API 对接完整说明：FIX 协议配置、会话管理、订单流与行情数据接入指南，专为机构交易与高频交易设计。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

> 📘 支持全部美股、港股、A股、全球外汇、贵金属、指数以及加密货币等，具体其他地区的股票支持请联系客服咨询
>
> Telegram: [iticksupport](https://t.me/iticksupport)
>
> WhatsApp: [+852 59046663](https://wa.me/85259046663)


# QLib｜开源AI量化投资平台｜外汇股票API

学习如何将 ITick 外汇、股票实时数据 API 集成到 Qlib 开源 AI 量化投资平台，构建基于机器学习的量化模型与回测系统。

随着 AI 技术的不断发展，其应用领域得到进一步扩展。同时，基于外汇API、贵金属API、股票API等量化投资凭借其科学、系统的决策方式，在金融领域中扮演着愈发重要的角色。QLib，作为一个专注于量化投资研究的开源项目，就利用了 AI 技术，结合iTick的免费外汇API、股票API数据接口，为广大研究者和从业人员提供了强大的量化投资工具支持。

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2FHj7tTl63sXdAg1TYyrjM%2Fframework-abstract.jpg?alt=media&amp;token=b3270ece-d148-45e3-962b-6a6720d833b8" alt=""><figcaption></figcaption></figure>

## QLib 简介

QLib 是一个由微软开源的量化投资研究平台，其代码仓库地址为 <https://github.com/microsoft/qlib> 。它旨在为量化投资领域的研究者和从业者提供一个高效、便捷的工具，帮助他们构建完整的量化研究工作流程，快速验证自己的投资想法。

QLib 的主要目的，是利用人工智能技术在量化投资领域创造价值，并赋能研究，涵盖从投资思路探索到产品实施的全过程。Qlib 支持多种机器学习建模范式，包括监督学习、市场动态建模和强化学习。QLib 包含了数据处理、模型训练、和回测的完整机器学习流程，并且覆盖了量化投资的整个链条，包括：阿尔法收益寻找、风险建模、投资组合优化，和交易执行。

## iTick 简介

iTick 是一家为金融科技公司和开发者提供可靠数据源 APIs 的数据代理机构。其官网地址：<https://itick.org> 。提供外汇 API、股票 API、加密货币 API、指数 API 等，能满足金融科技公司和开发者在不同金融领域的数据需求，帮助构建创新的交易和分析工具。目前为个人量化开发者提供免费套餐，基本可以满足其日常使用需求，降低了个人开发者的开发成本和数据获取门槛。可以直接进入官网文档了解，<https://doc.itick.org>

## 使用

### 请求K线数据

`python -m pip install requests`

```
"""
**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求
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)
```

### QLib 使用

QLib 要求 Python 3.8+，并建议使用 Conda 进行环境管理。使用 pip 安装 pyqlib 库：

```
pip install pyqlib
pip install numpy
pip install --upgrade cython
​
git clone https://github.com/microsoft/qlib.git && cd qlib
pip install .  # `pip install -e .[dev]` is recommended for development. check details in docs/developer/code_standard_and_dev_guide.rst
```

安装完成后，可以使用获取的数据来开始进行使用，运行以下命令：

```
# get 1d data
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data --region cn
​
# get 1min data
python -m qlib.run.get_data qlib_data --target_dir ~/.qlib/qlib_data/cn_data_1min --region cn --interval 1min
```

数据准备好后，可以运行 Quant Research Workflow。使用以下命令：

```
 cd examples  # Avoid running program under the directory contains `qlib`
 qrun benchmarks/LightGBM/workflow_config_lightgbm_Alpha158.yaml
```

运行后，能够得到以下输出，这是对投资数据的一个初步分析结果：

```
'The following are analysis results of the excess return without cost.'
                       risk
mean               0.000708
std                0.005626
annualized_return  0.178316
information_ratio  1.996555
max_drawdown      -0.081806
'The following are analysis results of the excess return with cost.'
                       risk
mean               0.000512
std                0.005626
annualized_return  0.128982
information_ratio  1.444287
max_drawdown      -0.091078
```

## 总结

QLib 作为一个强大的量化投资研究平台，为量化投资领域的研究者和从业者提供了丰富的功能和便捷的工具。它的灵活性和易用性，使得用户可以快速构建量化研究工作流程，验证自己的投资想法。

QLib 可以广泛应用于股票、期货、基金等金融领域的量化投资研究，帮助投资者进行风险控制、资产配置、投资决策等。同时，随着 AI 大模型技术的不断演进，QLib 将能提供越来越强的量化投资分析和研究能力。\
\
原始文章：<https://www.itick.org/blog/quant-tools/qlib-itick-forex-stock-integration>


# 解锁 AI 量化新境界：Qbot 携手 iTick

解锁 AI 量化新境界：QBot 量化机器人如何与 ITick 金融数据 API 深度协作，实现自动化交易策略开发与实时市场数据分析。

在量化投资的汹涌浪潮中，你是否渴望拥有一个强大且便捷的工具，助你乘风破浪，驶向财富的彼岸？如今，Qbot 与 iTick 强强联合，为广大投资者和开发者打造出一个前所未有的 AI 量化生态系统。

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2FTb8mFtILNRx27FBlgqnw%2Frelationship_analyse.png?alt=media&amp;token=102966a7-1d14-47e3-b2ed-5c1c71b2f98f" alt=""><figcaption></figcaption></figure>

### Qbot：量化投研的全能引擎

Qbot 作为免费的量化投研平台，宛如一位贴心的投资伙伴，为你提供全闭环投资流程。从数据获取的源头，到交易策略开发、策略回测、模拟交易，直至最终实盘交易，每一步都精心呵护。在实盘接入前，Qbot 准备了股票、基金评测和策略回测环节，让你在模拟环境中反复打磨交易策略。其近乎实盘的时延、滑点仿真，犹如为你戴上一副虚拟现实眼镜，提前体验真实交易战场，确保你的策略在实战中经得起考验。

Qbot 不仅功能全面，在技术架构上也独具匠心。平台提供 GUI 前端 / 客户端（部分功能也支持网页），无论你是喜欢桌面端操作的稳定，还是钟情于网页端的便捷，Qbot 都能满足你的需求。后端则专注于数据处理、交易调度，通过事件驱动的交易流程，确保每一个交易指令都能迅速、准确地执行。在策略研究方面，Qbot 紧跟时代步伐，尤其强调机器学习、强化学习的 AI 策略，结合多因子模型，致力于为你提高收益比，让你的投资决策更具科学性和前瞻性。

### iTick：可靠数据的源泉

巧妇难为无米之炊，在量化投资领域，数据就是那至关重要的 “米”。iTick 作为专业的数据代理机构，深知数据的价值。它为金融科技公司和开发者提供可靠数据源 APIs，宛如一座数据宝库，官网[https://itick.or](https://itick.org/)[g](https://itick.org/)便是打开宝库的大门。

在这里，你能找到外汇 API、股票 API、加密货币 API、指数 API 等丰富的数据接口，满足你在不同金融领域的数据需求。无论是构建创新的交易工具，还是进行深入的市场分析，iTick 的数据都能成为你的得力助手。更令人惊喜的是，iTick 为个人量化开发者提供免费套餐，基本能满足日常使用需求，大大降低了个人开发者的开发成本和数据获取门槛。只需轻轻点击官网文档[https://doc.iti](https://doc.itick.org/)[ck.or](https://doc.itick.org/)[g](https://doc.itick.org/)，详细的数据使用指南便呈现在你眼前，让你轻松上手。

### 请求K线数据

`python -m pip install requests`

```
"""
**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求
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)
```

### 携手共进，开启 AI 量化新篇章

当 Qbot 的强大投研功能与 iTick 的可靠数据相遇，一场 AI 量化的革命就此拉开帷幕。Qbot 凭借其先进的策略研究体系，能够充分挖掘 iTick 提供的海量数据价值。基于机器学习和强化学习的 AI 策略，在多因子模型的加持下，能够对市场动态做出更敏锐的反应，精准捕捉投资机会，提高投资收益。

对于开发者而言，Qbot 与 iTick 的结合意味着更高效的开发环境。你可以在 Qbot 平台上利用 iTick 提供的数据，快速开发、回测和优化交易策略，无需再为数据的获取和整理耗费大量时间和精力。而对于投资者来说，这一组合带来的是更科学、更精准的投资决策，让你的资产在复杂多变的市场中稳健增长。

不要犹豫，立即加入 Qbot 与 iTick 构建的 AI 量化世界，开启你的财富增长之旅。在这个充满机遇与挑战的量化投资时代，让 Qbot 与 iTick 成为你最坚实的后盾，助你实现投资梦想！

原始文章：<https://www.itick.org/blog/data-solutions/qlib-itick-python-tutorial>


# iTick 外汇股票报价 API 服务与 DeepSeek-R1 大模型深度融合：构建智能量化投资新生态

学习如何将 ITick 外汇/股票实时报价 API 与 DeepSeek R1 大模型深度结合，构建智能量化交易策略，实现 AI 驱动的金融数据分析与自动化决策。

在全球金融市场波动率加剧的背景下，传统量化投资体系正面临数据维度单一、策略迭代滞后、决策响应缓慢等痛点。iTick 外汇股票报价 API 服务与 DeepSeek-R1 大模型的深度整合，通过 "数据 + 算法 + 场景" 三位一体的创新架构，为量化投资领域带来了革命性突破。

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2FVfZa1NzjA6ZZzoxgi0ga%2Fdeepseek.png?alt=media&amp;token=8684dcfc-1311-4c2d-95e7-ac3a3077d9a4" alt=""><figcaption></figcaption></figure>

### 一、全维度数据生态构建

基于 iTick API 的全品种实时数据接入能力，系统可获取全球 200 多个交易所的外汇、股票、期权等超千万级 Tick 数据，并整合 Wind 客户端 API 提供的 800 万宏观经济指标、产业链数据及新闻舆情。通过 DeepSeek-R1 的异构数据融合引擎，采用注意力机制动态分配数据权重，实现社交媒体情绪指数与基本面数据的相关性提升至 0.87。系统构建的 78 维数据立方体，包含卫星遥感、供应链物流等另类数据源，例如通过海关进出口数据流优化大宗商品策略，使夏普比率提升 0.8 个百分点。

### 请求K线数据

`python -m pip install requests`

```
"""
**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求
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)
```

**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求 <https://github.com/itick-org> <https://itick.org>

### 二、智能策略生成引擎

在算法层面，DeepSeek-R1 采用强化学习与遗传算法结合的三重进化机制：基于动态贝叶斯网络实时修正决策树权重，通过量子计算模拟器将订单执行延迟压缩至 0.7 微秒，时空压缩算法在高频数据流中识别微观结构模式，使信号生成效率提升 3 倍。在飞书多维表格平台上，通过 AI 字段捷径实现批量化策略生成，输入股票代码即可自动生成包含波动率预测、资金流分析的多维度报告，并支持 PDF 格式自动推送至交易团队。某私募机构测试显示，该系统每周可生成 2000 个策略变体，其中 23% 持续产生超额收益。

### 三、自适应风险管理体系

针对极端市场环境，系统构建了多层次风控架构：通过实时压力测试模块，可在市场异动前 15 分钟发出预警；量子蒙特卡洛模拟算法将尾部风险计算速度提升 20 倍，资本回撤控制精度达 0.03%。在策略验证环节，引入 Walk-Forward 优化法和动态特征选择机制，使过拟合风险降低 38%。某量化产品在 2024 年一季度半导体行情中，较传统方法提前 9 个交易日完成策略调整，回撤幅度收窄 37%。

### 四、效率革命与成本优化

依托飞书多维表格的批量化处理能力，DeepSeek-R1 的调用效率提升 120 倍。用户可通过 AI 字段捷径实现自动化任务流：例如设置开盘价高于成本价自动标红警示，或批量生成上市公司电话会议的多模态分析报告。系统初始提供 100 万 Token 免费额度，超额部分可便捷绑定火山引擎账号扩展资源。在国元证券等机构的实践中，该架构使投研报告生成周期从 48 小时缩短至 2 小时，信息处理成本降低 65%。

这种深度融合正在重塑量化投资范式：从上海某对冲基金的实践来看，通过整合 iTick API 的实时数据与 DeepSeek-R1 的智能决策，其组合策略在 2025 年第一季度实现了 18.7% 的绝对收益，最大回撤仅 2.3%。随着更多金融机构完成本地化部署（如华为昇腾架构的智能算力平台），基于 "数据 + 模型 + 场景" 的 AI 量化生态正在加速形成，为资产管理行业开启智能化新纪元。

原始文章：<https://www.itick.org/blog/quant-ecosystem/itick-deepseek/ai-trading-integration-guide>


# RSI 量化策略实战指南：基于 iTick 外汇贵金属股票报价API的 Python 实现

RSI 指标量化策略实战指南：基于 ITick 外汇、贵金属、股票报价 API 的 Python 实现，包含完整策略开发、回测与优化步骤。

在量化交易领域，**iTick 报价 API**凭借其多市场覆盖与高性能特性，成为策略开发者的核心基础设施。其**外汇 API**支持全球主流货币对（如 EURUSD、USDJPY）的实时行情推送，提供 Tick 级 Bid/Ask 深度数据与波动率指标；**股票 API**则覆盖 A 股、港股及美股市场，包含 Level-2 逐笔成交和十档盘口信息。通过统一的 RESTful 接口，开发者可免费获取标准化 OHLCV 数据，实现外汇、股票等多资产策略的快速开发。iTick 的**免费报价 API**不仅支持历史数据回溯（最长 15 年日线级），还提供实时数据流用于策略验证，特别适合 RSI 等技术指标策略的实盘部署。其低延迟特性（平均响应时间 < 10ms）与全市场覆盖能力，已助力数千名量化交易员完成策略落地。

### 一、策略原理

相对强弱指标（Relative Strength Index, RSI）是由 Welles Wilder 提出的经典技术指标，通过计算价格波动的幅度衡量市场超买 / 超卖状态。RSI 取值范围 0-100，常用判断标准：

* RSI > 70：超买，潜在反转信号
* RSI < 30：超卖，潜在反转信号
* 结合趋势线或价格突破增强信号有效性

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2F1xBQ2CnvJPNLHJZeBE10%2Fhow-to-use-rsi-to-determine-overbought-oversold-conditions.jpg?alt=media&amp;token=d0e20a0d-8aa0-49a3-b1cb-d920d71d7515" alt=""><figcaption></figcaption></figure>

### 二、数据准备

本文使用 iTick 金融数据平台提供的高频数据，支持 A 股、期货、数字货币等多市场。安装数据接口库：

```
"""
**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求
https://github.com/itick-org
https://itick.org
"""
​
pip install itrade  # iTick数据接口
```

数据获取示例（以沪深 300 指数期货为例）：

```
from itrade import quote
​
# 获取历史数据
df = quote.get_kline(
    symbol="IF2303",
    start_date="2023-01-01",
    end_date="2024-01-01",
    interval="1min"
)
​
# 数据预处理
df = df[['datetime', 'open', 'high', 'low', 'close', 'volume']]
df.set_index('datetime', inplace=True)
```

### 三、策略实现

#### 1. RSI 计算函数

```
import pandas as pd
import numpy as np
​
def calculate_rsi(df, window=14):
    delta = df['close'].diff(1)
    gain = delta.where(delta > 0, 0)
    loss = -delta.where(delta < 0, 0)
    
    avg_gain = gain.rolling(window=window, min_periods=window).mean()
    avg_loss = loss.rolling(window=window, min_periods=window).mean()
    
    rs = avg_gain / avg_loss
    rsi = 100 - (100 / (1 + rs))
    df[f'RSI_{window}'] = rsi
    return df
```

#### 2. 信号生成逻辑

```
def generate_signals(df, rsi_window=14):
    df = calculate_rsi(df, rsi_window)
    
    # 金叉/死叉信号
    df['signal'] = 0
    df.loc[df[f'RSI_{rsi_window}'] > 70, 'signal'] = -1  # 超卖区做空
    df.loc[df[f'RSI_{rsi_window}'] < 30, 'signal'] = 1   # 超买区做多
    
    # 趋势过滤（可选）
    df['ma50'] = df['close'].rolling(50).mean()
    df.loc[df['ma50'] < df['ma50'].shift(1), 'signal'] = 0  # 下降趋势不做多
    df.loc[df['ma50'] > df['ma50'].shift(1), 'signal'] = 0  # 上升趋势不做空
    
    return df
```

### 四、策略回测

#### 1. 基础回测框架

```
def backtest_strategy(df):
    df['position'] = df['signal'].diff()
    
    # 计算交易收益
    df['returns'] = np.log(df['close'] / df['close'].shift(1))
    df['strategy_returns'] = df['position'] * df['returns']
    
    # 计算累计收益
    df['cumulative_returns'] = df['strategy_returns'].cumsum()
    
    # 计算年化收益、夏普比率等指标
    total_days = len(df) / 252
    sharpe_ratio = np.sqrt(252) * (df['strategy_returns'].mean() / df['strategy_returns'].std())
    
    return df, sharpe_ratio
```

#### 2. 回测结果分析

```
# 执行回测
df, sharpe = backtest_strategy(df)
​
print(f"策略夏普比率: {sharpe:.2f}")
print(f"最大回撤: {max_drawdown(df['cumulative_returns']):.2%}")
​
# 可视化
import matplotlib.pyplot as plt
plt.figure(figsize=(12,6))
plt.plot(df.index, df['cumulative_returns'], label='策略收益')
plt.plot(df.index, df['close'].pct_change().cumsum(), label='基准收益')
plt.legend()
plt.show()
```

### 五、策略优化方向

1. **参数优化**：使用 GridSearchCV 寻找最优 RSI 周期和阈值组合
2. **多时间框架**：结合日线与小时线信号提高胜率
3. **风险控制**：设置动态止损（如 ATR 通道止损）
4. **资金管理**：基于波动率调整仓位

### 六、iTick 数据优势

1. **全市场覆盖**：支持 A 股、期货、期权、数字货币等多品种
2. **高频低延迟**：提供 Level-2 行情和 Tick 级数据
3. **便捷接入**：支持 Python/R/Matlab 多语言接口
4. **历史数据完整**：提供十年以上历史行情数据

### 七、注意事项

1. RSI 在趋势市场中可能出现钝化，建议结合趋势指标使用
2. 需定期对策略参数进行再优化
3. 实盘需考虑滑点和流动性风险
4. 建议使用 iTick 的实时数据流进行策略验证

通过本文的代码框架，读者可以快速实现基于 RSI 的量化策略，并结合 iTick 的专业金融数据进行策略开发与验证。实际应用中需根据具体市场环境调整参数和风险控制规则。

原文出自：<https://itick.org/blog/rsi-strategy-hands-on-guide-with-itick-data-python>


# 双均线量化策略实战指南：基于 iTick 外汇API、股票API报价源的 Python 实现

双均线量化策略实战教程：基于 ITick 外汇 API、股票 API 与贵金属报价源，实现多品种趋势跟踪策略的完整开发流程。

在量化交易领域，**iTick 报价 API**凭借其强大的多市场覆盖能力，已成为专业交易员的首选数据解决方案。其**外汇 API**支持全球主要货币对（如 EURUSD、GBPUSD）的毫秒级行情推送，包含 Bid/Ask 深度报价和实时波动率数据；**股票 API**则覆盖 A 股、港股及美股市场，提供 Level-2 逐笔成交和十档盘口信息。通过统一的 RESTful 接口，开发者可轻松获取标准化的 OHLCV 数据，实现外汇、股票等多资产策略的无缝适配。凭借高频低延迟特性，iTick API 特别适合日内交易策略开发，其历史数据回溯功能支持长达 15 年的日线级数据下载，为策略回测提供可靠支撑。

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2FBQgdTNtrQfb905HnQ41q%2Ftwo-ma-strategy-itick-based-python-tutorial.png?alt=media&amp;token=5d2fb8ea-5011-4474-8307-21fdbb68ad44" alt=""><figcaption></figcaption></figure>

### 一、策略原理

双均线策略通过长短周期均线的交叉判断趋势方向：

1. **金叉信号**：短期均线上穿长期均线 → 做多
2. **死叉信号**：短期均线下穿长期均线 → 做空
3. **趋势过滤**：结合成交量或波动率指标增强信号有效性

### 二、数据准备

使用 iTick 报价源获取多市场数据：

```
"""
**iTick**：是一家数据代理机构，为金融科技公司和开发者提供可靠的数据源APIs，涵盖外汇API、股票API、加密货币API、指数API等，帮助构建创新的交易和分析工具，目前有免费的套餐可以使用基本可以满足个人量化开发者需求
https://github.com/itick-org
https://itick.org
"""
​
pip install itrade  # iTick数据接口
```

数据获取示例（以 EURUSD 外汇对和贵州茅台股票为例）：

```
from itrade import quote
​
# 获取外汇历史数据
eurusd_df = quote.get_kline(
    symbol="EURUSD",
    start_date="2023-01-01",
    interval="15min",
    market="forex"
)
​
# 获取股票历史数据
茅台_df = quote.get_kline(
    symbol="600519.SH",
    start_date="2023-01-01",
    interval="30min",
    market="stock"
)
```

### 三、策略实现

#### 1. 双均线计算模块

```
import talib
​
def calculate_ma(df, short_window=20, long_window=60):
    # 计算简单移动平均线
    df['MA_SHORT'] = talib.SMA(df['close'], short_window)
    df['MA_LONG'] = talib.SMA(df['close'], long_window)
    
    # 计算交叉信号
    df['cross_long'] = df['MA_SHORT'] > df['MA_LONG']
    df['cross_short'] = df['MA_SHORT'] < df['MA_LONG']
    
    # 生成交易信号
    df['signal'] = 0
    df.loc[df['cross_long'] & df['cross_long'].shift(1).eq(False), 'signal'] = 1  # 金叉
    df.loc[df['cross_short'] & df['cross_short'].shift(1).eq(False), 'signal'] = -1  # 死叉
    
    return df
```

#### 2. 多市场交易逻辑

```
def execute_strategy(df, symbol, account_balance=100000):
    # 初始化持仓与资金
    position = 0
    equity = account_balance
    
    # 遍历交易信号
    for i in range(1, len(df)):
        current_signal = df['signal'].iloc[i]
        prev_signal = df['signal'].iloc[i-1]
        
        if current_signal == 1 and prev_signal != 1:
            # 开多仓（外汇使用保证金交易）
            if symbol.startswith("EURUSD"):
                position = 1  # 1标准手
                equity -= df['close'].iloc[i] * 100000  # 假设1标准手保证金
            else:
                # 股票交易（1手=100股）
                shares = int(equity * 0.9 / df['close'].iloc[i]) // 100 * 100
                position = shares
                equity -= shares * df['close'].iloc[i]
        
        elif current_signal == -1 and prev_signal != -1:
            # 开空仓（股票需支持融券）
            if symbol.startswith("600519"):
                shares = int(equity * 0.9 / df['close'].iloc[i]) // 100 * 100
                position = -shares
                equity += shares * df['close'].iloc[i]  # 融券卖出获得资金
        
        # 平仓逻辑（此处简化处理，实际需考虑手续费）
        if prev_signal != current_signal and position != 0:
            equity += position * df['close'].iloc[i]
            position = 0
    
    return equity
```

### 四、策略回测

#### 1. 多品种回测框架

```
def backtest_multiple_symbols(symbols):
    results = {}
    for symbol in symbols:
        # 获取数据并处理
        df = quote.get_kline(symbol, start_date="2023-01-01", interval="30min")
        df = calculate_ma(df)
        
        # 执行回测
        final_equity = execute_strategy(df, symbol)
        returns = (final_equity - 100000) / 100000 * 100
        
        results[symbol] = {
            "final_equity": final_equity,
            "returns": returns
        }
    return results
```

#### 2. 回测结果示例

```
symbols = ["EURUSD", "600519.SH", "XAUUSD"]
results = backtest_multiple_symbols(symbols)
​
print("策略回测结果：")
for symbol, res in results.items():
    print(f"{symbol}: 最终权益{res['final_equity']:.2f}元，收益率{res['returns']:.2f}%")
```

### 五、策略优化方向

1. **参数优化**：使用遗传算法搜索最优均线组合
2. **多资产配置**：外汇 + 股票 + 商品组合降低风险
3. **动态仓位管理**：基于 ATR 调整头寸规模
4. **机器学习增强**：加入成交量加权均线等特征

### 六、iTick API 优势

1. **多市场统一接口**：外汇、股票、期货使用相同数据格式
2. **高频数据支持**：提供毫秒级 Tick 数据与历史 K 线
3. **实时行情推送**：WebSocket 接口实现低延迟数据更新
4. **模拟交易环境**：支持实盘 API 与回测框架无缝切换

### 七、注意事项

1. 外汇交易需注意杠杆风险（通常 1:100\~1:500）
2. 股票融券交易受标的池限制
3. 建议使用 iTick 的模拟交易接口进行策略验证
4. 需根据市场特性调整滑点和手续费模型

通过本文的代码框架，可快速构建基于双均线的多市场量化策略。实际部署时建议结合 iTick 的实时数据流与交易网关，实现策略的自动化执行与风险监控。

原文出自：<https://itick.org/blog/two-ma-strategy-itick-based-python-tutorial>


# 基于 EMA12 指标结合 iTick 外汇报价 API 、股票报价API、指数报价API的量化策略编写与回测

基于 EMA12 技术指标，结合 ITick 外汇报价 API、股票报价 API 与指数报价 API，构建多市场量化交易策略的完整 Python 实现教程。

iTick 提供了强大的外汇报价 API、股票报价 API 和指数报价 API 服务，为量化策略的开发提供了丰富的数据支持。本文将详细介绍如何使用 Python 结合 EMA12 指标和 iTick 的报价 API 来构建一个简单的量化交易策略，并对该策略进行回测。

<figure><img src="https://501528316-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTOQEeS15EiMiMAugoMqq%2Fuploads%2Frwc1SyTB3TKrvZ7WHd7t%2Fitick-ema12-strategy-backtesting-tutorial.webp?alt=media&amp;token=a4576bdf-cd14-4965-90c2-b36e8e362ff9" alt=""><figcaption></figcaption></figure>

### 一、引言

在量化交易领域，技术指标是构建交易策略的重要基础。iTick 提供了强大的外汇报价 API、股票报价 API 和指数报价 API 服务，为量化策略的开发提供了丰富的数据支持。本文将详细介绍如何使用 Python 结合 EMA12 指标和 iTick 的报价 API 来构建一个简单的量化交易策略，并对该策略进行回测。指数移动平均线（Exponential Moving Average，EMA）是一种广泛应用的技术指标，它能够更及时地反映价格的最新变化趋势。EMA12 即 12 周期的指数移动平均线，常被用于短期趋势的判断。

### 二、准备工作

#### 2.1 安装必要的库

首先，确保你已经安装了以下 Python 库：

```
pip install requests pandas numpy matplotlib
```

#### 2.2 获取 iTick API 密钥

你需要在 iTick 平台注册账号并获取 API 密钥，以便能够调用其报价 API。

#### 2.3 导入必要的库

```
import requests
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
```

### 三、使用 iTick API 获取数据

#### 3.1 定义 API 请求函数

```
def get_quote_data(symbol, api_key, start_date, end_date, interval):
    url = f"https://api.itick.com/quote?symbol={symbol}&api_key={api_key}&start_date={start_date}&end_date={end_date}&interval={interval}"
    try:
        response = requests.get(url)
        response.raise_for_status()
        data = response.json()
        df = pd.DataFrame(data['data'])
        df['timestamp'] = pd.to_datetime(df['timestamp'])
        df.set_index('timestamp', inplace=True)
        return df
    except requests.RequestException as e:
        print(f"请求出错: {e}")
        return None
    except KeyError as e:
        print(f"数据解析出错: {e}")
        return None
```

#### 3.2 获取数据示例

```
api_key = "your_api_key"
symbol = "EURUSD"  # 外汇交易对，也可以替换为股票代码或指数代码
start_date = "2023-01-01"
end_date = "2023-12-31"
interval = "1d"  # 数据间隔，这里设置为日线数据
​
data = get_quote_data(symbol, api_key, start_date, end_date, interval)
if data is not None:
    print(data.head())
```

### 四、计算 EMA12 指标

#### 4.1 定义计算 EMA12 的函数

```
def calculate_ema12(data):
    data['ema12'] = data['close'].ewm(span=12, adjust=False).mean()
    return data
```

#### 4.2 计算 EMA12 并展示结果

```
data = calculate_ema12(data)
if data is not None:
    print(data[['close', 'ema12']].head())
```

### 五、构建交易策略

#### 5.1 定义交易信号生成函数

```
def generate_signals(data):
    data['signal'] = 0
    data.loc[data['close'] > data['ema12'], 'signal'] = 1  # 买入信号
    data.loc[data['close'] < data['ema12'], 'signal'] = -1  # 卖出信号
    data['position'] = data['signal'].diff()
    return data
```

#### 5.2 生成交易信号并展示结果

```
data = generate_signals(data)
if data is not None:
    print(data[['close', 'ema12', 'signal', 'position']].head())
```

### 六、策略回测

#### 6.1 定义回测函数

```
def backtest(data):
    initial_capital = float(100000.0)
    positions = pd.DataFrame(index=data.index).fillna(0.0)
    positions[symbol] = 100 * data['signal']  # 假设每次交易 100 单位

    portfolio = positions.multiply(data['close'], axis=0)
    pos_diff = positions.diff()

    portfolio['holdings'] = (positions.multiply(data['close'], axis=0)).sum(axis=1)
    portfolio['cash'] = initial_capital - (pos_diff.multiply(data['close'], axis=0)).sum(axis=1).cumsum()
    portfolio['total'] = portfolio['cash'] + portfolio['holdings']
    portfolio['returns'] = portfolio['total'].pct_change()

    return portfolio
```

#### 6.2 进行回测并展示结果

```
portfolio = backtest(data)
if portfolio is not None:
    print(portfolio[['holdings', 'cash', 'total', 'returns']].head())
```

### 七、策略可视化

#### 7.1 绘制价格和 EMA12 曲线

```
if data is not None:
    plt.figure(figsize=(12, 6))
    plt.plot(data['close'], label='Close Price')
    plt.plot(data['ema12'], label='EMA12')
    plt.title(f'{symbol} Close Price and EMA12')
    plt.xlabel('Date')
    plt.ylabel('Price')
    plt.legend()
    plt.show()
```

#### 7.2 绘制策略净值曲线

```
if portfolio is not None:
    plt.figure(figsize=(12, 6))
    plt.plot(portfolio['total'], label='Portfolio Value')
    plt.title('Portfolio Value over Time')
    plt.xlabel('Date')
    plt.ylabel('Value')
    plt.legend()
    plt.show()
```

### 八、总结

本文详细介绍了如何使用 Python 结合 EMA12 指标和 iTick 的外汇报价 API、股票报价 API、指数报价 API 服务来构建一个简单的量化交易策略，并对该策略进行了回测和可视化。通过以上步骤，你可以根据不同的交易品种和数据间隔，灵活调整策略参数，进一步优化策略。

需要注意的是，实际的量化交易还需要考虑交易成本、滑点、风险控制等因素，本文仅为一个基础的示例，旨在帮助你入门量化策略的开发和回测。在实际应用中，你可以结合更多的技术指标和交易规则，构建更加复杂和有效的量化交易策略。

原文出自：<https://itick.org/blog/itick-ema12-strategy-backtesting-tutorial>

<br>


# 如何开通和续费套餐计划

ITick API 升级与迁移指南：了解 API 版本更新、接口变更、数据格式升级及平滑迁移方案，确保您的应用稳定运行。

#### <mark style="color:red;">此文档已停止维护，请使用新的地址</mark>  [<mark style="color:red;">https://docs.itick.org/</mark>](https://docs.itick.org/)

请联系24小时客服开通

Telegram: [iticksupport](https://t.me/iticksupport)\
WhatsApp: [+852 59046663](https://wa.me/85259046663)


