|
@@ -12,6 +12,7 @@ const (
|
|
|
TaskKey0000 = "IDpcsgDailySnap0000"
|
|
|
SubOneDayTaskKey = "IDpcsgDailySnap0330" // 日期-1的key
|
|
|
TaskKey0345 = "IDpcsgDailySnap0345"
|
|
|
+ TaskKeyHistU3 = "IDpcsgDailyRunHistU3"
|
|
|
)
|
|
|
|
|
|
// PythonBloombergGeneralData 通用数据格式(有空改成Map吧...然后做成配置方便加新字段...)
|
|
@@ -34,6 +35,9 @@ type PythonBloombergGeneralData struct {
|
|
|
LAST_UPDATE_DT string `json:"LAST_UPDATE_DT" description:"数据日期"`
|
|
|
HEATING_DAYS *float64 `json:"HEATING_DAYS" description:"数据值, 可能为null"`
|
|
|
COOLING_DAYS *float64 `json:"COOLING_DAYS" description:"数据值, 可能为null"`
|
|
|
+ PX_OPEN *float64 `json:"PX_OPEN" description:"数据值, 可能为null"`
|
|
|
+ PX_LOW *float64 `json:"PX_LOW" description:"数据值, 可能为null"`
|
|
|
+ PX_HIGH *float64 `json:"PX_HIGH" description:"数据值, 可能为null"`
|
|
|
}
|
|
|
|
|
|
// PythonBloombergGeneralResult API响应体
|
|
@@ -226,3 +230,111 @@ func FormatPythonBloombergDailyRunHistV1Data2Base(origin PythonBloombergGeneralD
|
|
|
}
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func FormatPythonBloombergDailyHistU3Data2Base(origin PythonBloombergGeneralData, frequency string) (items []BaseFromBloombergApiIndexAndData) {
|
|
|
+ origin.IDENTIFIER = strings.TrimSpace(origin.IDENTIFIER)
|
|
|
+ if origin.IDENTIFIER == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ dataTime, err := time.ParseInLocation(utils.FormatDate, origin.DATE, time.Local)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ items = make([]BaseFromBloombergApiIndexAndData, 0)
|
|
|
+
|
|
|
+ // TZT1 Comdty / CO1 Comdty
|
|
|
+ if origin.IDENTIFIER == "CO1 Comdty" {
|
|
|
+ itemA1 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemA1.IndexCode = "CO1 O Comdty"
|
|
|
+ itemA1.IndexName = "ICE Brent 1st Line - Open"
|
|
|
+ itemA1.Frequency = frequency
|
|
|
+ itemA1.Unit = "无"
|
|
|
+ itemA1.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ itemA2 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemA2.IndexCode = "CO1 L Comdty"
|
|
|
+ itemA2.IndexName = "ICE Brent 1st Line - Low"
|
|
|
+ itemA2.Frequency = frequency
|
|
|
+ itemA2.Unit = "无"
|
|
|
+ itemA2.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ itemA3 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemA3.IndexCode = "CO1 H Comdty"
|
|
|
+ itemA3.IndexName = "ICE Brent 1st Line - High"
|
|
|
+ itemA3.Frequency = frequency
|
|
|
+ itemA3.Unit = "无"
|
|
|
+ itemA3.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ // 数据来源的值和日期对应字段不同
|
|
|
+ if origin.PX_OPEN != nil {
|
|
|
+ val := origin.PX_OPEN
|
|
|
+ itemA1.Data = append(itemA1.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if origin.PX_LOW != nil {
|
|
|
+ val := origin.PX_LOW
|
|
|
+ itemA2.Data = append(itemA2.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if origin.PX_HIGH != nil {
|
|
|
+ val := origin.PX_HIGH
|
|
|
+ itemA3.Data = append(itemA3.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ items = append(items, itemA1, itemA2, itemA3)
|
|
|
+ }
|
|
|
+
|
|
|
+ if origin.IDENTIFIER == "TZT1 Comdty" {
|
|
|
+ itemB1 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemB1.IndexCode = "TZT1 O Comdty"
|
|
|
+ itemB1.IndexName = "ICE TTF 1st Line - Open"
|
|
|
+ itemB1.Frequency = frequency
|
|
|
+ itemB1.Unit = "无"
|
|
|
+ itemB1.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ itemB2 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemB2.IndexCode = "TZT1 L Comdty"
|
|
|
+ itemB2.IndexName = "ICE TTF 1st Line - Low"
|
|
|
+ itemB2.Frequency = frequency
|
|
|
+ itemB2.Unit = "无"
|
|
|
+ itemB2.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ itemB3 := BaseFromBloombergApiIndexAndData{}
|
|
|
+ itemB3.IndexCode = "TZT1 H Comdty"
|
|
|
+ itemB3.IndexName = "ICE TTF 1st Line - High"
|
|
|
+ itemB3.Frequency = frequency
|
|
|
+ itemB3.Unit = "无"
|
|
|
+ itemB3.Data = make([]BaseFromBloombergApiIndexData, 0)
|
|
|
+
|
|
|
+ // 数据来源的值和日期对应字段不同
|
|
|
+ if origin.PX_OPEN != nil {
|
|
|
+ val := origin.PX_OPEN
|
|
|
+ itemB1.Data = append(itemB1.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if origin.PX_LOW != nil {
|
|
|
+ val := origin.PX_LOW
|
|
|
+ itemB2.Data = append(itemB2.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ if origin.PX_HIGH != nil {
|
|
|
+ val := origin.PX_HIGH
|
|
|
+ itemB3.Data = append(itemB3.Data, BaseFromBloombergApiIndexData{
|
|
|
+ DataTime: dataTime,
|
|
|
+ Value: *val,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ items = append(items, itemB1, itemB2, itemB3)
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|