Initial AlphaPulse implementation: news crawler and Binance klines
- Backend (FastAPI, SQLAlchemy 2, Alembic): single-admin cookie auth, news/crawler/market APIs with SSE and WebSocket streaming - Crawler (Scrapy + Scrapy-Redis): wscn_news, wscn_live, cls_depth, cls_telegraph spiders, idempotent upserts with revisions, raw response archiving, per-source subprocess supervision, restart and backoff - Market worker: full-history Binance spot/USD-M kline backfill, realtime WS stream, hourly and on-reconnect catch-up - Frontend (Vue 3, Element Plus, UnoCSS, KLineChart): news feed, crawler console with live logs, Binance-style chart page - Deploy: docker compose, nginx site, migrate and daily backup scripts
This commit is contained in:
commit
aabc81ba5b
88 files changed
+12603
No files matched your search
@@ -0,0 +1,29 @@
|
||||
from fastapi import Depends, FastAPI
|
||||
from fastapi.openapi.docs import get_swagger_ui_html
|
||||
from fastapi.responses import HTMLResponse
|
||||
|
||||
from alphapulse.api import auth, crawler, market, news
|
||||
from alphapulse.core.auth import require_admin
|
||||
|
||||
# 关闭默认文档路由,改为登录后才能访问
|
||||
app = FastAPI(title="AlphaPulse", docs_url=None, redoc_url=None, openapi_url=None)
|
||||
app.include_router(auth.router)
|
||||
app.include_router(news.router)
|
||||
app.include_router(crawler.router)
|
||||
app.include_router(market.router)
|
||||
app.include_router(market.ws_router)
|
||||
|
||||
|
||||
@app.get("/api/health", include_in_schema=False)
|
||||
async def health() -> dict[str, str]:
|
||||
return {"status": "ok"}
|
||||
|
||||
|
||||
@app.get("/api/openapi.json", include_in_schema=False, dependencies=[Depends(require_admin)])
|
||||
async def openapi() -> dict:
|
||||
return app.openapi()
|
||||
|
||||
|
||||
@app.get("/api/docs", include_in_schema=False, dependencies=[Depends(require_admin)])
|
||||
async def docs() -> HTMLResponse:
|
||||
return get_swagger_ui_html(openapi_url="/api/openapi.json", title="AlphaPulse API")
|
||||
Reference in new issue
Block a user