|
@@ -43,10 +43,10 @@ type message struct {
|
|
|
var ineIndexCode string
|
|
|
var ineIndexCodeMap = make(map[string]string)
|
|
|
|
|
|
-func IneIndexCodeGenerator(indexName string) string {
|
|
|
+func IneIndexCodeGenerator(indexName,suffix string) string {
|
|
|
ineIndexCode,_ := ineIndexCodeMap[indexName]
|
|
|
if ineIndexCode == "" {
|
|
|
- ineIndexCode = fmt.Sprintf("INE%s", time.Now().Format(utils.FormatDateTimeUnSpace)+strconv.Itoa(utils.GetRandInt(1, 100)))
|
|
|
+ ineIndexCode = fmt.Sprintf("INE%s", time.Now().Format(utils.FormatDateTimeUnSpace)+strconv.Itoa(utils.GetRandInt(1, 100))+suffix)
|
|
|
ineIndexCodeMap[indexName] = ineIndexCode
|
|
|
err := models.AddBaseFromTradeMapping(indexName, ineIndexCode, "INE")
|
|
|
if err != nil {
|
|
@@ -107,9 +107,9 @@ func SyncRankingFromIne() {
|
|
|
item.DealName = strings.Replace(fmt.Sprintf("%s", p.ParticipantName1+"_成交量"+"_"+p.ProductName+"_"+p.ContractCode), " ", "", -1)
|
|
|
item.BuyName = strings.Replace(fmt.Sprintf("%s", p.ParticipantName2+"_持买单量"+"_"+p.ProductName+"_"+p.ContractCode), " ", "", -1)
|
|
|
item.SoldName = strings.Replace(fmt.Sprintf("%s", p.ParticipantName3+"_持卖单量"+"_"+p.ProductName+"_"+p.ContractCode), " ", "", -1)
|
|
|
- item.DealCode = IneIndexCodeGenerator(item.DealName)
|
|
|
- item.BuyCode = IneIndexCodeGenerator(item.BuyName)
|
|
|
- item.SoldCode = IneIndexCodeGenerator(item.SoldName)
|
|
|
+ item.DealCode = IneIndexCodeGenerator(item.DealName, "deal")
|
|
|
+ item.BuyCode = IneIndexCodeGenerator(item.BuyName, "buy")
|
|
|
+ item.SoldCode = IneIndexCodeGenerator(item.SoldName, "sold")
|
|
|
item.DealValue = p.Deal
|
|
|
item.DealChange = p.Change1
|
|
|
item.BuyValue = p.BuyIn
|