sync_hz_data.go 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  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 = SyncEiaSteoClassify()
  55. if err != nil {
  56. fmt.Println("SyncEiaSteoClassify Err:" + err.Error())
  57. return
  58. }
  59. err = SyncEiaSteoIndex()
  60. if err != nil {
  61. fmt.Println("SyncEiaSteoIndex Err:" + err.Error())
  62. return
  63. }
  64. // UN联合国数据
  65. err = SyncComTradeIndex()
  66. if err != nil {
  67. fmt.Println("SyncComTradeIndexAndData Err:" + err.Error())
  68. return
  69. }
  70. // 美联储加息概率
  71. err = SyncMeetingProbabilities()
  72. if err != nil {
  73. fmt.Println("SyncMeetingProbabilities Err:" + err.Error())
  74. return
  75. }
  76. //广期所
  77. {
  78. //分类信息
  79. err = SyncFromGuangzhouClassify()
  80. if err != nil {
  81. fmt.Println("SyncFromGuangzhouClassify Err:" + err.Error())
  82. return
  83. }
  84. //合约信息
  85. err = SyncFromGuangzhouContract()
  86. if err != nil {
  87. fmt.Println("SyncFromGuangzhouContract Err:" + err.Error())
  88. return
  89. }
  90. //指标信息
  91. err = SyncFromGuangzhouIndex()
  92. if err != nil {
  93. fmt.Println("SyncFromGuangzhouIndex Err:" + err.Error())
  94. return
  95. }
  96. //数据
  97. err = SyncFromGuangzhouTradeData()
  98. if err != nil {
  99. fmt.Println("SyncFromGuangzhouTradeData Err:" + err.Error())
  100. return
  101. }
  102. }
  103. //ICPI
  104. {
  105. //分类信息
  106. err = SyncBaseFromIcpiClassify()
  107. if err != nil {
  108. fmt.Println("SyncBaseFromIcpiClassify Err:" + err.Error())
  109. return
  110. }
  111. //指标信息
  112. err = SyncBaseFromIcpi()
  113. if err != nil {
  114. fmt.Println("SyncBaseFromIcpi Err:" + err.Error())
  115. return
  116. }
  117. err = SyncBaseFromIcpiData()
  118. if err != nil {
  119. fmt.Println("SyncBaseFromIcpiData Err:" + err.Error())
  120. return
  121. }
  122. }
  123. // 同步指标数据
  124. SyncHzDataIndexData()
  125. fmt.Println("SyncHzDataIndex end:", time.Now().Format(utils.FormatDateTime))
  126. return err
  127. }
  128. // SyncHzDataIndexData 同步指标数据
  129. func SyncHzDataIndexData() {
  130. var err error
  131. //EiaSteo
  132. err = SyncEiaSteoIndexDataV2()
  133. if err != nil {
  134. fmt.Println("SyncEiaSteoIndexData Err:" + err.Error())
  135. return
  136. }
  137. // 同步un数据
  138. err = SyncComTradeData()
  139. if err != nil {
  140. fmt.Println("SyncComTradeData Err:" + err.Error())
  141. return
  142. }
  143. //
  144. fmt.Println(err)
  145. }