# 量化入门示例

### 概述

面向量化交易初学者的教学示例集，包含 6 个由浅入深的 Python 示例和一个 Jupyter Notebook 交互教程。所有示例基于 Infoway Python SDK 构建。

| 项目        | 说明                                                                                        |
| --------- | ----------------------------------------------------------------------------------------- |
| Python 版本 | 3.9+                                                                                      |
| 依赖        | `infoway-sdk`、`pandas`、`matplotlib`、`jupyter`                                             |
| GitHub    | [infoway-api/infoway-quant-starter](https://github.com/infoway-api/infoway-quant-starter) |

### 安装

```bash
git clone https://github.com/infoway-api/infoway-quant-starter.git
cd infoway-quant-starter
pip install -r requirements.txt
```

### 示例列表

#### 01 — 实时行情监控

```bash
python examples/01_realtime_monitor.py
```

通过 WebSocket 实时接收并展示成交数据，学习：

* WebSocket 连接与事件回调
* 实时数据流处理
* 终端实时展示

#### 02 — K线数据下载

```bash
python examples/02_kline_download.py
```

批量下载 K 线历史数据并导出为 CSV，学习：

* REST API 批量请求
* 数据清洗与格式化
* CSV 文件导出

#### 03 — 均线交叉策略

```bash
python examples/03_moving_average.py
```

经典双均线交叉回测策略，学习：

* 移动平均线计算
* 交易信号生成
* 收益率与最大回撤计算
* matplotlib 图表绘制

#### 04 — 加密货币套利扫描

```bash
python examples/04_crypto_arbitrage.py
```

跨报价货币的价差扫描器，学习：

* 多品种同时监控
* 价差计算与套利机会检测
* 实时数据对比分析

#### 05 — 市场热力图

```bash
python examples/05_market_heatmap.py
```

板块热力图可视化，学习：

* 板块数据获取与处理
* 终端彩色热力展示
* matplotlib 热力图绘制

#### 06 — 多市场扫描器

```bash
python examples/06_multi_market_scanner.py
```

多市场温度异常检测，学习：

* 多市场数据并行获取
* 温度/情绪指标分析
* 异常信号识别

#### Jupyter Notebook 入门教程

```bash
jupyter notebook notebooks/getting_started.ipynb
```

交互式教程，涵盖：

* SDK 安装与客户端创建
* 实时行情获取
* K线数据查询与图表绘制
* 市场温度分析

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.infoway.io/sdk-and-tools/quant-starter.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
