mirror of
https://ghfast.top/https://github.com/aeroxw/easy_tdx_max.git
synced 2026-09-12 18:04:20 +08:00
- pyproject.toml: add mypy overrides for pandas/tabulate/matplotlib stubs, disable strict checking for vendored MyTT library - config.py: use cast() for dict[str, Any] .get() returns - beichi.py: widen _calc_bi_force param to BI | XD, import XD - backtest/cli.py: split combo/single strategy into separate typed variables - backtest/combo.py: add bool_array() helper for numpy return types - chanlun/analyser.py: type ignore for pandas row access, fix dict type arg - unified.py: change fields param from object to Any - ex/mac_client.py: add type args to list literals - cli/cmd_offline.py: wrap int market as Market enum before API call - cli/cmd_chanlun.py: fix dict type arg - offline/write_*.py: explicit int() cast for struct.unpack returns - MyTT.py: fix line-too-long comments, UP038 isinstance syntax - tests: fix E712 (==False → ~mask), E741 (noqa), F841, import sorting - ruff format applied across codebase Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
29 lines
649 B
Python
29 lines
649 B
Python
"""K 线数据模型"""
|
|
|
|
from dataclasses import dataclass, field
|
|
|
|
|
|
@dataclass
|
|
class SecurityBar:
|
|
"""单根 K 线(适用于 1m/5m/15m/30m/60m/日/周/月/季/年)"""
|
|
|
|
open: float
|
|
close: float
|
|
high: float
|
|
low: float
|
|
vol: float # 成交量(股)
|
|
amount: float # 成交额(元)
|
|
|
|
year: int
|
|
month: int
|
|
day: int
|
|
hour: int
|
|
minute: int
|
|
|
|
# 原始字节,供字段逆向分析使用
|
|
_raw: bytes = field(default=b"", repr=False, compare=False)
|
|
|
|
@property
|
|
def datetime_str(self) -> str:
|
|
return f"{self.year}-{self.month:02d}-{self.day:02d} {self.hour:02d}:{self.minute:02d}"
|