删除根目录旧 Chan 模块、策略、配置、文档及 wyckoff 相关代码;更新缠论 pipeline 与笔中枢计算;补充 research 研究与 web 测试。 Co-authored-by: Cursor <cursoragent@cursor.com>
29 lines
820 B
Python
29 lines
820 B
Python
"""测试辅助函数。"""
|
|
from __future__ import annotations
|
|
|
|
import numpy as np
|
|
import pandas as pd
|
|
|
|
|
|
def make_ohlcv(n: int = 400, seed: int = 42) -> pd.DataFrame:
|
|
rng = np.random.default_rng(seed)
|
|
dates = pd.date_range("2024-01-01", periods=n, freq="5min", tz="UTC")
|
|
rets = rng.normal(0, 0.002, size=n)
|
|
close = 100 * np.exp(np.cumsum(rets))
|
|
open_ = np.roll(close, 1)
|
|
open_[0] = close[0]
|
|
spread = np.abs(rng.normal(0, 0.0015, size=n)) * close
|
|
high = np.maximum(open_, close) + spread
|
|
low = np.minimum(open_, close) - spread
|
|
volume = rng.uniform(100, 1000, size=n)
|
|
return pd.DataFrame(
|
|
{
|
|
"date": dates,
|
|
"open": open_,
|
|
"high": high,
|
|
"low": low,
|
|
"close": close,
|
|
"volume": volume,
|
|
}
|
|
)
|