diff --git a/src/components/StockChart/types/stock.types.ts b/src/components/StockChart/types/stock.types.ts new file mode 100644 index 00000000..f972f963 --- /dev/null +++ b/src/components/StockChart/types/stock.types.ts @@ -0,0 +1,80 @@ +/** + * 股票相关类型定义 + * + * 用于股票信息和图表数据的类型声明 + */ + +import type { RawDataPoint } from './chart.types'; + +/** + * 股票基础信息 + */ +export interface StockInfo { + /** 股票代码(如:600000.SH) */ + stock_code: string; + /** 股票名称(如:浦发银行) */ + stock_name: string; + /** 关联描述(可能是字符串或对象) */ + relation_desc?: + | string + | { + /** 数据字段 */ + data?: string; + /** 内容字段 */ + content?: string; + }; +} + +/** + * 图表数据 API 响应格式 + */ +export interface ChartDataResponse { + /** K 线数据数组 */ + data: RawDataPoint[]; + /** 交易日期(YYYY-MM-DD) */ + trade_date?: string; + /** 昨收价 */ + prev_close?: number; + /** 状态码(可选) */ + code?: number; + /** 消息(可选) */ + message?: string; +} + +/** + * 股票实时行情 + */ +export interface StockQuote { + /** 股票代码 */ + stock_code: string; + /** 当前价 */ + price: number; + /** 涨跌幅(%) */ + change_percent: number; + /** 涨跌额 */ + change_amount: number; + /** 成交量 */ + volume: number; + /** 成交额 */ + turnover: number; + /** 更新时间 */ + update_time: string; +} + +/** + * 事件信息(用于事件中心) + */ +export interface EventInfo { + /** 事件 ID */ + id: number | string; + /** 事件标题 */ + title: string; + /** 事件内容 */ + content: string; + /** 事件发生时间(ISO 字符串) */ + event_time: string; + /** 重要性等级(1-5) */ + importance?: number; + /** 关联股票列表 */ + related_stocks?: StockInfo[]; +}