Files
qsdk/schema/pledge_stat.go

31 lines
1.1 KiB
Go
Raw Permalink Normal View History

2026-05-01 11:03:19 +08:00
package schema
// PledgeStat 股权质押统计(表 pledge_statdataset/stock 中原为 PledgeStatModel业务层 Save 请留在各应用内)。
type PledgeStat struct {
ID uint `gorm:"primarykey" json:"id"`
TsCode string `gorm:"type:varchar(50);not null;default:'';comment:股票代码;uniqueIndex:uq_pledge_stat_ts_code" json:"ts_code"`
EndDate int `gorm:"type:int;not null;default:0;comment:截止日期" json:"end_date"`
PledgeCount float64 `json:"pledge_count"`
UnrestPledge float64 `json:"unrest_pledge"`
RestPledge float64 `json:"rest_pledge"`
TotalShare float64 `json:"total_share"`
PledgeRatio float64 `json:"pledge_ratio"`
}
func (PledgeStat) TableName() string {
return "pledge_stat"
}
// Key 与唯一约束 uq_pledge_stat_ts_code 一致ts_code。
func (p *PledgeStat) Key() string {
return p.TsCode
}
// HasPledgeFacts 是否具备任一质押统计字段(比例、次数或股本)。
func (p *PledgeStat) HasPledgeFacts() bool {
return p.PledgeRatio > 0 || p.PledgeCount > 0 || p.TotalShare > 0
}
// PledgeStatModel 兼容 dataset/stock 中的类型名。
type PledgeStatModel = PledgeStat