fix bug
This commit is contained in:
@@ -4,7 +4,7 @@ import "git.apinb.com/dataset/stock/internal/logic/a"
|
||||
|
||||
func Boot() {
|
||||
a.NewApiClient()
|
||||
//a.GetStockBasic()
|
||||
a.GetStockBasic()
|
||||
a.GetStockDaily()
|
||||
//a.GetStockIndicator()
|
||||
a.GetStockIndicator()
|
||||
}
|
||||
|
||||
@@ -33,7 +33,6 @@ func GetStockDaily() {
|
||||
for _, item := range reply.Data.Items {
|
||||
var cnt int64
|
||||
impl.DBService.Model(&models.StockDaily{}).Where("ts_code=? and trade_date=?", item[0].(string), item[1].(string)).Count(&cnt)
|
||||
log.Println("++ items")
|
||||
if cnt == 0 {
|
||||
impl.DBService.Create(&models.StockDaily{
|
||||
TsCode: item[0].(string),
|
||||
|
||||
@@ -2,6 +2,7 @@ package a
|
||||
|
||||
import (
|
||||
"log"
|
||||
"strings"
|
||||
|
||||
"git.apinb.com/dataset/stock/internal/impl"
|
||||
"git.apinb.com/dataset/stock/internal/models"
|
||||
@@ -22,7 +23,8 @@ func GetStockIndicator() {
|
||||
continue
|
||||
}
|
||||
|
||||
reply, err := TushareClient.Daily(params, []string{})
|
||||
fields := strings.Split("ts_code,trade_date,close,turnover_rate,turnover_rate_f,volume_ratio,pe,pe_ttm,pb,ps,ps_ttm,dv_ratio,dv_ttm,total_share,float_share,free_share,total_mv,circ_mv", ",")
|
||||
reply, err := TushareClient.Daily(params, fields)
|
||||
if err != nil {
|
||||
log.Println("ERROR", "GetStockIndicator", err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user