feat:股票相关类型定义

This commit is contained in:
zdl
2025-11-22 23:10:28 +08:00
parent 5bb8a17588
commit 06916cdde5

View File

@@ -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[];
}