base_from_trade_index.go 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. package data_manage
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type BaseFromTradeShanghaiIndex struct {
  7. BaseFromTradeShangHaiIndexId int `orm:"column(base_from_trade_shanghai_index_id);pk"`
  8. Rank int
  9. DealShortName string
  10. DealName string
  11. DealCode string
  12. DealValue string
  13. DealChange string
  14. BuyShortName string
  15. BuyName string
  16. BuyCode string
  17. BuyValue string
  18. BuyChange string
  19. SoldShortName string
  20. SoldName string
  21. SoldCode string
  22. SoldValue string
  23. SoldChange string
  24. Frequency string
  25. ClassifyName string
  26. ClassifyType string
  27. CreateTime time.Time
  28. ModifyTime time.Time
  29. DataTime string
  30. }
  31. func GetFirstBaseFromTradeIndexByDate(exchange string) (item *BaseFromTradeShanghaiIndex, err error) {
  32. o := orm.NewOrmUsingDB("data")
  33. sql := "SELECT * FROM base_from_trade_" + exchange + "_index where rank < 50 order by data_time asc"
  34. err = o.Raw(sql).QueryRow(&item)
  35. return
  36. }