This commit is contained in:
2026-05-01 11:03:19 +08:00
parent b6a199887e
commit aa8a1190f0
24 changed files with 2552 additions and 0 deletions

44
schema/stock_basic.go Normal file
View File

@@ -0,0 +1,44 @@
package schema
import "gorm.io/gorm"
// StockBasic 股票基本信息表(合并 dataset/stock 与 gostock 字段gostock 独有 Level、Desc
type StockBasic struct {
gorm.Model
TsCode string `gorm:"type:varchar(50);not null;index;comment:TS代码"`
Symbol string `gorm:"type:varchar(50);not null;comment:股票代码"`
Name string `gorm:"type:varchar(50);not null;comment:股票名称"`
Area string `gorm:"type:varchar(50);not null;default:'';comment:地域"`
Industry string `gorm:"type:varchar(50);not null;default:'';comment:所属行业"`
FullName string `gorm:"type:varchar(500);comment:股票全称"`
EnName string `gorm:"type:varchar(200);comment:英文全称"`
CnSpell string `gorm:"type:varchar(50);not null;default:'';comment:拼音缩写"`
Market string `gorm:"type:varchar(50);not null;comment:市场类型(主板/创业板/科创板/CDR"`
Exchange string `gorm:"type:varchar(50);comment:交易所代码"`
ListDate string `gorm:"type:varchar(50);not null;comment:上市日期"`
IsHS string `gorm:"type:varchar(2);default:'N';comment:是否沪深港通标的N否 H沪股通 S深股通"`
ActName string `gorm:"type:varchar(500);not null;default:'';comment:实控人名称"`
ActEntType string `gorm:"type:varchar(50);not null;default:'';comment:实控人企业性质"`
}
func (StockBasic) TableName() string {
return "stock_basic"
}
// Key 业务主键TS 代码。
func (s *StockBasic) Key() string {
return s.TsCode
}
// DisplaySymbol 展示用代码:有 symbol 用 symbol否则用 ts_code。
func (s *StockBasic) DisplaySymbol() string {
if s.Symbol != "" {
return s.Symbol
}
return s.TsCode
}
// IsNorthbound 是否沪深港通标的H 沪股通 / S 深股通)。
func (s *StockBasic) IsNorthbound() bool {
return s.IsHS == "H" || s.IsHS == "S"
}