123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- package services
- import (
- "context"
- "eta/eta_task/utils"
- "fmt"
- "time"
- )
- // 同步指标
- func SyncHzDataIndex(cont context.Context) (err error) {
- fmt.Println("SyncHzDataIndex start:", time.Now().Format(utils.FormatDateTime))
- //郑州交易所
- go SyncRankingFromZhengzhou()
- //if err != nil {
- // fmt.Println("SyncRankingFromZhengzhou Err:" + err.Error())
- // return
- //}
- //大商所
- //go SyncRankingFromDalian()
- //if err != nil {
- // fmt.Println("SyncRankingFromDalian Err:" + err.Error())
- // return
- //}
- //上期所
- go SyncRankingFromShanghai()
- //if err != nil {
- // fmt.Println("SyncRankingFromDalian Err:" + err.Error())
- // return
- //}
- //中金所
- go SyncRankingFromCffex()
- //if err != nil {
- // fmt.Println("SyncRankingFromCffex Err:" + err.Error())
- // return
- //}
- //上期能源
- go SyncRankingFromIne()
- //if err != nil {
- // fmt.Println("SyncRankingFromIne Err:" + err.Error())
- // return
- //}
- //欧洲天然气
- err = SyncRankingFromEic()
- if err != nil {
- fmt.Println("SyncRankingFromEic Err:" + err.Error())
- return
- }
- //谷歌出行数据
- err = SyncChangesVisitorsCovid()
- if err != nil {
- fmt.Println("SyncChangesVisitorsCovid Err:" + err.Error())
- return
- }
- // EiaSteo
- err = SyncEiaSteoClassify()
- if err != nil {
- fmt.Println("SyncEiaSteoClassify Err:" + err.Error())
- return
- }
- err = SyncEiaSteoIndex()
- if err != nil {
- fmt.Println("SyncEiaSteoIndex Err:" + err.Error())
- return
- }
- // UN联合国数据
- err = SyncComTradeIndex()
- if err != nil {
- fmt.Println("SyncComTradeIndexAndData Err:" + err.Error())
- return
- }
- // 美联储加息概率
- err = SyncMeetingProbabilities()
- if err != nil {
- fmt.Println("SyncMeetingProbabilities Err:" + err.Error())
- return
- }
- //广期所
- {
- //分类信息
- err = SyncFromGuangzhouClassify()
- if err != nil {
- fmt.Println("SyncFromGuangzhouClassify Err:" + err.Error())
- return
- }
- //合约信息
- err = SyncFromGuangzhouContract()
- if err != nil {
- fmt.Println("SyncFromGuangzhouContract Err:" + err.Error())
- return
- }
- //指标信息
- err = SyncFromGuangzhouIndex()
- if err != nil {
- fmt.Println("SyncFromGuangzhouIndex Err:" + err.Error())
- return
- }
- //数据
- err = SyncFromGuangzhouTradeData()
- if err != nil {
- fmt.Println("SyncFromGuangzhouTradeData Err:" + err.Error())
- return
- }
- }
- //ICPI
- {
- //分类信息
- err = SyncBaseFromIcpiClassify()
- if err != nil {
- fmt.Println("SyncBaseFromIcpiClassify Err:" + err.Error())
- return
- }
- //指标信息
- err = SyncBaseFromIcpi()
- if err != nil {
- fmt.Println("SyncBaseFromIcpi Err:" + err.Error())
- return
- }
- err = SyncBaseFromIcpiData()
- if err != nil {
- fmt.Println("SyncBaseFromIcpiData Err:" + err.Error())
- return
- }
- }
- //美国农业部
- {
- //分类信息
- err = SyncBaseFromUsdaFasClassify()
- if err != nil {
- fmt.Println("SyncBaseFromUsdaFasClassify Err:" + err.Error())
- return
- }
- //指标信息
- err = SyncBaseFromUsdaFas()
- if err != nil {
- fmt.Println("SyncBaseFromUsdaFas Err:" + err.Error())
- return
- }
- err = SyncBaseFromUsdaFasData()
- if err != nil {
- fmt.Println("SyncBaseFromUsdaFasData Err:" + err.Error())
- return
- }
- }
- //GPR地缘风险指数
- {
- /* //分类信息
- err = SyncBaseFromGprRiskClassify()
- if err != nil {
- fmt.Println("SyncBaseFromGprRiskClassify Err:" + err.Error())
- return
- }*/
- //指标信息
- err = SyncBaseFromGprRisk()
- if err != nil {
- fmt.Println("SyncBaseFromGprRisk Err:" + err.Error())
- return
- }
- err = SyncBaseFromGprRiskData()
- if err != nil {
- fmt.Println("SyncBaseFromGprRiskData Err:" + err.Error())
- return
- }
- }
- // 同步指标数据
- SyncHzDataIndexData()
- fmt.Println("SyncHzDataIndex end:", time.Now().Format(utils.FormatDateTime))
- return err
- }
- // SyncHzDataIndexData 同步指标数据
- func SyncHzDataIndexData() {
- var err error
- //EiaSteo
- err = SyncEiaSteoIndexDataV2()
- if err != nil {
- fmt.Println("SyncEiaSteoIndexData Err:" + err.Error())
- return
- }
- // 同步un数据
- err = SyncComTradeData()
- if err != nil {
- fmt.Println("SyncComTradeData Err:" + err.Error())
- return
- }
- //
- fmt.Println(err)
- }
|