修复数据采集和清理的bug,新增持仓排名功能,日线数据分页

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 00:01:41 +08:00
parent 5453ce1dcf
commit cd7f6668af
9 changed files with 309 additions and 60 deletions
+9 -9
View File
@@ -51,18 +51,18 @@ class DailyBar(Base):
return self.high - self.low
class PositionSnapshot(Base):
__tablename__ = "position_snapshots"
__table_args__ = (UniqueConstraint("contract_code", "institution", "direction", "date"),)
class PositionRanking(Base):
__tablename__ = "position_rankings"
__table_args__ = (UniqueConstraint("contract_code", "institution", "data_type", "date"),)
id: Mapped[int] = mapped_column(primary_key=True)
contract_code: Mapped[str] = mapped_column(String(10), index=True, default="FG")
institution: Mapped[str] = mapped_column(String(20), index=True)
direction: Mapped[str] = mapped_column(String(10))
contract_code: Mapped[str] = mapped_column(String(10), index=True)
institution: Mapped[str] = mapped_column(String(30), index=True)
data_type: Mapped[str] = mapped_column(String(10), index=True)
date: Mapped[date] = mapped_column(Date, index=True)
position: Mapped[int] = mapped_column(Integer)
delta: Mapped[int] = mapped_column(Integer, default=0)
avg_cost: Mapped[float] = mapped_column(Float)
rank: Mapped[int] = mapped_column(Integer)
value: Mapped[int] = mapped_column(Integer)
change: Mapped[int] = mapped_column(Integer)
class User(Base):