|
@@ -65,6 +65,7 @@ type EdbInfo struct {
|
|
|
StockCode string `description:"证券代码"`
|
|
|
Extra string `description:"指标的额外配置"`
|
|
|
IsStaticData int `description:"是否是静态指标,0否,1是"`
|
|
|
+ EndDateType int `description:"预测指标截止日期类型:0:未来日期,1未来期数"`
|
|
|
}
|
|
|
|
|
|
func (e *EdbInfo) Add() (err error) {
|
|
@@ -741,7 +742,7 @@ func UnifiedModifyPredictEdbInfoMaxAndMinInfo(edbInfo *EdbInfo, latestDateStr st
|
|
|
}
|
|
|
|
|
|
// GetChartPredictEdbInfoDataListByConfList 获取图表的预测指标的未来数据
|
|
|
-func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbConfAndData, filtrateStartDateStr, latestDateStr, endDateStr, frequency, dataDateType string, extra string, realPredictEdbInfoData []*EdbInfoSearchData) (predictEdbInfoData []*EdbInfoSearchData, minValue, maxValue float64, err error) {
|
|
|
+func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbConfAndData, filtrateStartDateStr, latestDateStr, endDateStr, frequency, dataDateType string, endDateType int, realPredictEdbInfoData []*EdbInfoSearchData) (predictEdbInfoData []*EdbInfoSearchData, minValue, maxValue float64, err error) {
|
|
|
var endDate time.Time
|
|
|
if endDateStr != `` {
|
|
|
endDate, err = time.ParseInLocation(utils.FormatDate, endDateStr, time.Local)
|
|
@@ -790,7 +791,7 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbCo
|
|
|
//endDate = predictEdbConf.EndDate
|
|
|
var tmpMinValue, tmpMaxValue float64 // 当前预测结果中的最大/最小值
|
|
|
|
|
|
- dayList := getPredictEdbDayList(startDate, predictEdbConf.EndDate, frequency, dataDateType, extra, predictEdbConf.EndNum)
|
|
|
+ dayList := getPredictEdbDayList(startDate, predictEdbConf.EndDate, frequency, dataDateType, endDateType, predictEdbConf.EndNum)
|
|
|
if len(dayList) <= 0 { // 如果未来没有日期的话,那么就退出当前循环,进入下一个循环
|
|
|
continue
|
|
|
}
|
|
@@ -1021,22 +1022,11 @@ func GetChartPredictEdbInfoDataListByConfList(predictEdbConfList []*PredictEdbCo
|
|
|
// GetPredictEdbDayList 获取预测指标日期列表
|
|
|
|
|
|
// GetPredictEdbDayList 获取预测指标日期列表
|
|
|
-func getPredictEdbDayList(startDate, endDate time.Time, frequency, dataDateType, extra string, endNum int) (dayList []time.Time) {
|
|
|
+func getPredictEdbDayList(startDate, endDate time.Time, frequency, dataDateType string, endDateType, endNum int) (dayList []time.Time) {
|
|
|
if dataDateType == `` {
|
|
|
dataDateType = `交易日`
|
|
|
}
|
|
|
|
|
|
- var endDateType int
|
|
|
- if extra != "" {
|
|
|
- //解析配置项
|
|
|
- var endDateConf *PredictEdbInfoExtra
|
|
|
- err := json.Unmarshal([]byte(extra), &endDateConf)
|
|
|
- if err != nil {
|
|
|
- err = errors.New("解析配置项失败,err:" + err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- endDateType = endDateConf.EndDateType
|
|
|
- }
|
|
|
if endDateType == 0 { // 截止日期
|
|
|
switch frequency {
|
|
|
case "日度":
|
|
@@ -1239,7 +1229,7 @@ func GetPredictDataListByPredictEdbConfList(edbInfo, sourceEdbInfoItem *EdbInfo,
|
|
|
var predictMinValue, predictMaxValue float64
|
|
|
// 如果有配置的预测规则,那么就进行预测
|
|
|
if len(predictEdbConfList) > 0 {
|
|
|
- predictDataList, predictMinValue, predictMaxValue, err = GetChartPredictEdbInfoDataListByConfList(predictEdbConfList, startDate, sourceEdbInfoItem.LatestDate, endDateStr, edbInfo.Frequency, edbInfo.DataDateType, edbInfo.Extra, allDataList)
|
|
|
+ predictDataList, predictMinValue, predictMaxValue, err = GetChartPredictEdbInfoDataListByConfList(predictEdbConfList, startDate, sourceEdbInfoItem.LatestDate, endDateStr, edbInfo.Frequency, edbInfo.DataDateType, edbInfo.EndDateType, allDataList)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -1697,7 +1687,3 @@ func (m SortEdbDataList) Less(i, j int) bool {
|
|
|
func (m SortEdbDataList) Swap(i, j int) {
|
|
|
m[i], m[j] = m[j], m[i]
|
|
|
}
|
|
|
-
|
|
|
-type PredictEdbInfoExtra struct {
|
|
|
- EndDateType int `description:"截止日期类型:0:未来日期,1未来期数"`
|
|
|
-}
|