fix bug
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.apinb.com/dataset/stock/internal/config"
|
"git.apinb.com/dataset/stock/internal/config"
|
||||||
"git.apinb.com/dataset/stock/internal/impl"
|
"git.apinb.com/dataset/stock/internal/impl"
|
||||||
"git.apinb.com/dataset/stock/internal/logic/a"
|
"git.apinb.com/dataset/stock/internal/logic/a"
|
||||||
@@ -17,5 +19,6 @@ func main() {
|
|||||||
// 创建实现层
|
// 创建实现层
|
||||||
impl.NewImpl()
|
impl.NewImpl()
|
||||||
a.NewApiClient()
|
a.NewApiClient()
|
||||||
a.GetTushareMoneyFlow()
|
lastTradeDay := a.GetTradeDateBy(1, false)[0]
|
||||||
|
fmt.Println(lastTradeDay)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package cron
|
package cron
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ func Boot() {
|
|||||||
os.MkdirAll("./markdata/", 0755)
|
os.MkdirAll("./markdata/", 0755)
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateTask()
|
//UpdateTask()
|
||||||
|
|
||||||
scheduler := cron.New()
|
scheduler := cron.New()
|
||||||
// 每天运行3次来更新数据
|
// 每天运行3次来更新数据
|
||||||
@@ -30,6 +31,10 @@ func Boot() {
|
|||||||
|
|
||||||
func UpdateTask() {
|
func UpdateTask() {
|
||||||
a.NewApiClient()
|
a.NewApiClient()
|
||||||
|
if a.ReturnLastTradeDay() != time.Now().Format("20060102") {
|
||||||
|
log.Println("Today Not Trade Day.")
|
||||||
|
return
|
||||||
|
}
|
||||||
// 获取股票列表
|
// 获取股票列表
|
||||||
a.GetStockBasic()
|
a.GetStockBasic()
|
||||||
// 更新资金流向
|
// 更新资金流向
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ func GetTradeDateBy(max int, asc bool) []string {
|
|||||||
return days
|
return days
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func ReturnLastTradeDay() string {
|
||||||
|
return GetTradeDateBy(1, false)[0]
|
||||||
|
}
|
||||||
|
|
||||||
func ReturnLastDay() (string, string) {
|
func ReturnLastDay() (string, string) {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
end := now.Format("20060102")
|
end := now.Format("20060102")
|
||||||
|
|||||||
Reference in New Issue
Block a user