看股功能更新
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from datetime import datetime
|
||||
from datetime import date, datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel, Field
|
||||
@@ -298,7 +298,11 @@ class StockListItemOut(BaseModel):
|
||||
prev_close: float | None = None
|
||||
pct_chg: float | None = None # 最新两根日线计算
|
||||
last_ts: datetime | None = None
|
||||
bar_count: int | None = None # 本地缓存日线条数
|
||||
turnover_rate: float | None = None # 换手率 %(daily_snapshot)
|
||||
pe_ttm: float | None = None # 市盈率 TTM
|
||||
pb: float | None = None # 市净率
|
||||
total_mv: float | None = None # 总市值(亿元)
|
||||
circ_mv: float | None = None # 流通市值(亿元)
|
||||
watched: bool = False # 是否自选(当前用户)
|
||||
|
||||
|
||||
@@ -343,3 +347,29 @@ class ScreenerQueryOut(BaseModel):
|
||||
|
||||
class ScreenerQueryListResponse(BaseModel):
|
||||
items: list[ScreenerQueryOut]
|
||||
|
||||
|
||||
# ---------- 交割单(个人实盘买卖点) ----------
|
||||
class UserTradeOut(BaseModel):
|
||||
id: int
|
||||
ts_code: str
|
||||
name: str | None = None
|
||||
trade_date: date # 成交日期(ISO YYYY-MM-DD)
|
||||
direction: str # buy | sell
|
||||
price: float | None = None # 成交价(券商原始价,不复权)
|
||||
qty: float # 股数
|
||||
amount: float | None = None
|
||||
fee: float | None = None
|
||||
|
||||
|
||||
class TradesImportResponse(BaseModel):
|
||||
inserted: int # 新入库成交笔数
|
||||
skipped_dup: int # 与库内完全一致(重复上传同文件)跳过
|
||||
skipped_other: int # 非买卖行(转账/配号/利息等)
|
||||
stocks: int # 涉及股票数
|
||||
bad: list[str] = Field(default_factory=list) # 解析失败样例(前 5 条)
|
||||
sample: list[UserTradeOut] = Field(default_factory=list) # 本次入库的前几笔(核对用)
|
||||
|
||||
|
||||
class TradesClearResponse(BaseModel):
|
||||
deleted: int
|
||||
|
||||
Reference in New Issue
Block a user