💡 摘要
Shioaji 是一个全面的交易 API,用于通过 Python 访问台湾金融市场。
🎯 适合人群
🤖 AI 吐槽: “自述文件建议进行交易操作时需要网络访问,这会带来未经授权访问和数据泄露的风险。实施 API 密钥管理和安全存储实践可以减轻这些风险。”
自述文件建议进行交易操作时需要网络访问,这会带来未经授权访问和数据泄露的风险。实施 API 密钥管理和安全存储实践可以减轻这些风险。
Shioaji


Shioaji is a trading API provided by Sinopac that offers a comprehensive and user-friendly platform for accessing the Taiwan financial markets. With Shioaji, you can trade a variety of financial instruments including stocks, futures, and options using your favorite Python packages such as numpy, scipy, pandas, pytorch, or tensorflow to build your own custom trading models. The platform is easy to use and intuitive, with advanced charting tools, real-time market data, and a customizable interface that allows you to tailor your trading experience to your specific needs. Shioaji is fast and efficient, with a high-performance core implemented in C++ and using FPGA event broker technology, and it is the first Python trading API in Taiwan that is compatible with Linux and Mac, making it a truly cross-platform solution. Whether you are a beginner looking to get started in the world of trading or an experienced trader looking for a more powerful platform, Shioaji has something to offer. Sign up for a free account today and start trading with confidence.
✨ First Taiwan trading API with AI coding agent skill support — Claude Code & Codex CLI
AI Coding Agent Skills
Shioaji is the first Taiwan trading API with AI coding agent skill support. Get AI-assisted guidance on using the Shioaji API.
Claude Code
claude plugin marketplace add Sinotrade/Shioaji claude plugin install shioaji
OpenAI Codex CLI
In a Codex session, use the skill-installer:
$skill-installer install shioaji from Sinotrade/Shioaji --path skills/shioaji
Installation
Binaries
simple using pip to install
pip install shioaji
update shioaji with
pip install -U shioaji
uv
using uv to install
uv add shioaji
install speed version
uv add shioaji --extra speed
Docker Image
simple run with interactive mode in docker
docker run -it sinotrade/shioaji:latest
run with jupyter lab or notebook
docker run -p 8888:8888 sinotrade/shioaji:jupyter
Quickstarts
Initialization
import shioaji as sj api = sj.Shioaji() accounts = api.login("YOUR_TOKEN", "YOUR_SECRET_KEY") api.activate_ca( ca_path="/c/your/ca/path/Sinopac.pfx", ca_passwd="YOUR_CA_PASSWORD", )
Just import our API library like other popular python library and new the instance to start using our API. Login your account and activate the certification then you can start placing order.
Streaming Market Data
api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="tick") api.quote.subscribe(api.Contracts.Stocks["2330"], quote_type="bidask") api.quote.subscribe(api.Contracts.Futures["TXFC0"], quote_type="tick")
Subscribe the real time market data. Simplely pass contract into quote subscribe function and give the quote type will receive the streaming data.
Place Order
contract = api.Contracts.Stocks["2890"] order = api.Order( price=9.6, quantity=1, action="Buy", price_type="LMT", order_type="ROD", order_lot="Common", account=api.stock_account, ) # or order = api.Order( price=9.6, quantity=1, action=sj.constant.Action.Buy, price_type=sj.constant.StockPriceType.LMT, order_type=sj.constant.OrderType.ROD, order_lot=sj.constant.StockOrderLot.Common, account=api.stock_account, ) trade = api.place_order(contract, order)
Like the above subscribing market data using the contract, then need to define the order. Pass them into place_order function, then it will return the trade that describe the status of your order.
Conclusion
This quickstart demonstrates how easy to use our package for native Python users. Unlike many other trading API is hard for Python developer. We focus on making more pythonic trading API for our users.
More usage detail on document.
Communication
Releases and Contributing
Shioaji has a 14 day release cycle. See the release change log. Please let us know if you encounter a bug by filing an issue.
We appreciate all suggestions. If you have any idea want us to implement, please discuss with us in gitter.
The Team
Shioaji is currently maintained by Sally, Yvictor, CC.Chiao and Po Chien Yang with major contributions.
优点
- 为 Python 开发人员提供用户友好的界面。
- 支持多种金融工具。
- 实时市场数据流。
- 跨平台兼容性。
缺点
- 仅限于台湾金融市场。
- 高级功能可能需要额外设置。
- 文档可以更详细。
- 依赖外部库。
相关技能
免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。
版权归原作者所有 Sinotrade.
