fix: ECR-004 威科夫区间评分硬化与 VP 绘图减负(已审)

评分选 TR、阶段最小跨度、elements_only 门闩、Top-8 VP;无币种独立参数。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
jackyu66git
2026-08-06 18:46:08 +08:00
co-authored by Cursor
parent ac6be80278
commit d3188ca83c
19 changed files with 275 additions and 89 deletions
+29
View File
@@ -157,3 +157,32 @@ def test_analyze_http_wyckoff_opt_in():
w = payload["wyckoff"]
for k in WYCKOFF_KEYS:
assert k in w, f"missing wyckoff key: {k}"
def test_analyze_http_wyckoff_skipped_when_elements_only():
"""elements_only=true 时即使 include_wyckoff=1 也不返回 wyckoff。"""
from app import app
from services.runtime import add_indicators
df = add_indicators(make_ohlcv(300))
df = df.copy()
if "timestamp" not in df.columns:
df["timestamp"] = (pd.to_datetime(df["date"]).astype("int64") // 10**6).astype("int64")
with patch("api.analyze.get_kl_data", return_value=df):
client = app.test_client()
resp = client.get(
"/api/analyze",
query_string={
"symbol": "BTC/USDT:USDT",
"timeframe": "5m",
"element_timeframe": "1m",
"timezone": "Asia/Shanghai",
"elements_only": "true",
"include_wyckoff": 1,
},
)
assert resp.status_code == 200, resp.data[:500]
payload = resp.get_json()
assert payload is not None
assert "wyckoff" not in payload