Initial commit: A-Share Data Platform v0.1.0

Parquet + DuckDB storage with REST/WebSocket APIs for Chinese A-share
market data. Supports 9 K-line frequencies with dual backend
(East Money / Sina) and auto-fallback.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jackyu66git
2026-05-18 16:50:17 +08:00
co-authored by Claude Opus 4.6
parent a11e1ceee1
commit 21378c4f6d
40 changed files with 3737 additions and 213 deletions
+39
View File
@@ -0,0 +1,39 @@
"""Serve CLI subcommand: start the API server."""
from __future__ import annotations
import asyncio
import typer
import uvicorn
from loguru import logger
from ashare_dp.config import Settings
settings = Settings()
serve_app = typer.Typer()
@serve_app.command("start")
def serve(
host: str = typer.Option(None, help="Bind address"),
port: int = typer.Option(None, help="Bind port"),
reload: bool = typer.Option(False, help="Enable auto-reload (dev mode)"),
):
"""Start the API server with scheduler."""
h = host or settings.api_host
p = port or settings.api_port
logger.info(f"Starting API server on {h}:{p}")
# Start the realtime poller in a background thread via the app lifespan
# The FastAPI lifespan handles DB init, scheduler start, and poller start
uvicorn.run(
"ashare_dp.api.app:create_app",
host=h,
port=p,
reload=reload,
factory=True,
log_level=settings.log_level.lower(),
)