Files
go/internal/model/stock.go
T
2026-04-26 21:26:15 +08:00

37 lines
1.6 KiB
Go

package model
import "time"
// StockDaily 对应数据库中的 stock_daily 表
type StockDaily struct {
TsCode string `gorm:"column:ts_code" json:"ts_code"`
TradeDate time.Time `gorm:"column:trade_date" json:"trade_date"`
Open float64 `gorm:"column:open" json:"open"`
High float64 `gorm:"column:high" json:"high"`
Low float64 `gorm:"column:low" json:"low"`
Close float64 `gorm:"column:close" json:"close"`
PctChg float64 `gorm:"column:pct_chg" json:"pct_chg"`
}
// AnalyzeRequest 用于接收前端 POST 请求的参数
type AnalyzeRequest struct {
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
}
// AnalysisResponse 用于向前端返回分析结果
type AnalysisResponse struct {
Code string `json:"code"`
Name string `json:"name"`
DayOpen float64 `json:"day_open"`
DayHigh float64 `json:"day_high"`
MaxHigh float64 `json:"max_high"` // 逻辑最高点(用于计算降幅)
MaxDate string `json:"max_date"` // 逻辑最高点日期
OverallMaxHigh float64 `json:"overall_max_high"` // 区间绝对最高点
OverallMaxDate string `json:"overall_max_date"` // 区间绝对最高点日期
PostMinLow float64 `json:"post_min_low"` // 涨停日后的最低点
DropPct *float64 `json:"drop_pct"` // 降幅 (跌破涨停价才有)
ReboundPct *float64 `json:"rebound_pct"` // 涨幅/反弹
ClosePrices []float64 `json:"close_prices"` // 用于前端画图的收盘价序列
}