How panghu11033/thsdk works
THSDK is a synchronous Python securities-data SDK. Users authenticate, call a convenience or standard API, and receive decoded results—often DataFrames—for analysis; account watchlist APIs also support remote writes. The facade adapts convenient inputs and results, while domain wrappers normalize requests through a shared base into a session and native runtime bridge. The README documents broad market, discovery, news, Wencai, ranking, and account capabilities. Some domain implementations were not sampled, so their relationships are shown only where imports or documentation support them.
Main entry points: api.py API facade · _base.py Request normalization · session.py Session client · account.py Account APIs
Components 16
Public API
- API facade
src/thsdk/api.py - Method manifest
src/thsdk/_method_manifest.py
Authentication
- Session client
src/thsdk/session.py - QR display
src/thsdk/_qr_display.py - Temporary accounts
src/thsdk/_temporary_accounts.py
Data Domains
- Account APIs
src/thsdk/_apis/account.py - Security directory
src/thsdk/_apis/securities.py - Market data
src/thsdk/_apis/market_data.py - News and events
src/thsdk/_apis/news.py - Wencai queries
src/thsdk/_apis/wencai.py - Rankings
src/thsdk/_apis/rankings.py
Request Runtime
- Request normalization
src/thsdk/_apis/_base.py - Native bridge
src/thsdk/_runtime.py - SDK errors
src/thsdk/exceptions.py
Other components
- Python user
- THSDK runtime component
Connections 21
- Python user → API facade: calls
README.md - API facade → Method manifest: uses metadata
src/thsdk/api.py - API facade → Account APIs: exposes APIs
- API facade → Security directory: exposes APIs
- API facade → Market data: exposes APIs
- API facade → News and events: exposes APIs
- API facade → Wencai queries: exposes APIs
- API facade → Rankings: exposes APIs
- API facade → Session client: uses session
src/thsdk/api.py - Account APIs → Request normalization: delegates requests
src/thsdk/_apis/account.py - Security directory → Request normalization: delegates requests
src/thsdk/_apis/securities.py - Market data → Request normalization: delegates requests
src/thsdk/_apis/market_data.py - News and events → Request normalization: delegates requests
src/thsdk/_apis/news.py - Wencai queries → Request normalization: delegates requests
src/thsdk/_apis/wencai.py - Rankings → Request normalization: delegates requests
src/thsdk/_apis/rankings.py - Request normalization → Session client: sends request
src/thsdk/_apis/_base.py - Session client → Native bridge: calls bridge
src/thsdk/session.py - Native bridge → THSDK runtime component: calls ABI
src/thsdk/_runtime.py - Session client → QR display: displays challenge
src/thsdk/session.py - Session client → Temporary accounts: uses fallback
src/thsdk/session.py - Session client → SDK errors: raises errors
src/thsdk/session.py