From rshioaji
ALWAYS USE THIS SKILL when working with Shioaji, rshioaji, SinoPac, or Taiwan financial markets. Covers ALL access layers: Python native binding (sync and async), CLI tool (`shioaji` command), HTTP API server with SSE streaming, dashboard with custom app embedding, and multi-language SDK integration (JavaScript/TypeScript, Go, C/C++, C#, Rust, Java/Kotlin). Covers: placing/modifying/canceling stock/futures/options orders (buy, sell, limit, market, ROD, IOC, FOK, margin, short selling, odd lot, combo orders), real-time streaming via Python callbacks or HTTP SSE (tick, bidask, quote), historical kbars/ticks/snapshots, account balance/margin/positions/P&L, watchlists, scanners, reserve orders, and automated trading systems on TWSE/TPEX/TAIFEX. Use this skill when users mention: shioaji, rshioaji, sinopac, Taiwan stocks, TWSE, TPEX, TAIFEX, 永豐金, trading API, stock order, futures order, options order, market data streaming, SSE streaming, shioaji CLI, shioaji server, shioaji HTTP API, shioaji dashboard, custom trading app, or building trading clients in any programming language against the shioaji server. 使用 Shioaji、rshioaji、永豐金證券、台灣金融市場交易時務必使用本技能。 涵蓋:Python 原生綁定(同步/非同步)、CLI 命令列工具、HTTP API 伺服器(SSE 即時串流)、 儀表板(自訂應用嵌入)、多語言 SDK 整合(JS/TS、Go、C/C++、C#、Rust、Java/Kotlin)。
npx claudepluginhub sinotrade/rshioajiThis skill uses the workspace's default tool permissions.
Shioaji is SinoPac's **cross-language, cross-platform** trading API for Taiwan financial markets (TWSE/TPEX/TAIFEX). The Rust reimplementation (rshioaji) transforms Shioaji from a Python-only library into a universal trading platform — **any programming language** can now trade Taiwan markets through the HTTP API server.
references/ACCOUNTING.mdreferences/ADVANCED.mdreferences/CLI.mdreferences/CONTRACTS.mdreferences/CPP.mdreferences/CSHARP.mdreferences/GO.mdreferences/HTTP_API.mdreferences/JAVA.mdreferences/JAVASCRIPT.mdreferences/MARKET_DATA.mdreferences/ORDERS.mdreferences/PREPARE.mdreferences/RESERVE.mdreferences/RUST.mdreferences/STREAMING.mdreferences/TROUBLESHOOTING.mdreferences/WATCHLIST.mdProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.
Analyzes competition with Porter's Five Forces, Blue Ocean Strategy, and positioning maps to identify differentiation opportunities and market positioning for startups and pitches.
Shioaji is SinoPac's cross-language, cross-platform trading API for Taiwan financial markets (TWSE/TPEX/TAIFEX). The Rust reimplementation (rshioaji) transforms Shioaji from a Python-only library into a universal trading platform — any programming language can now trade Taiwan markets through the HTTP API server.
Shioaji 是永豐金證券的跨語言、跨平台交易 API。Rust 重新實作(rshioaji)將 Shioaji 從 Python 專屬函式庫轉變為通用交易平台 — 任何程式語言都能透過 HTTP API 伺服器交易台灣市場。
Three access layers:
import shioaji) for best performance, sync and asyncshioaji command-line tool for server management, trading, and data querieslocalhost:8080, accessible from JS/TS, Go, C/C++, C#, Rust, Java/Kotlin, or any HTTP clientInstall:
claude plugin marketplace add Sinotrade/rshioaji→claude plugin install rshioajiThis can coexist with the oldSinotrade/Shioajiplugin (different name). At production release, plugin name changes toshioaji.
Official Docs: https://sinotrade.github.io/
For most tasks, load only 1-2 files. Use both axes: what (task) + how (access method).
| Task | Load File |
|---|---|
| Install, login, API keys, CA cert, simulation, env vars, constants | PREPARE.md |
| Look up contract codes, attributes, security types | CONTRACTS.md |
| Place, modify, cancel orders; combos; order events | ORDERS.md |
| Reserve shares for disposition/attention stocks | RESERVE.md |
| Subscribe real-time quotes, tick/bidask/quote callbacks, SSE streams | STREAMING.md |
| Historical ticks, K-bars, snapshots, scanners, credit enquiry | MARKET_DATA.md |
| Account balance, margin, positions, P&L, settlements, limits | ACCOUNTING.md |
| Manage watchlists (CRUD, add/remove contracts) | WATCHLIST.md |
| Non-blocking mode, quote binding, stop orders, advanced patterns | ADVANCED.md |
| Errors, connection issues, troubleshooting | TROUBLESHOOTING.md |
| Access Method | Additional File | Notes |
|---|---|---|
| Python (sync or async) | None — task refs include Python examples | Default path |
CLI (shioaji command) | CLI.md | Task ref (concept) + CLI.md (commands) |
| HTTP API (any language) | HTTP_API.md | Canonical endpoint inventory |
| JavaScript/TypeScript | JAVASCRIPT.md | Complete project guide |
| Go | GO.md | Complete project guide |
| C/C++ | CPP.md | Complete project guide |
| C# | CSHARP.md | Complete project guide |
| Rust | RUST.md | HTTP client guide |
| Java/Kotlin | JAVA.md | Complete project guide |
Python users: load only the task reference (Axis 1). CLI users: load the task reference + CLI.md. Other languages: load the task reference + language reference (which covers HTTP setup).
import shioaji as sj
api = sj.Shioaji()
api.login(api_key="YOUR_KEY", secret_key="YOUR_SECRET")
uv tool install rshioaji
export SJ_API_KEY=YOUR_KEY SJ_SEC_KEY=YOUR_SECRET
shioaji server start # start HTTP server (simulation)
shioaji order place --code 2330 --action Buy --price 580 --quantity 1
# Server must be running first (see CLI above)
curl http://localhost:8080/api/v1/auth/accounts
curl -X POST http://localhost:8080/api/v1/data/snapshots \
-H "Content-Type: application/json" \
-d '{"contracts":[{"security_type":"STK","exchange":"TSE","code":"2330"}]}'
See PREPARE.md for full installation and setup.
WARNING 警告: Always verify the server mode before placing orders. Production mode executes real trades with real money. 下單前務必確認伺服器模式。正式環境會使用真實資金進行真實交易。
shioaji server check (CLI) or GET /api/v1/info (HTTP — returns simulation field)shioaji server start --production or SJ_PRODUCTION=trueshioaji server stop then shioaji server start (without --production)| Category | Limit |
|---|---|
| Daily Traffic | 500MB–10GB (based on trading volume) |
| Quote Query | 50 requests / 5 sec |
| Accounting Query | 25 requests / 5 sec |
| Connections | 5 per person ID |
| Daily Logins | 1000 times |
try:
trade = api.place_order(contract, order)
except Exception as e:
print(f"Order failed: {e}")
HTTP API returns JSON errors: {"code": 400, "message": "...", "details": "..."}
api.logout()