|
@@ -169,6 +169,7 @@ func GetTableRowsDataByConfig(tableConfig tradeAnalysisModel.TableExtraConfig) (
|
|
|
contractMax = 999
|
|
|
}
|
|
|
// 遍历交易所, 查询各品种下的合约排名情况及TOP当日的多空单数据
|
|
|
+ var sortContract []string
|
|
|
for _, v := range tableConfig.ClassifyList {
|
|
|
contractRanks, e := GetTopContractRank(v.Exchange, v.ClassifyNames, baseDate)
|
|
|
if e != nil {
|
|
@@ -189,11 +190,12 @@ func GetTableRowsDataByConfig(tableConfig tradeAnalysisModel.TableExtraConfig) (
|
|
|
exchangeContracts[rd.Exchange] = make([]*tradeAnalysisModel.ContractTopRankData, 0)
|
|
|
}
|
|
|
exchangeContracts[rd.Exchange] = append(exchangeContracts[rd.Exchange], rd)
|
|
|
+ sortContract = append(sortContract, rd.ClassifyType)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 查询对应品种与合约一周前后的多空单,填充预估值
|
|
|
- tableRows = make([]*tradeAnalysisModel.TableRowData, 0)
|
|
|
+ mussyRows := make([]*tradeAnalysisModel.TableRowData, 0)
|
|
|
for exchange, contracts := range exchangeContracts {
|
|
|
var classifyNames, classifyTypes []string
|
|
|
for _, v := range contracts {
|
|
@@ -220,7 +222,20 @@ func GetTableRowsDataByConfig(tableConfig tradeAnalysisModel.TableExtraConfig) (
|
|
|
err = fmt.Errorf("计算合约数据失败, %v", e)
|
|
|
return
|
|
|
}
|
|
|
- tableRows = append(tableRows, rows...)
|
|
|
+ mussyRows = append(mussyRows, rows...)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 排序
|
|
|
+ tableRows = make([]*tradeAnalysisModel.TableRowData, 0)
|
|
|
+ contractRow := make(map[string]*tradeAnalysisModel.TableRowData)
|
|
|
+ for _, v := range mussyRows {
|
|
|
+ contractRow[v.ClassifyType] = v
|
|
|
+ }
|
|
|
+ for _, v := range sortContract {
|
|
|
+ t := contractRow[v]
|
|
|
+ if t != nil {
|
|
|
+ tableRows = append(tableRows, t)
|
|
|
+ }
|
|
|
}
|
|
|
return
|
|
|
}
|