feat: record cvd_fast_5m in signal_indicators for v53_fast strategy
This commit is contained in:
parent
98a88d7c19
commit
991e521a3d
@ -938,6 +938,7 @@ class SymbolState:
|
|||||||
"score": total_score,
|
"score": total_score,
|
||||||
"direction": direction if (not no_direction and gate_passed) else None,
|
"direction": direction if (not no_direction and gate_passed) else None,
|
||||||
"atr_value": atr_value,
|
"atr_value": atr_value,
|
||||||
|
"cvd_fast_5m": cvd_fast if is_fast else None, # v53_fast: 存5m实算CVD
|
||||||
"factors": {
|
"factors": {
|
||||||
"track": "BTC" if self.symbol == "BTCUSDT" else "ALT",
|
"track": "BTC" if self.symbol == "BTCUSDT" else "ALT",
|
||||||
"gate_passed": gate_passed,
|
"gate_passed": gate_passed,
|
||||||
@ -1022,14 +1023,16 @@ def save_indicator(ts: int, symbol: str, result: dict, strategy: str = "v52_8sig
|
|||||||
with conn.cursor() as cur:
|
with conn.cursor() as cur:
|
||||||
import json as _json3
|
import json as _json3
|
||||||
factors_json = _json3.dumps(result.get("factors")) if result.get("factors") else None
|
factors_json = _json3.dumps(result.get("factors")) if result.get("factors") else None
|
||||||
|
cvd_fast_5m = result.get("cvd_fast_5m") # v53_fast 专用:5m窗口CVD,其他策略为None
|
||||||
cur.execute(
|
cur.execute(
|
||||||
"INSERT INTO signal_indicators "
|
"INSERT INTO signal_indicators "
|
||||||
"(ts,symbol,strategy,cvd_fast,cvd_mid,cvd_day,cvd_fast_slope,atr_5m,atr_percentile,atr_value,vwap_30m,price,p95_qty,p99_qty,score,signal,factors) "
|
"(ts,symbol,strategy,cvd_fast,cvd_mid,cvd_day,cvd_fast_slope,atr_5m,atr_percentile,atr_value,vwap_30m,price,p95_qty,p99_qty,score,signal,factors,cvd_fast_5m) "
|
||||||
"VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
|
"VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)",
|
||||||
(ts, symbol, strategy, result["cvd_fast"], result["cvd_mid"], result["cvd_day"], result["cvd_fast_slope"],
|
(ts, symbol, strategy, result["cvd_fast"], result["cvd_mid"], result["cvd_day"], result["cvd_fast_slope"],
|
||||||
result["atr"], result["atr_pct"], result.get("atr_value", result["atr"]),
|
result["atr"], result["atr_pct"], result.get("atr_value", result["atr"]),
|
||||||
result["vwap"], result["price"],
|
result["vwap"], result["price"],
|
||||||
result["p95"], result["p99"], result["score"], result.get("signal"), factors_json)
|
result["p95"], result["p99"], result["score"], result.get("signal"), factors_json,
|
||||||
|
cvd_fast_5m)
|
||||||
)
|
)
|
||||||
# 有信号时通知live_executor
|
# 有信号时通知live_executor
|
||||||
if result.get("signal"):
|
if result.get("signal"):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user