init
This commit is contained in:
31
internal/config/config.go
Normal file
31
internal/config/config.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
||||
"git.apinb.com/bsm-sdk/core/conf"
|
||||
)
|
||||
|
||||
var (
|
||||
Spec SrvConfig
|
||||
)
|
||||
|
||||
type SrvConfig struct {
|
||||
conf.Base `yaml:",inline"`
|
||||
Databases *conf.DBConf `yaml:"Databases"`
|
||||
}
|
||||
|
||||
func New(srvKey string) {
|
||||
// 初始化配置 创建一个新的配置实例,用于服务配置
|
||||
conf.New(srvKey, &Spec)
|
||||
|
||||
// 配置校验 服务IP,端口; 端口如果不合规,则随机分配端口
|
||||
Spec.Port = conf.CheckPort(Spec.Port)
|
||||
Spec.BindIP = conf.CheckIP(Spec.BindIP)
|
||||
Spec.Addr = net.JoinHostPort(Spec.BindIP, Spec.Port)
|
||||
|
||||
// 配置校验 服务名称地址及监听地址不能为空
|
||||
conf.NotNil(Spec.Service, Spec.Cache)
|
||||
|
||||
conf.PrintInfo(Spec.Addr)
|
||||
}
|
||||
21
internal/impl/impl.go
Normal file
21
internal/impl/impl.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package impl
|
||||
|
||||
import (
|
||||
"git.apinb.com/bsm-sdk/core/cache/redis"
|
||||
"git.apinb.com/bsm-sdk/core/with"
|
||||
"git.apinb.com/quant/gostock/internal/config"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
var (
|
||||
RedisService *redis.RedisClient // Redis 客户端服务
|
||||
DBService *gorm.DB
|
||||
)
|
||||
|
||||
func NewImpl() {
|
||||
// 初始化 Redis 缓存
|
||||
RedisService = with.RedisCache(config.Spec.Cache)
|
||||
DBService = with.Databases(config.Spec.Databases, nil) // model
|
||||
|
||||
with.Logger(config.Spec.Log)
|
||||
}
|
||||
15
internal/logic/restful/ping.go
Normal file
15
internal/logic/restful/ping.go
Normal file
@@ -0,0 +1,15 @@
|
||||
package restful
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func Ping(ctx *gin.Context) {
|
||||
ctx.JSON(200, gin.H{
|
||||
"message": "pong",
|
||||
"timeseq": time.Now().UnixNano() / 1000,
|
||||
})
|
||||
return
|
||||
}
|
||||
4
internal/logic/strategy/boot.go
Normal file
4
internal/logic/strategy/boot.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package strategy
|
||||
|
||||
func Boot() {
|
||||
}
|
||||
5
internal/models/query.go
Normal file
5
internal/models/query.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package models
|
||||
|
||||
// 初始化数据
|
||||
func InitData() {
|
||||
}
|
||||
29
internal/models/stock_basic.go
Normal file
29
internal/models/stock_basic.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// StockBasic 股票基本信息表
|
||||
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:实控人企业性质"`
|
||||
}
|
||||
|
||||
// TableName 设置表名
|
||||
func (StockBasic) TableName() string {
|
||||
return "stock_basic"
|
||||
}
|
||||
22
internal/models/stock_daily.go
Normal file
22
internal/models/stock_daily.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package models
|
||||
|
||||
// LastDaily 股票日线数据
|
||||
type StockDaily struct {
|
||||
ID uint `gorm:"primarykey;autoIncrement" json:"id"`
|
||||
TsCode string `gorm:"type:varchar(20);not null;index:idx_ts_code;uniqueIndex:un_code_date;comment:股票代码" json:"ts_code"`
|
||||
TradeDate int `gorm:"index:idx_trade_date;uniqueIndex:un_code_date;comment:交易日期" json:"trade_date"`
|
||||
Open float64 `gorm:"type:decimal(10,4);comment:开盘价" json:"open"`
|
||||
High float64 `gorm:"type:decimal(10,4);comment:最高价" json:"high"`
|
||||
Low float64 `gorm:"type:decimal(10,4);comment:最低价" json:"low"`
|
||||
Close float64 `gorm:"type:decimal(10,4);comment:收盘价" json:"close"`
|
||||
PreClose float64 `gorm:"type:decimal(10,4);comment:昨收价(除权价)" json:"pre_close"`
|
||||
Change float64 `gorm:"type:decimal(10,4);comment:涨跌额" json:"change"`
|
||||
PctChg float64 `gorm:"type:decimal(10,6);comment:涨跌幅(%)" json:"pct_chg"`
|
||||
Vol float64 `gorm:"type:decimal(15,2);comment:成交量(手)" json:"vol"`
|
||||
Amount float64 `gorm:"type:decimal(20,2);comment:成交额(千元)" json:"amount"`
|
||||
}
|
||||
|
||||
// TableName 指定表名
|
||||
func (StockDaily) TableName() string {
|
||||
return "stock_daily"
|
||||
}
|
||||
208
internal/models/stock_fina_indicator.go
Normal file
208
internal/models/stock_fina_indicator.go
Normal file
@@ -0,0 +1,208 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
|
||||
// StockFinaIndicator 财务指标模型
|
||||
type StockFinaIndicator struct {
|
||||
gorm.Model
|
||||
TsCode string `gorm:"type:varchar(20);not null;index:fi_ts_code;uniqueIndex:un_fi_code_date;comment:TS代码"`
|
||||
Period int `gorm:"index:idx_period;uniqueIndex:un_fi_code_date;comment:报告期数"`
|
||||
AnnDate string `gorm:"index:idx_ann_date;comment:公告日期"`
|
||||
EndDate string `gorm:"index:idx_end_date;comment:报告期"`
|
||||
|
||||
// 每股指标
|
||||
Eps float64 `gorm:"type:decimal(20,4);comment:基本每股收益"`
|
||||
DtEps float64 `gorm:"type:decimal(20,4);comment:稀释每股收益"`
|
||||
TotalRevenuePs float64 `gorm:"type:decimal(20,4);comment:每股营业总收入"`
|
||||
RevenuePs float64 `gorm:"type:decimal(20,4);comment:每股营业收入"`
|
||||
CapitalResePs float64 `gorm:"type:decimal(20,4);comment:每股资本公积"`
|
||||
SurplusResePs float64 `gorm:"type:decimal(20,4);comment:每股盈余公积"`
|
||||
UndistProfitPs float64 `gorm:"type:decimal(20,4);comment:每股未分配利润"`
|
||||
Diluted2Eps float64 `gorm:"type:decimal(20,4);comment:期末摊薄每股收益"`
|
||||
Bps float64 `gorm:"type:decimal(20,4);comment:每股净资产"`
|
||||
Ocfps float64 `gorm:"type:decimal(20,4);comment:每股经营活动产生的现金流量净额"`
|
||||
Retainedps float64 `gorm:"type:decimal(20,4);comment:每股留存收益"`
|
||||
Cfps float64 `gorm:"type:decimal(20,4);comment:每股现金流量净额"`
|
||||
EbitPs float64 `gorm:"type:decimal(20,4);comment:每股息税前利润"`
|
||||
FcffPs float64 `gorm:"type:decimal(20,4);comment:每股企业自由现金流量"`
|
||||
FcfePs float64 `gorm:"type:decimal(20,4);comment:每股股东自由现金流量"`
|
||||
|
||||
// 利润表相关
|
||||
ExtraItem float64 `gorm:"type:decimal(20,4);comment:非经常性损益"`
|
||||
ProfitDedt float64 `gorm:"type:decimal(20,4);comment:扣除非经常性损益后的净利润"`
|
||||
GrossMargin float64 `gorm:"type:decimal(20,4);comment:毛利"`
|
||||
OpIncome float64 `gorm:"type:decimal(20,4);comment:经营活动净收益"`
|
||||
ValuechangeIncome float64 `gorm:"type:decimal(20,4);comment:价值变动净收益"`
|
||||
InterstIncome float64 `gorm:"type:decimal(20,4);comment:利息费用"`
|
||||
Daa float64 `gorm:"type:decimal(20,4);comment:折旧与摊销"`
|
||||
Ebit float64 `gorm:"type:decimal(20,4);comment:息税前利润"`
|
||||
Ebitda float64 `gorm:"type:decimal(20,4);comment:息税折旧摊销前利润"`
|
||||
Fcff float64 `gorm:"type:decimal(20,4);comment:企业自由现金流量"`
|
||||
Fcfe float64 `gorm:"type:decimal(20,4);comment:股权自由现金流量"`
|
||||
RdExp float64 `gorm:"type:decimal(20,4);comment:研发费用"`
|
||||
FixedAssets float64 `gorm:"type:decimal(20,4);comment:固定资产合计"`
|
||||
ProfitPrefinExp float64 `gorm:"type:decimal(20,4);comment:扣除财务费用前营业利润"`
|
||||
NonOpProfit float64 `gorm:"type:decimal(20,4);comment:非营业利润"`
|
||||
|
||||
// 资产负债表相关
|
||||
CurrentExint float64 `gorm:"type:decimal(20,4);comment:无息流动负债"`
|
||||
NoncurrentExint float64 `gorm:"type:decimal(20,4);comment:无息非流动负债"`
|
||||
Interestdebt float64 `gorm:"type:decimal(20,4);comment:带息债务"`
|
||||
Netdebt float64 `gorm:"type:decimal(20,4);comment:净债务"`
|
||||
TangibleAsset float64 `gorm:"type:decimal(20,4);comment:有形资产"`
|
||||
WorkingCapital float64 `gorm:"type:decimal(20,4);comment:营运资金"`
|
||||
NetworkingCapital float64 `gorm:"type:decimal(20,4);comment:营运流动资本"`
|
||||
InvestCapital float64 `gorm:"type:decimal(20,4);comment:全部投入资本"`
|
||||
RetainedEarnings float64 `gorm:"type:decimal(20,4);comment:留存收益"`
|
||||
|
||||
// 偿债能力指标
|
||||
CurrentRatio float64 `gorm:"type:decimal(20,4);comment:流动比率"`
|
||||
QuickRatio float64 `gorm:"type:decimal(20,4);comment:速动比率"`
|
||||
CashRatio float64 `gorm:"type:decimal(20,4);comment:保守速动比率"`
|
||||
DebtToAssets float64 `gorm:"type:decimal(20,4);comment:资产负债率"`
|
||||
AssetsToEqt float64 `gorm:"type:decimal(20,4);comment:权益乘数"`
|
||||
DpAssetsToEqt float64 `gorm:"type:decimal(20,4);comment:权益乘数(杜邦分析)"`
|
||||
DebtToEqt float64 `gorm:"type:decimal(20,4);comment:产权比率"`
|
||||
EqtToDebt float64 `gorm:"type:decimal(20,4);comment:归属于母公司的股东权益/负债合计"`
|
||||
OcfToShortdebt float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/流动负债"`
|
||||
EbitToInterest float64 `gorm:"type:decimal(20,4);comment:已获利息倍数"`
|
||||
|
||||
// 运营能力指标
|
||||
InvturnDays float64 `gorm:"type:decimal(20,4);comment:存货周转天数"`
|
||||
ArturnDays float64 `gorm:"type:decimal(20,4);comment:应收账款周转天数"`
|
||||
InvTurn float64 `gorm:"type:decimal(20,4);comment:存货周转率"`
|
||||
ArTurn float64 `gorm:"type:decimal(20,4);comment:应收账款周转率"`
|
||||
CaTurn float64 `gorm:"type:decimal(20,4);comment:流动资产周转率"`
|
||||
FaTurn float64 `gorm:"type:decimal(20,4);comment:固定资产周转率"`
|
||||
AssetsTurn float64 `gorm:"type:decimal(20,4);comment:总资产周转率"`
|
||||
TurnDays float64 `gorm:"type:decimal(20,4);comment:营业周期"`
|
||||
TotalFaTrun float64 `gorm:"type:decimal(20,4);comment:固定资产合计周转率"`
|
||||
|
||||
// 盈利能力指标
|
||||
NetprofitMargin float64 `gorm:"type:decimal(20,4);comment:销售净利率"`
|
||||
GrossprofitMargin float64 `gorm:"type:decimal(20,4);comment:销售毛利率"`
|
||||
CogsOfSales float64 `gorm:"type:decimal(20,4);comment:销售成本率"`
|
||||
ExpenseOfSales float64 `gorm:"type:decimal(20,4);comment:销售期间费用率"`
|
||||
Roe float64 `gorm:"type:decimal(20,4);comment:净资产收益率"`
|
||||
RoeWaa float64 `gorm:"type:decimal(20,4);comment:加权平均净资产收益率"`
|
||||
RoeDt float64 `gorm:"type:decimal(20,4);comment:净资产收益率(扣除非经常损益)"`
|
||||
Roa float64 `gorm:"type:decimal(20,4);comment:总资产报酬率"`
|
||||
Npta float64 `gorm:"type:decimal(20,4);comment:总资产净利润"`
|
||||
Roic float64 `gorm:"type:decimal(20,4);comment:投入资本回报率"`
|
||||
RoaDp float64 `gorm:"type:decimal(20,4);comment:总资产净利率(杜邦分析)"`
|
||||
|
||||
// 结构指标
|
||||
CaToAssets float64 `gorm:"type:decimal(20,4);comment:流动资产/总资产"`
|
||||
NcaToAssets float64 `gorm:"type:decimal(20,4);comment:非流动资产/总资产"`
|
||||
TbassetsToTotalassets float64 `gorm:"type:decimal(20,4);comment:有形资产/总资产"`
|
||||
IntToTalcap float64 `gorm:"type:decimal(20,4);comment:带息债务/全部投入资本"`
|
||||
EqtToTalcapital float64 `gorm:"type:decimal(20,4);comment:归属于母公司的股东权益/全部投入资本"`
|
||||
CurrentdebtToDebt float64 `gorm:"type:decimal(20,4);comment:流动负债/负债合计"`
|
||||
LongdebToDebt float64 `gorm:"type:decimal(20,4);comment:非流动负债/负债合计"`
|
||||
TangibleassetToDebt float64 `gorm:"type:decimal(20,4);comment:有形资产/负债合计"`
|
||||
|
||||
// 单季度指标
|
||||
QOpincome float64 `gorm:"type:decimal(20,4);comment:经营活动单季度净收益"`
|
||||
QInvestincome float64 `gorm:"type:decimal(20,4);comment:价值变动单季度净收益"`
|
||||
QDtprofit float64 `gorm:"type:decimal(20,4);comment:扣除非经常损益后的单季度净利润"`
|
||||
QEps float64 `gorm:"type:decimal(20,4);comment:每股收益(单季度)"`
|
||||
QNetprofitMargin float64 `gorm:"type:decimal(20,4);comment:销售净利率(单季度)"`
|
||||
QGscaleprofitMargin float64 `gorm:"type:decimal(20,4);comment:销售毛利率(单季度)"`
|
||||
QExpToSales float64 `gorm:"type:decimal(20,4);comment:销售期间费用率(单季度)"`
|
||||
QRoe float64 `gorm:"type:decimal(20,4);comment:净资产收益率(单季度)"`
|
||||
QDtRoe float64 `gorm:"type:decimal(20,4);comment:净资产单季度收益率(扣除非经常损益)"`
|
||||
QNpta float64 `gorm:"type:decimal(20,4);comment:总资产净利润(单季度)"`
|
||||
|
||||
// 同比增长率
|
||||
BasicEpsYoy float64 `gorm:"type:decimal(20,4);comment:基本每股收益同比增长率(%)"`
|
||||
DtEpsYoy float64 `gorm:"type:decimal(20,4);comment:稀释每股收益同比增长率(%)"`
|
||||
CfpsYoy float64 `gorm:"type:decimal(20,4);comment:每股经营活动产生的现金流量净额同比增长率(%)"`
|
||||
OpYoy float64 `gorm:"type:decimal(20,4);comment:营业利润同比增长率(%)"`
|
||||
EbtYoy float64 `gorm:"type:decimal(20,4);comment:利润总额同比增长率(%)"`
|
||||
NetprofitYoy float64 `gorm:"type:decimal(20,4);comment:归属母公司股东的净利润同比增长率(%)"`
|
||||
DtNetprofitYoy float64 `gorm:"type:decimal(20,4);comment:归属母公司股东的净利润-扣除非经常损益同比增长率(%)"`
|
||||
OcfYoy float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额同比增长率(%)"`
|
||||
RoeYoy float64 `gorm:"type:decimal(20,4);comment:净资产收益率(摊薄)同比增长率(%)"`
|
||||
BpsYoy float64 `gorm:"type:decimal(20,4);comment:每股净资产相对年初增长率(%)"`
|
||||
AssetsYoy float64 `gorm:"type:decimal(20,4);comment:资产总计相对年初增长率(%)"`
|
||||
EqtYoy float64 `gorm:"type:decimal(20,4);comment:归属母公司的股东权益相对年初增长率(%)"`
|
||||
TrYoy float64 `gorm:"type:decimal(20,4);comment:营业总收入同比增长率(%)"`
|
||||
OrYoy float64 `gorm:"type:decimal(20,4);comment:营业收入同比增长率(%)"`
|
||||
EquityYoy float64 `gorm:"type:decimal(20,4);comment:净资产同比增长率"`
|
||||
|
||||
// 其他比率指标
|
||||
ProfitToGr float64 `gorm:"type:decimal(20,4);comment:净利润/营业总收入"`
|
||||
SaleexpToGr float64 `gorm:"type:decimal(20,4);comment:销售费用/营业总收入"`
|
||||
AdminexpOfGr float64 `gorm:"type:decimal(20,4);comment:管理费用/营业总收入"`
|
||||
FinaexpOfGr float64 `gorm:"type:decimal(20,4);comment:财务费用/营业总收入"`
|
||||
ImpaiTtm float64 `gorm:"type:decimal(20,4);comment:资产减值损失/营业总收入"`
|
||||
GcOfGr float64 `gorm:"type:decimal(20,4);comment:营业总成本/营业总收入"`
|
||||
OpOfGr float64 `gorm:"type:decimal(20,4);comment:营业利润/营业总收入"`
|
||||
EbitOfGr float64 `gorm:"type:decimal(20,4);comment:息税前利润/营业总收入"`
|
||||
OpincomeOfEbt float64 `gorm:"type:decimal(20,4);comment:经营活动净收益/利润总额"`
|
||||
InvestincomeOfEbt float64 `gorm:"type:decimal(20,4);comment:价值变动净收益/利润总额"`
|
||||
NOpProfitOfEbt float64 `gorm:"type:decimal(20,4);comment:营业外收支净额/利润总额"`
|
||||
TaxToEbt float64 `gorm:"type:decimal(20,4);comment:所得税/利润总额"`
|
||||
DtprofitToProfit float64 `gorm:"type:decimal(20,4);comment:扣除非经常损益后的净利润/净利润"`
|
||||
SalescashToOr float64 `gorm:"type:decimal(20,4);comment:销售商品提供劳务收到的现金/营业收入"`
|
||||
OcfToOr float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/营业收入"`
|
||||
OcfToOpincome float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/经营活动净收益"`
|
||||
CapitalizedToDa float64 `gorm:"type:decimal(20,4);comment:资本支出/折旧和摊销"`
|
||||
OcfToDebt float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/负债合计"`
|
||||
OcfToInterestdebt float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/带息债务"`
|
||||
OcfToNetdebt float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/净债务"`
|
||||
LongdebtToWorkingcapital float64 `gorm:"type:decimal(20,4);comment:长期债务与营运资金比率"`
|
||||
EbitdaToDebt float64 `gorm:"type:decimal(20,4);comment:息税折旧摊销前利润/负债合计"`
|
||||
OpToEbt float64 `gorm:"type:decimal(20,4);comment:营业利润/利润总额"`
|
||||
NopToEbt float64 `gorm:"type:decimal(20,4);comment:非营业利润/利润总额"`
|
||||
OcfToProfit float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/营业利润"`
|
||||
CashToLiqdebt float64 `gorm:"type:decimal(20,4);comment:货币资金/流动负债"`
|
||||
CashToLiqdebtWithinterest float64 `gorm:"type:decimal(20,4);comment:货币资金/带息流动负债"`
|
||||
OpToLiqdebt float64 `gorm:"type:decimal(20,4);comment:营业利润/流动负债"`
|
||||
OpToDebt float64 `gorm:"type:decimal(20,4);comment:营业利润/负债合计"`
|
||||
ProfitToOp float64 `gorm:"type:decimal(20,4);comment:利润总额/营业收入"`
|
||||
|
||||
// 年度化指标
|
||||
RoeYearly float64 `gorm:"type:decimal(20,4);comment:年化净资产收益率"`
|
||||
Roa2Yearly float64 `gorm:"type:decimal(20,4);comment:年化总资产报酬率"`
|
||||
RoaYearly float64 `gorm:"type:decimal(20,4);comment:年化总资产净利率"`
|
||||
RoicYearly float64 `gorm:"type:decimal(20,4);comment:年化投入资本回报率"`
|
||||
RoeAvg float64 `gorm:"type:decimal(20,4);comment:平均净资产收益率(增发条件)"`
|
||||
|
||||
// 单季度增长比率
|
||||
QGrYoy float64 `gorm:"type:decimal(20,4);comment:营业总收入同比增长率(%)(单季度)"`
|
||||
QGrQoq float64 `gorm:"type:decimal(20,4);comment:营业总收入环比增长率(%)(单季度)"`
|
||||
QSalesYoy float64 `gorm:"type:decimal(20,4);comment:营业收入同比增长率(%)(单季度)"`
|
||||
QSalesQoq float64 `gorm:"type:decimal(20,4);comment:营业收入环比增长率(%)(单季度)"`
|
||||
QOpYoy float64 `gorm:"type:decimal(20,4);comment:营业利润同比增长率(%)(单季度)"`
|
||||
QOpQoq float64 `gorm:"type:decimal(20,4);comment:营业利润环比增长率(%)(单季度)"`
|
||||
QProfitYoy float64 `gorm:"type:decimal(20,4);comment:净利润同比增长率(%)(单季度)"`
|
||||
QProfitQoq float64 `gorm:"type:decimal(20,4);comment:净利润环比增长率(%)(单季度)"`
|
||||
QNetprofitYoy float64 `gorm:"type:decimal(20,4);comment:归属母公司股东的净利润同比增长率(%)(单季度)"`
|
||||
QNetprofitQoq float64 `gorm:"type:decimal(20,4);comment:归属母公司股东的净利润环比增长率(%)(单季度)"`
|
||||
|
||||
// 单季度比率指标
|
||||
QProfitToGr float64 `gorm:"type:decimal(20,4);comment:净利润/营业总收入(单季度)"`
|
||||
QSaleexpToGr float64 `gorm:"type:decimal(20,4);comment:销售费用/营业总收入 (单季度)"`
|
||||
QAdminexpToGr float64 `gorm:"type:decimal(20,4);comment:管理费用/营业总收入 (单季度)"`
|
||||
QFinaexpToGr float64 `gorm:"type:decimal(20,4);comment:财务费用/营业总收入 (单季度)"`
|
||||
QImpairToGrTtm float64 `gorm:"type:decimal(20,4);comment:资产减值损失/营业总收入(单季度)"`
|
||||
QGcToGr float64 `gorm:"type:decimal(20,4);comment:营业总成本/营业总收入 (单季度)"`
|
||||
QOpToGr float64 `gorm:"type:decimal(20,4);comment:营业利润/营业总收入(单季度)"`
|
||||
QOpincomeToEbt float64 `gorm:"type:decimal(20,4);comment:经营活动净收益/利润总额(单季度)"`
|
||||
QInvestincomeToEbt float64 `gorm:"type:decimal(20,4);comment:价值变动净收益/利润总额(单季度)"`
|
||||
QDtprofitToProfit float64 `gorm:"type:decimal(20,4);comment:扣除非经常损益后的净利润/净利润(单季度)"`
|
||||
QSalescashToOr float64 `gorm:"type:decimal(20,4);comment:销售商品提供劳务收到的现金/营业收入(单季度)"`
|
||||
QOcfToSales float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/营业收入(单季度)"`
|
||||
QOcfToOr float64 `gorm:"type:decimal(20,4);comment:经营活动产生的现金流量净额/经营活动净收益(单季度)"`
|
||||
|
||||
// 其他
|
||||
UpdateFlag string `gorm:"type:varchar(1);comment:更新标识"`
|
||||
}
|
||||
|
||||
// TableName 设置表名
|
||||
func (StockFinaIndicator) TableName() string {
|
||||
return "fina_indicator"
|
||||
}
|
||||
29
internal/models/stock_indicator.go
Normal file
29
internal/models/stock_indicator.go
Normal file
@@ -0,0 +1,29 @@
|
||||
package models
|
||||
|
||||
// StockIndicator 股票日线数据模型
|
||||
type StockIndicator struct {
|
||||
ID uint `gorm:"primarykey;autoIncrement"`
|
||||
TsCode string `gorm:"type:varchar(20);not null;index:si_ts_code;uniqueIndex:un_si_code_date;comment:股票代码" json:"ts_code"`
|
||||
TradeDate int `gorm:"index:si_trade_date;uniqueIndex:un_si_code_date;comment:交易日期" json:"trade_date"`
|
||||
Close float64 `gorm:"type:decimal(10,4);comment:当日收盘价"`
|
||||
TurnoverRate float64 `gorm:"type:decimal(10,6);comment:换手率(%)"`
|
||||
TurnoverRateF float64 `gorm:"type:decimal(10,6);comment:换手率(自由流通股)"`
|
||||
VolumeRatio float64 `gorm:"type:decimal(10,4);comment:量比"`
|
||||
Pe float64 `gorm:"type:decimal(10,4);comment:市盈率(总市值/净利润)"`
|
||||
PeTtm float64 `gorm:"type:decimal(10,4);comment:市盈率(TTM)"`
|
||||
Pb float64 `gorm:"type:decimal(10,4);comment:市净率"`
|
||||
Ps float64 `gorm:"type:decimal(10,4);comment:市销率"`
|
||||
PsTtm float64 `gorm:"type:decimal(10,4);comment:市销率(TTM)"`
|
||||
DvRatio float64 `gorm:"type:decimal(10,6);comment:股息率(%)"`
|
||||
DvTtm float64 `gorm:"type:decimal(10,6);comment:股息率(TTM)(%)"`
|
||||
TotalShare float64 `gorm:"type:decimal(15,2);comment:总股本(万股)"`
|
||||
FloatShare float64 `gorm:"type:decimal(15,2);comment:流通股本(万股)"`
|
||||
FreeShare float64 `gorm:"type:decimal(15,2);comment:自由流通股本(万)"`
|
||||
TotalMv float64 `gorm:"type:decimal(15,2);comment:总市值(万元)"`
|
||||
CircMv float64 `gorm:"type:decimal(15,2);comment:流通市值(万元)"`
|
||||
}
|
||||
|
||||
// TableName 设置表名
|
||||
func (StockIndicator) TableName() string {
|
||||
return "stock_indicator"
|
||||
}
|
||||
Reference in New Issue
Block a user