claude强化功能
This commit is contained in:
@@ -221,3 +221,131 @@ class JobRun(Base):
|
||||
started_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
finished_at: Mapped[dt.datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
message: Mapped[str] = mapped_column(Text, default="")
|
||||
|
||||
|
||||
class SelectorStrategy(Base):
|
||||
"""选股策略保存。"""
|
||||
__tablename__ = "selector_strategies"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
name: Mapped[str] = mapped_column(String(80))
|
||||
description: Mapped[str] = mapped_column(String(200), default="")
|
||||
strategy_json: Mapped[str] = mapped_column(Text) # JSON格式的策略定义
|
||||
is_preset: Mapped[bool] = mapped_column(default=False) # 是否预设策略
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
updated_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class SelectorAlert(Base):
|
||||
"""选股条件预警。"""
|
||||
__tablename__ = "selector_alerts"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
strategy_id: Mapped[int] = mapped_column(Integer, index=True)
|
||||
strategy_name: Mapped[str] = mapped_column(String(80))
|
||||
status: Mapped[str] = mapped_column(String(12), default="active") # active/paused
|
||||
last_checked: Mapped[dt.datetime | None] = mapped_column(DateTime, nullable=True)
|
||||
last_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class SocialPost(Base):
|
||||
"""社区帖子。"""
|
||||
__tablename__ = "social_posts"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
source: Mapped[str] = mapped_column(String(20), index=True) # eastmoney/xueqiu/guba
|
||||
post_id: Mapped[str] = mapped_column(String(100), unique=True)
|
||||
code: Mapped[str] = mapped_column(String(12), index=True, default="")
|
||||
title: Mapped[str] = mapped_column(String(200))
|
||||
content: Mapped[str] = mapped_column(Text, default="")
|
||||
author: Mapped[str] = mapped_column(String(80), default="")
|
||||
comment_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
view_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
sentiment: Mapped[str] = mapped_column(String(20), default="neutral") # bullish/bearish/neutral
|
||||
keywords: Mapped[str] = mapped_column(String(200), default="") # 逗号分隔
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now(), index=True)
|
||||
|
||||
|
||||
class SentimentIndex(Base):
|
||||
"""社区情绪指数(每日)。"""
|
||||
__tablename__ = "sentiment_index"
|
||||
date: Mapped[dt.date] = mapped_column(Date, primary_key=True)
|
||||
bullish_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
bearish_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
neutral_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
bullish_ratio: Mapped[float] = mapped_column(Float, default=0.0) # 0-100
|
||||
total_posts: Mapped[int] = mapped_column(Integer, default=0)
|
||||
top_keywords: Mapped[str] = mapped_column(String(500), default="") # JSON格式
|
||||
updated_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class CorporateEvent(Base):
|
||||
"""公司事件(财报、增减持、限售解禁等)。"""
|
||||
__tablename__ = "corporate_events"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(12), index=True)
|
||||
name: Mapped[str] = mapped_column(String(40), default="")
|
||||
event_type: Mapped[str] = mapped_column(String(20), index=True) # earnings/insider/unlock/dividend
|
||||
event_date: Mapped[dt.date] = mapped_column(Date, index=True)
|
||||
title: Mapped[str] = mapped_column(String(200))
|
||||
description: Mapped[str] = mapped_column(Text, default="")
|
||||
amount: Mapped[float] = mapped_column(Float, default=0.0) # 金额(亿元)
|
||||
impact: Mapped[str] = mapped_column(String(20), default="neutral") # positive/negative/neutral
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class PolicyEvent(Base):
|
||||
"""行业政策事件。"""
|
||||
__tablename__ = "policy_events"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
sector: Mapped[str] = mapped_column(String(40), index=True) # 受影响板块
|
||||
event_date: Mapped[dt.date] = mapped_column(Date, index=True)
|
||||
title: Mapped[str] = mapped_column(String(200))
|
||||
content: Mapped[str] = mapped_column(Text, default="")
|
||||
policy_type: Mapped[str] = mapped_column(String(40)) # subsidy/restriction/support/regulation
|
||||
impact: Mapped[str] = mapped_column(String(20), default="neutral")
|
||||
affected_stocks: Mapped[str] = mapped_column(String(500), default="") # 逗号分隔的股票代码
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class FinancialReport(Base):
|
||||
"""财务报表数据。"""
|
||||
__tablename__ = "financial_reports"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(12), index=True)
|
||||
name: Mapped[str] = mapped_column(String(40), default="")
|
||||
report_date: Mapped[dt.date] = mapped_column(Date, index=True) # 报告期
|
||||
publish_date: Mapped[dt.date] = mapped_column(Date, index=True) # 发布日期
|
||||
report_type: Mapped[str] = mapped_column(String(20)) # Q1/Q2/Q3/annual
|
||||
|
||||
# 核心指标
|
||||
revenue: Mapped[float] = mapped_column(Float, default=0.0) # 营收(亿元)
|
||||
net_profit: Mapped[float] = mapped_column(Float, default=0.0) # 净利润(亿元)
|
||||
roe: Mapped[float] = mapped_column(Float, default=0.0) # 净资产收益率(%)
|
||||
gross_margin: Mapped[float] = mapped_column(Float, default=0.0) # 毛利率(%)
|
||||
revenue_growth: Mapped[float] = mapped_column(Float, default=0.0) # 营收同比增长(%)
|
||||
profit_growth: Mapped[float] = mapped_column(Float, default=0.0) # 净利润同比增长(%)
|
||||
|
||||
# 风险指标
|
||||
inventory: Mapped[float] = mapped_column(Float, default=0.0) # 存货(亿元)
|
||||
receivable: Mapped[float] = mapped_column(Float, default=0.0) # 应收账款(亿元)
|
||||
debt_ratio: Mapped[float] = mapped_column(Float, default=0.0) # 资产负债率(%)
|
||||
|
||||
# AI摘要
|
||||
ai_summary: Mapped[str] = mapped_column(String(500), default="")
|
||||
|
||||
created_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now())
|
||||
|
||||
|
||||
class IntradayEvent(Base):
|
||||
"""盘中异动事件记录。"""
|
||||
__tablename__ = "intraday_events"
|
||||
id: Mapped[int] = mapped_column(Integer, primary_key=True, autoincrement=True)
|
||||
code: Mapped[str] = mapped_column(String(12), index=True)
|
||||
name: Mapped[str] = mapped_column(String(40), default="")
|
||||
event_type: Mapped[str] = mapped_column(String(20), index=True) # surge/volume_break/limit_open/consecutive/big_order
|
||||
price: Mapped[float] = mapped_column(Float, default=0.0)
|
||||
pct: Mapped[float] = mapped_column(Float, default=0.0)
|
||||
volume_ratio: Mapped[float] = mapped_column(Float, default=0.0)
|
||||
amount: Mapped[float] = mapped_column(Float, default=0.0) # 对于big_order是单笔金额
|
||||
description: Mapped[str] = mapped_column(String(200), default="")
|
||||
detected_at: Mapped[dt.datetime] = mapped_column(DateTime, server_default=func.now(), index=True)
|
||||
notified: Mapped[bool] = mapped_column(default=False)
|
||||
|
||||
Reference in New Issue
Block a user