看股功能更新
This commit is contained in:
@@ -40,12 +40,14 @@ def fetch_daily(code: str, start: str = "20200101", end: str | None = None,
|
||||
df = df.sort_values("trade_date")
|
||||
bars: list[Bar] = []
|
||||
for _, r in df.iterrows():
|
||||
amt = r.get("amount")
|
||||
bars.append(
|
||||
Bar(
|
||||
ts=_parse(r["trade_date"]),
|
||||
open=float(r["open"]), high=float(r["high"]),
|
||||
low=float(r["low"]), close=float(r["close"]),
|
||||
volume=float(r["vol"]) * 100.0, # Tushare vol 单位为手 -> 股
|
||||
amount=float(amt) * 1000.0 if amt is not None and amt == amt else None, # 千元 -> 元
|
||||
)
|
||||
)
|
||||
return bars
|
||||
|
||||
Reference in New Issue
Block a user