1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- package data_manage
- import (
- "fmt"
- "github.com/beego/beego/v2/client/orm"
- "time"
- )
- type ShfeData struct {
- InputValue string `orm:"column(DATA_VALUE)" description:"日期"`
- DataTime string `orm:"column(DATA_DATE)" description:"值"`
- }
- type BaseFromShfeDataSimple struct {
- Id int `orm:"column(base_from_trade_ine_index_id);pk"`
- DealCode string
- BuyCode string
- SoldCode string
- DataTime string
- DealValue string
- BuyValue string
- SoldValue string
- }
- type BaseInfoFromShfe struct {
- DealName string
- BuyName string
- SoldName string
- }
- type BaseFromTradeShfeIndex struct {
- BaseFromTradeShfeIndexId int `orm:"column(base_from_trade_ine_index_id);pk"`
- Rank int
- DealShortName string
- DealName string
- DealCode string
- DealValue string
- DealChange int
- BuyShortName string
- BuyName string
- BuyCode string
- BuyValue string
- BuyChange int
- SoldShortName string
- SoldName string
- SoldCode string
- SoldValue string
- SoldChange int
- Frequency string
- ClassifyName string
- ClassifyType string
- CreateTime time.Time
- ModifyTime time.Time
- DataTime string
- }
- func GetEdbDataShfeMaxOrMinDate(edbCode string) (minDate, maxDate string, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT MIN(data_time) AS minDate,MAX(data_time) AS maxDate FROM edb_data_ine WHERE edb_code=? `
- err = o.Raw(sql, edbCode).QueryRow(&minDate, &maxDate)
- return
- }
- // GetBaseInfoFromShfeByIndexCode 获取指标信息
- func GetBaseInfoFromShfeByIndexCode(indexCode, suffix string) (list []*BaseInfoFromShfe, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := `SELECT * FROM base_from_trade_ine_index WHERE %s_code=? `
- sql = fmt.Sprintf(sql, suffix)
- _, err = o.Raw(sql, indexCode).QueryRows(&list)
- return
- }
|