Skip to main content

Sinopac Securities - Shioaji api gateway for VeighNa quant trading framework.

Project description

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


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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vnpy_sinopac-4.0.4.tar.gz (89.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vnpy_sinopac-4.0.4-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

Details for the file vnpy_sinopac-4.0.4.tar.gz.

File metadata

  • Download URL: vnpy_sinopac-4.0.4.tar.gz
  • Upload date:
  • Size: 89.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.17

File hashes

Hashes for vnpy_sinopac-4.0.4.tar.gz
Algorithm Hash digest
SHA256 ece5fdd71621f928c85f21052d1206e628dd2231958df2b67101aee06f59b694
MD5 e24d1354b6ae81db9589d5b3aca6b614
BLAKE2b-256 818f0baacc5488e2cb744b9b3d2a02cb0246aac4c7b9d0726fddc46b4cb41a67

See more details on using hashes here.

File details

Details for the file vnpy_sinopac-4.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for vnpy_sinopac-4.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 093454e40c5f0bdf0e316ef5949f382fd3366fbe397003c4b0a1926dc30dc27a
MD5 d2f19298437d9532c1ad99053db5d9a4
BLAKE2b-256 29ac16041d18852987941d29e8693a30e22200af911b8e6fb705b9a3e65a0ea6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page