Shioaji Taiwan financial trading API guide. Use when trading stocks/futures/options on Taiwan markets, subscribing to real-time market data, querying account info, or building automated trading systems. Shioaji 台灣金融交易 API 指南。適用於:股票/期貨/選擇權交易、即時行情訂閱、帳務查詢、自動交易系統開發。
View on GitHubSelect agents to install to:
npx add-skill https://github.com/Sinotrade/Shioaji/blob/main/skills/shioaji/SKILL.md -a claude-code --skill shioajiInstallation paths:
.claude/skills/shioaji/# Shioaji Trading API
Shioaji is SinoPac's Python API for trading Taiwan financial markets (stocks, futures, options).
Shioaji 是永豐金證券提供的 Python 交易 API,支援台灣股票、期貨、選擇權市場。
**Official Docs 官方文檔**: https://sinotrade.github.io/
**LLM Reference**: https://sinotrade.github.io/llms-full.txt
---
## Navigation 功能導覽
| Topic 主題 | File 檔案 | Description 說明 |
|------------|-----------|------------------|
| Preparation 準備 | [PREPARE.md](PREPARE.md) | Account setup, API keys, testing 開戶/金鑰申請/測試 |
| Contracts 合約 | [CONTRACTS.md](CONTRACTS.md) | Stocks, Futures, Options contracts 股票/期貨/選擇權合約 |
| Orders 下單 | [ORDERS.md](ORDERS.md) | Place, modify, cancel, combo orders 下單/改單/刪單/組合單 |
| Reserve 預收 | [RESERVE.md](RESERVE.md) | Reserve orders for disposition stocks 處置股預收券款 |
| Streaming 行情 | [STREAMING.md](STREAMING.md) | Real-time tick & bidask data 即時 Tick/BidAsk 資料 |
| Market Data 市場資料 | [MARKET_DATA.md](MARKET_DATA.md) | Historical, snapshot, credit, scanners 歷史資料/快照/資券/掃描器 |
| Accounting 帳務 | [ACCOUNTING.md](ACCOUNTING.md) | Balance, margin, P&L, trading limits 餘額/保證金/損益/額度 |
| Advanced 進階 | [ADVANCED.md](ADVANCED.md) | Quote binding, non-blocking, stop orders 報價綁定/非阻塞/觸價 |
| Troubleshooting 問題排解 | [TROUBLESHOOTING.md](TROUBLESHOOTING.md) | Common issues and solutions 常見問題與解決 |
---
## Quick Start 快速入門
### Installation 安裝
```bash
# pip
pip install shioaji
# uv (recommended 推薦)
uv add shioaji
# with speed optimization 速度優化版
uv add shioaji --extra speed
# Docker
docker run -it sinotrade/shioaji:latest
```
### Login & Activate CA 登入與憑證啟用
```python
import shioaji as sj
api = sj.Shioaji()
# Login with API Key 使用 API Key 登入
accounts = api.login(
api_key="YOUR_API_KEY",
secret_key="YOUR_SECRET_KEY"
)
# Activate CA certificate 啟用憑證 (required for placing orders 下單必須)
api.activate_ca(
ca_path="/path/to/Sinopac.pfx",
ca_passwd="YOUR_CA_PASSWORD",
)
```
### Simulation Mode 模擬模式
Test API without real money. 使用模擬環境測試 API。
```python
import shioaji as sj
api = sj.Shi