Files
qsdk/schema/dataset_basic.go

45 lines
1.8 KiB
Go
Raw Normal View History

2026-05-01 11:03:19 +08:00
package schema
import "gorm.io/gorm"
2026-05-01 17:47:58 +08:00
// DatasetBasic 股票基本信息表(合并 dataset/stock 与 gostock 字段gostock 独有 Level、Desc
type DatasetBasic struct {
2026-05-01 11:03:19 +08:00
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:实控人企业性质"`
}
2026-05-01 17:47:58 +08:00
func (DatasetBasic) TableName() string {
return "dataset_basic"
2026-05-01 11:03:19 +08:00
}
// Key 业务主键TS 代码。
2026-05-01 17:47:58 +08:00
func (s *DatasetBasic) Key() string {
2026-05-01 11:03:19 +08:00
return s.TsCode
}
// DisplaySymbol 展示用代码:有 symbol 用 symbol否则用 ts_code。
2026-05-01 17:47:58 +08:00
func (s *DatasetBasic) DisplaySymbol() string {
2026-05-01 11:03:19 +08:00
if s.Symbol != "" {
return s.Symbol
}
return s.TsCode
}
// IsNorthbound 是否沪深港通标的H 沪股通 / S 深股通)。
2026-05-01 17:47:58 +08:00
func (s *DatasetBasic) IsNorthbound() bool {
2026-05-01 11:03:19 +08:00
return s.IsHS == "H" || s.IsHS == "S"
}