21 lines
905 B
Go
21 lines
905 B
Go
package model
|
|
|
|
import "time"
|
|
|
|
// TradeCalendar 映射交易日历表,用于判断某天是否为指定交易所的开市日。
|
|
type TradeCalendar struct {
|
|
CalDate time.Time `gorm:"column:cal_date;primaryKey"` // 日历日期。
|
|
Exchange string `gorm:"column:exchange;primaryKey"` // 交易所代码,例如 SSE。
|
|
IsOpen int `gorm:"column:is_open"` // 是否开市,1 表示开市。
|
|
PretradeDate time.Time `gorm:"column:pretrade_date"` // 上一个交易日。
|
|
}
|
|
|
|
// TableName 指定 GORM 查询时使用 trade_calendar 表。
|
|
func (TradeCalendar) TableName() string { return "trade_calendar" }
|
|
|
|
// CalendarResponse 是交易日历接口响应。
|
|
type CalendarResponse struct {
|
|
OpenDates []string `json:"open_dates"` // 所有开市日期,格式 YYYY-MM-DD。
|
|
MaxDate string `json:"max_date"` // 当前返回结果中的最大开市日期。
|
|
}
|