Files
qsdk/schema/dataset_basic.go
2026-05-01 17:47:58 +08:00

45 lines
1.8 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package schema
import "gorm.io/gorm"
// DatasetBasic 股票基本信息表(合并 dataset/stock 与 gostock 字段gostock 独有 Level、Desc
type DatasetBasic 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 (DatasetBasic) TableName() string {
return "dataset_basic"
}
// Key 业务主键TS 代码。
func (s *DatasetBasic) Key() string {
return s.TsCode
}
// DisplaySymbol 展示用代码:有 symbol 用 symbol否则用 ts_code。
func (s *DatasetBasic) DisplaySymbol() string {
if s.Symbol != "" {
return s.Symbol
}
return s.TsCode
}
// IsNorthbound 是否沪深港通标的H 沪股通 / S 深股通)。
func (s *DatasetBasic) IsNorthbound() bool {
return s.IsHS == "H" || s.IsHS == "S"
}