How hithink-tech/financial-api works
This repository provides official A-share financial-data access through a Node.js CLI and a Python SDK, plus local DuckDB research workflows. A typical CLI request starts with a user command, resolves configuration and credentials, dispatches to a remote or local command, then returns structured output. Remote requests map validated capability definitions into Fuyao API calls; local workflows initialize, synchronize, validate, repair, or query a database. The README also documents REST, hosted MCP, and Agent Skill entry points, but their implementations are not present in the supplied tree. Several links for unsampled Python and command modules follow documented responsibilities.
Main entry points: remote.ts Remote commands · program.ts Command dispatch · index.ts Database commands · main.ts CLI bootstrap
Components 24
CLI runtime
- CLI bootstrap
hithink-finance-cli/src/cli/main.ts - Config resolution
hithink-finance-cli/src/application/config.ts - Command dispatch
hithink-finance-cli/src/cli/program.ts - Remote commands
hithink-finance-cli/src/commands/remote.ts - Domain commands
hithink-finance-cli/src/commands/market/index.ts - Structured output
hithink-finance-cli/src/output/renderer.ts - Database commands
hithink-finance-cli/src/commands/data/index.ts
Remote data
- Remote contracts
hithink-finance-cli/src/contracts/remote-capabilities.ts - Query execution
hithink-finance-cli/src/application/use-cases/remote-query.ts - HTTP client
hithink-finance-cli/src/infrastructure/fuyao/client.ts - Fuyao service
- Dump downloader
hithink-finance-cli/src/infrastructure/duckdb/dump-client.ts - Fuyao REST API
Local research
- DuckDB store
hithink-finance-cli/src/infrastructure/duckdb/connection.ts - Local SQL query
hithink-finance-cli/src/application/use-cases/local-query.ts - Schema migrations
hithink-finance-cli/src/infrastructure/duckdb/migrations.ts
Python access
- Python SDK
python/marketdb/sdk.py - marketdb CLI
python/marketdb/cli.py - Database updates
python/marketdb/updaters/auto.py - Python DuckDB
python/marketdb/db.py - Quality checks
python/marketdb/checks/quality.py
Other components
- Terminal user
- Python caller
- REST / MCP clients
Connections 25
- Terminal user → CLI bootstrap: runs command
- CLI bootstrap → Config resolution: loads settings
- CLI bootstrap → Command dispatch: builds and dispatches
- Command dispatch → Remote commands: registers commands
- Command dispatch → Domain commands: registers commands
- Command dispatch → Database commands: registers commands
- Remote commands → Remote contracts: uses definitions
- Remote commands → Query execution: executes query
- Query execution → HTTP client: requests data
- HTTP client → Fuyao service: calls API
- Remote commands → Dump downloader: downloads dumps
- Dump downloader → Fuyao service: signs and downloads
- Remote commands → Structured output: renders result
- Database commands → DuckDB store: opens database
- Database commands → Schema migrations: migrates schema
- Database commands → Structured output: renders result
- Local SQL query → DuckDB store: queries and exports
- Python caller → Python SDK: calls SDK
- Python SDK → Fuyao REST API: requests data
- Python caller → marketdb CLI: runs command
- marketdb CLI → Database updates: dispatches update
- Database updates → Python DuckDB: updates database
- marketdb CLI → Quality checks: runs validation
- Quality checks → Python DuckDB: checks data
- REST / MCP clients → Fuyao service: uses hosted API