|
@@ -387,7 +387,23 @@ func refreshAllPredictCalculateNhcc(to orm.TxOrmer, edbInfo, firstEdbInfo, secon
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
|
- latestDateStr = firstEdbInfo.LatestDate
|
|
|
+ // 计算最新的实际值的日期
|
|
|
+ latestDateA, _ := time.ParseInLocation(utils.FormatDate, firstEdbInfo.LatestDate, time.Local)
|
|
|
+ if existItemA.MoveValue != 0 {
|
|
|
+ latestDateA = latestDateA.AddDate(0, 0, existItemA.MoveValue)
|
|
|
+ }
|
|
|
+
|
|
|
+ latestDateB, _ := time.ParseInLocation(utils.FormatDate, secondEdbInfo.LatestDate, time.Local)
|
|
|
+ if existItemB.MoveValue != 0 {
|
|
|
+ latestDateB = latestDateA.AddDate(0, 0, existItemB.MoveValue)
|
|
|
+ }
|
|
|
+
|
|
|
+ if latestDateA.Before(latestDateB) {
|
|
|
+ latestDateStr = latestDateA.Format(utils.FormatDate)
|
|
|
+ }else{
|
|
|
+ latestDateStr = latestDateB.Format(utils.FormatDate)
|
|
|
+ }
|
|
|
+
|
|
|
var dateArr []string
|
|
|
dataMap := make(map[string]*EdbDataPredictCalculateNhcc)
|
|
|
removeDataTimeMap := make(map[string]int) //需要移除的日期数据
|
|
@@ -472,7 +488,7 @@ func refreshAllPredictCalculateNhcc(to orm.TxOrmer, edbInfo, firstEdbInfo, secon
|
|
|
err = tmpErr
|
|
|
return
|
|
|
}
|
|
|
- // 如果B指标的最新数据日期早于拟合残差的结束日期,那么就用A指标的最新数据日期
|
|
|
+ // 如果B指标的最新数据日期早于拟合残差的结束日期,那么就用B指标的最新数据日期
|
|
|
if tmpEndDate.Before(nhccDate.EndDate) {
|
|
|
nhccDate.EndDate = tmpEndDate
|
|
|
}
|
|
@@ -540,7 +556,7 @@ func refreshAllPredictCalculateNhcc(to orm.TxOrmer, edbInfo, firstEdbInfo, secon
|
|
|
b2Decimal := decimal.NewFromFloat(b2Val)
|
|
|
|
|
|
val, _ := bDecimal.Sub(b2Decimal).RoundCeil(4).Float64()
|
|
|
- if firstEdbInfo.LatestDate == currDate {
|
|
|
+ if latestDateStr == currDate {
|
|
|
latestValue = val
|
|
|
}
|
|
|
// 判断之前有没有该数据
|