Skip to main content

GitHub license GitHub issues GitHub Actions PyPI - Python Version PyPI

Sinopac API - Shioaji 交易接口 for VeighNa框架

VeighNa框架的永豐金證券 Shioaji API 交易接口,支援台股、期貨、選擇權等金融商品交易。

🔗 相關連結

📋 系統需求

  • VeighNa: 4.0+
  • Python: 3.10 - 3.13
  • 作業系統: Windows / Linux / macOS

🚀 安裝方式

使用 pip 安裝

pip install vnpy_sinopac

使用 uv 安裝(推薦)

uv add vnpy_sinopac

🎯 快速開始

python script/run.py

📈 功能特色

  • ✅ 即時行情: 支援台股、期貨、選擇權即時報價
  • ✅ 歷史資料: K線、成交明細等歷史資料查詢
  • ✅ 交易下單: 股票、期貨、選擇權交易下單
  • ✅ 帳戶查詢: 資金、持倉、委託等帳戶資訊
  • ✅ 高效能: 使用 Polars 提升資料處理速度 10-30 倍
  • ✅ 現代化: 採用 uv 套件管理,安裝速度提升 10-100 倍

⚙️ 配置說明

1. 取得 API 金鑰

前往 永豐金證券 申請 Shioaji API 使用權限

2. 設定連線參數

from vnpy_sinopac import SinopacGateway

# 在 VeighNa 中添加 Sinopac 接口
gateway = SinopacGateway(event_engine)

📊 交易說明

股票交易

  • 支援現股買賣
  • 支援融資融券
  • 支援當沖交易
  • 自動處理交易時間限制

期貨交易

  • 支援期貨合約交易
  • 支援選擇權交易
  • 自動計算保證金
  • 支援多種委託類型

選擇權交易

  • 支援買權/賣權交易
  • 支援履約價查詢
  • 自動計算權利金
  • 支援組合策略

🔧 開發環境

本地開發設置

# 克隆專案
git clone https://github.com/ypochien/vnpy_sinopac.git
cd vnpy_sinopac

# 安裝 uv(推薦)
curl -LsSf https://astral.sh/uv/install.sh | sh

# 安裝依賴
uv sync

# 運行測試
uv run pytest tests/

📝 版本歷史

  • v4.0.3: 修正 GitHub Actions 設定,改善 CI/CD 流程
  • v4.0.2: 更新支援 Python 3.13,改善建置系統
  • v4.0.1: 升級至 VeighNa 4.x,採用 Polars 提升效能
  • v4.0.0: 全面現代化架構,從 Poetry 遷移至 uv

🤝 貢獻指南

歡迎提交 Issue 和 Pull Request!

  1. Fork 專案
  2. 創建功能分支 (git checkout -b feature/amazing-feature)
  3. 提交變更 (git commit -m 'Add amazing feature')
  4. 推送分支 (git push origin feature/amazing-feature)
  5. 開啟 Pull Request

📄 授權

本專案使用 MIT 授權 - 詳見 LICENSE 檔案

💝 贊助

如果這個專案對您有幫助,歡迎考慮贊助支持開發:

ypochien.eth.png


⭐ 如果這個專案對您有幫助,請給個星星支持!

Metadata

Release files for vnpy_sinopac 4.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vnpy_sinopac 4.0.4
File Size Uploaded
vnpy_sinopac-4.0.4.tar.gz 89.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for vnpy_sinopac 4.0.4
File Interpreter ABI Platform
vnpy_sinopac-4.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 102.0 kB

Release files / vnpy_sinopac-4.0.4.tar.gz

Download URL vnpy_sinopac-4.0.4.tar.gz
Size 89.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ece5fdd71621f928c85f21052d1206e628dd2231958df2b67101aee06f59b694
BLAKE2b-256 checksum
How to use checksums
818f0baacc5488e2cb744b9b3d2a02cb0246aac4c7b9d0726fddc46b4cb41a67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release files / vnpy_sinopac-4.0.4-py3-none-any.whl

Download URL vnpy_sinopac-4.0.4-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
093454e40c5f0bdf0e316ef5949f382fd3366fbe397003c4b0a1926dc30dc27a
BLAKE2b-256 checksum
How to use checksums
29ac16041d18852987941d29e8693a30e22200af911b8e6fb705b9a3e65a0ea6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.17

Release history Release notifications | RSS feed

This release

4.0.4 This release

2 release files

4.0.3

2 release files

2.0.0

2 release files

1.5

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.4

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.9

2 release files

1.0.8

2 release files

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

1 release file

1.0.2

2 release files

0.0.8

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page