Upload 1581 files
Browse files
RESTORE_SAFE_HOTFIX_V2_COMPAT_LOAD_FIX.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Restore-Safe Hotfix v2 — Compat Router Load Fix
|
| 2 |
+
|
| 3 |
+
This package fixes the runtime startup error:
|
| 4 |
+
|
| 5 |
+
```txt
|
| 6 |
+
Compat routes not loaded: Cannot use `Query` for path param 'symbol'
|
| 7 |
+
```
|
| 8 |
+
|
| 9 |
+
Root cause: `/api/trading/volume` and `/api/trading/volume/{symbol}` were registered on the same FastAPI function while `symbol` was declared with `Query(...)`. FastAPI requires path parameters to be declared as path params, not Query params.
|
| 10 |
+
|
| 11 |
+
Fix applied:
|
| 12 |
+
|
| 13 |
+
- Split the volume endpoint into two handlers:
|
| 14 |
+
- `GET /api/trading/volume?symbol=BTC`
|
| 15 |
+
- `GET /api/trading/volume/{symbol}`
|
| 16 |
+
- Preserved all JSON registries, provider configs, `api/`, `hf-data-engine/`, model files, provider manager, and resource manager.
|
| 17 |
+
- No secrets included.
|
| 18 |
+
|
| 19 |
+
Expected after deploy:
|
| 20 |
+
|
| 21 |
+
- Compat routes should load at startup.
|
| 22 |
+
- `/api/trading/orderbook?...` should no longer 404 if `api_compat_routes.py` is included.
|
| 23 |
+
- `/api/trading/volume?...` should no longer 404.
|
| 24 |
+
- `/api/ohlcv`, `/api/klines`, and `/api/history` should be available through compat routes.
|
| 25 |
+
|
| 26 |
+
Smoke tests:
|
| 27 |
+
|
| 28 |
+
```bash
|
| 29 |
+
curl /api/health
|
| 30 |
+
curl /api/debug/capabilities/compat
|
| 31 |
+
curl "/api/trading/orderbook?symbol=BTC&depth=20"
|
| 32 |
+
curl "/api/trading/volume?symbol=BTC"
|
| 33 |
+
curl "/api/trading/volume/BTC"
|
| 34 |
+
curl "/api/ohlcv?symbol=BTCUSDT&timeframe=1h&limit=100"
|
| 35 |
+
```
|
__pycache__/api_compat_routes.cpython-313.pyc
CHANGED
|
Binary files a/__pycache__/api_compat_routes.cpython-313.pyc and b/__pycache__/api_compat_routes.cpython-313.pyc differ
|
|
|
__pycache__/api_server_extended.cpython-313.pyc
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1be68b4b41214fe15a8956d9dd47eaec988a7e29f8b13c06466e021be4486fde
|
| 3 |
+
size 155717
|
api_compat_routes.py
CHANGED
|
@@ -578,8 +578,12 @@ async def trading_stats_24h(symbol: str):
|
|
| 578 |
|
| 579 |
|
| 580 |
@router.get("/api/trading/volume")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
@router.get("/api/trading/volume/{symbol}")
|
| 582 |
-
async def
|
| 583 |
return await _fetch_volume_multi(symbol)
|
| 584 |
|
| 585 |
|
|
|
|
| 578 |
|
| 579 |
|
| 580 |
@router.get("/api/trading/volume")
|
| 581 |
+
async def trading_volume_query(symbol: str = Query("BTCUSDT")):
|
| 582 |
+
return await _fetch_volume_multi(symbol)
|
| 583 |
+
|
| 584 |
+
|
| 585 |
@router.get("/api/trading/volume/{symbol}")
|
| 586 |
+
async def trading_volume_path(symbol: str):
|
| 587 |
return await _fetch_volume_multi(symbol)
|
| 588 |
|
| 589 |
|