sync_hz_data.go 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. package services
  2. import (
  3. "context"
  4. "eta/eta_task/utils"
  5. "fmt"
  6. "time"
  7. )
  8. // 同步指标
  9. func SyncHzDataIndex(cont context.Context) (err error) {
  10. fmt.Println("SyncHzDataIndex start:", time.Now().Format(utils.FormatDateTime))
  11. //郑州交易所
  12. go SyncRankingFromZhengzhou()
  13. //if err != nil {
  14. // fmt.Println("SyncRankingFromZhengzhou Err:" + err.Error())
  15. // return
  16. //}
  17. //大商所
  18. //go SyncRankingFromDalian()
  19. //if err != nil {
  20. // fmt.Println("SyncRankingFromDalian Err:" + err.Error())
  21. // return
  22. //}
  23. //上期所
  24. go SyncRankingFromShanghai()
  25. //if err != nil {
  26. // fmt.Println("SyncRankingFromDalian Err:" + err.Error())
  27. // return
  28. //}
  29. //中金所
  30. go SyncRankingFromCffex()
  31. //if err != nil {
  32. // fmt.Println("SyncRankingFromCffex Err:" + err.Error())
  33. // return
  34. //}
  35. //上期能源
  36. go SyncRankingFromIne()
  37. //if err != nil {
  38. // fmt.Println("SyncRankingFromIne Err:" + err.Error())
  39. // return
  40. //}
  41. //欧洲天然气
  42. err = SyncRankingFromEic()
  43. if err != nil {
  44. fmt.Println("SyncRankingFromEic Err:" + err.Error())
  45. return
  46. }
  47. //谷歌出行数据
  48. err = SyncChangesVisitorsCovid()
  49. if err != nil {
  50. fmt.Println("SyncChangesVisitorsCovid Err:" + err.Error())
  51. return
  52. }
  53. // EiaSteo
  54. err = SyncEiaSteoIndex()
  55. if err != nil {
  56. fmt.Println("SyncEiaSteoIndex Err:" + err.Error())
  57. return
  58. }
  59. // UN联合国数据
  60. err = SyncComTradeIndex()
  61. if err != nil {
  62. fmt.Println("SyncComTradeIndexAndData Err:" + err.Error())
  63. return
  64. }
  65. // 美联储加息概率
  66. err = SyncMeetingProbabilities()
  67. if err != nil {
  68. fmt.Println("SyncMeetingProbabilities Err:" + err.Error())
  69. return
  70. }
  71. //广期所
  72. {
  73. //分类信息
  74. err = SyncFromGuangzhouClassify()
  75. if err != nil {
  76. fmt.Println("SyncFromGuangzhouClassify Err:" + err.Error())
  77. return
  78. }
  79. //合约信息
  80. err = SyncFromGuangzhouContract()
  81. if err != nil {
  82. fmt.Println("SyncFromGuangzhouContract Err:" + err.Error())
  83. return
  84. }
  85. //指标信息
  86. err = SyncFromGuangzhouIndex()
  87. if err != nil {
  88. fmt.Println("SyncFromGuangzhouIndex Err:" + err.Error())
  89. return
  90. }
  91. //数据
  92. err = SyncFromGuangzhouTradeData()
  93. if err != nil {
  94. fmt.Println("SyncFromGuangzhouTradeData Err:" + err.Error())
  95. return
  96. }
  97. }
  98. //ICPI
  99. {
  100. //分类信息
  101. err = SyncBaseFromIcpiClassify()
  102. if err != nil {
  103. fmt.Println("SyncBaseFromIcpiClassify Err:" + err.Error())
  104. return
  105. }
  106. //指标信息
  107. err = SyncBaseFromIcpi()
  108. if err != nil {
  109. fmt.Println("SyncBaseFromIcpi Err:" + err.Error())
  110. return
  111. }
  112. err = SyncBaseFromIcpiData()
  113. if err != nil {
  114. fmt.Println("SyncBaseFromIcpiData Err:" + err.Error())
  115. return
  116. }
  117. }
  118. // 同步指标数据
  119. SyncHzDataIndexData()
  120. fmt.Println("SyncHzDataIndex end:", time.Now().Format(utils.FormatDateTime))
  121. return err
  122. }
  123. // SyncHzDataIndexData 同步指标数据
  124. func SyncHzDataIndexData() {
  125. var err error
  126. //EiaSteo
  127. err = SyncEiaSteoIndexData()
  128. if err != nil {
  129. fmt.Println("SyncEiaSteoIndexData Err:" + err.Error())
  130. return
  131. }
  132. // 同步un数据
  133. err = SyncComTradeData()
  134. if err != nil {
  135. fmt.Println("SyncComTradeData Err:" + err.Error())
  136. return
  137. }
  138. //
  139. fmt.Println(err)
  140. }