更新
This commit is contained in:
+26
-16
@@ -2,25 +2,35 @@ package model
|
||||
|
||||
import "time"
|
||||
|
||||
// StockDaily 对应数据库中的 stock_daily 表
|
||||
type StockDaily struct {
|
||||
TsCode string `gorm:"column:ts_code"`
|
||||
TradeDate time.Time `gorm:"column:trade_date"`
|
||||
Open float64 `gorm:"column:open"`
|
||||
High float64 `gorm:"column:high"`
|
||||
Low float64 `gorm:"column:low"`
|
||||
Close float64 `gorm:"column:close"`
|
||||
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"`
|
||||
}
|
||||
|
||||
func (StockDaily) TableName() string { return "stock_daily" }
|
||||
// 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"`
|
||||
PostMinLow float64 `json:"post_min_low"`
|
||||
DropPct *float64 `json:"drop_pct"` // 改为指针以支持 null
|
||||
ReboundPct *float64 `json:"rebound_pct"` // 改为指针以支持 null
|
||||
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"` // 用于前端画图的收盘价序列
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user