修复bug
This commit is contained in:
@@ -3,6 +3,8 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass, field
|
||||
from statistics import mean
|
||||
|
||||
from .candle_rows import rows_to_hlc
|
||||
|
||||
|
||||
@dataclass
|
||||
class BtcDailyGateResult:
|
||||
@@ -14,18 +16,6 @@ class BtcDailyGateResult:
|
||||
metrics: dict = field(default_factory=dict)
|
||||
|
||||
|
||||
def _rows_to_hlc(rows: list[list[str]]) -> tuple[list[float], list[float], list[float]]:
|
||||
"""与行情 K 线行对齐:h, l, c(ts,o,h,l,c,...)。"""
|
||||
h, l_, c = [], [], []
|
||||
for item in rows:
|
||||
if len(item) < 6:
|
||||
continue
|
||||
h.append(float(item[2]))
|
||||
l_.append(float(item[3]))
|
||||
c.append(float(item[4]))
|
||||
return h, l_, c
|
||||
|
||||
|
||||
def evaluate_btc_daily_gate(
|
||||
btc_1d_rows: list[list[str]],
|
||||
*,
|
||||
@@ -39,7 +29,7 @@ def evaluate_btc_daily_gate(
|
||||
- 下跌(唯一不扫):非横盘,且收盘低于近 20 日收盘均线,且该均线相对前一段走低。
|
||||
- 其余(横盘、上涨、宽幅震荡、数据不足 unknown 等):一律允许扫山寨。
|
||||
"""
|
||||
ah, al, ac = _rows_to_hlc(btc_1d_rows)
|
||||
ah, al, ac = rows_to_hlc(btc_1d_rows)
|
||||
|
||||
if len(ac) < min_bars:
|
||||
return BtcDailyGateResult(
|
||||
|
||||
Reference in New Issue
Block a user