wr 6 years ago
parent
commit
7fc1d50718
4 changed files with 523 additions and 5 deletions
  1. 58 0
      server/cmd/webproxy/main.go
  2. 460 2
      server/cmd/webproxys/main.go
  3. 4 2
      server/tick/ds_bty.go
  4. 1 1
      server/tick/history.go

+ 58 - 0
server/cmd/webproxy/main.go

@@ -262,6 +262,64 @@ func h24Handler(w http.ResponseWriter, r *http.Request) {
 	var candles []client.Candle
 	insId := typ + "_" + symbol
 	bufcandles, err := clientDown.GetLastCandles(insId, market.H1, 24)
+	/*for i, _ := range bufcandles {
+		if insId == "bty_ETHUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524031200000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_BTCUSDT" {
+			if bufcandles[i].Timestamp >= 1524034800000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_BCCUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_ETCUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_ZECUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_LTCUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+		if insId == "bty_DCRUSDT" {
+			if bufcandles[i].Timestamp >= 1524031200000 && bufcandles[i].Timestamp <= 1524034800000 {
+				bufcandles[i].High = bufcandles[i-1].High
+				bufcandles[i].Open = bufcandles[i-1].Open
+				bufcandles[i].Close = bufcandles[i-1].Close
+				bufcandles[i].Low = bufcandles[i-1].Low
+			}
+		}
+	}*/
 	if err != nil {
 		http.Error(w, "server get data failed", http.StatusInternalServerError)
 		return

+ 460 - 2
server/cmd/webproxys/main.go

@@ -193,6 +193,464 @@ func getData(symbol, period, action, count, out, cb, te, ts string, style int) (
 
 	var bufferedCandles []client.Candle
 	bufferedCandles, _ = clientDown.GetLastCandles(myInsId, periodId, 0x7fffffff)
+	/*bNormal := false
+	for i, _ := range bufferedCandles {
+		if myInsId == "bty_ETHUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033780000 && bufferedCandles[i].Timestamp <= 1524035400000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524035400000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033600000 && bufferedCandles[i].Timestamp <= 1524035100000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524035100000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524031200000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524031200000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_BTCUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524035160000 && bufferedCandles[i].Timestamp <= 1524035520000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524035520000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524035100000 && bufferedCandles[i].Timestamp <= 1524035400000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524035400000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524034800000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_BCCUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033780000 && bufferedCandles[i].Timestamp <= 1524038580000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038580000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033600000 && bufferedCandles[i].Timestamp <= 1524038100000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038100000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_ETCUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033780000 && bufferedCandles[i].Timestamp <= 1524038520000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038520000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033600000 && bufferedCandles[i].Timestamp <= 1524037800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524037800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_ZECUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033780000 && bufferedCandles[i].Timestamp <= 1524038820000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038820000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033600000 && bufferedCandles[i].Timestamp <= 1524038400000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038400000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_LTCUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033780000 && bufferedCandles[i].Timestamp <= 1524038760000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038760000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033600000 && bufferedCandles[i].Timestamp <= 1524038400000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038400000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+		if myInsId == "bty_DCRUSDT" {
+			if periodId == market.M1 {
+				if bufferedCandles[i].Timestamp >= 1524033840000 && bufferedCandles[i].Timestamp <= 1524038520000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038520000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.M5 {
+				if bufferedCandles[i].Timestamp >= 1524033900000 && bufferedCandles[i].Timestamp <= 1524038100000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524038100000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.H1 {
+				if bufferedCandles[i].Timestamp >= 1524031200000 && bufferedCandles[i].Timestamp <= 1524034800000 {
+					bufferedCandles[i].High = bufferedCandles[i-1].High
+					bufferedCandles[i].Open = bufferedCandles[i-1].Open
+					bufferedCandles[i].Close = bufferedCandles[i-1].Close
+					bufferedCandles[i].Low = bufferedCandles[i-1].Low
+				}
+				if !bNormal && bufferedCandles[i].Timestamp > 1524034800000 {
+					bNormal = true
+					bufferedCandles[i].Open = bufferedCandles[i-1].Close
+					if bufferedCandles[i].High < bufferedCandles[i].Open {
+						bufferedCandles[i].High = bufferedCandles[i].Open
+					}
+					if bufferedCandles[i].Low > bufferedCandles[i].Open {
+						bufferedCandles[i].Low = bufferedCandles[i].Open
+					}
+				}
+			}
+			if periodId == market.D1 {
+				if bufferedCandles[i].Timestamp >= 1524009600000 && bufferedCandles[i].Timestamp <= 1524009600000 {
+					if bufferedCandles[i].Open > bufferedCandles[i].Close {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Close
+					} else {
+						bufferedCandles[i].Low = bufferedCandles[i-1].Open
+					}
+				}
+			}
+		}
+	}*/
 
 	bufferedCandles = truncateBuffer(bufferedCandles, periodId, myInsId)
 	var downN int
@@ -753,7 +1211,7 @@ func main() {
 	}
 	http.HandleFunc("/kdata", makeGzipHandler(kdataHandler))
 	http.HandleFunc("/tdata", makeGzipHandler(tdataHandler))
-	//log.Fatal(s.ListenAndServeTLS("214341259320977.pem", "214341259320977.key"))
-	log.Fatal(s.ListenAndServe())
+	log.Fatal(s.ListenAndServeTLS("214341259320977.pem", "214341259320977.key"))
+	//log.Fatal(s.ListenAndServe())
 	//log.Fatal(s.ListenAndServeTLS("licai20170620.pem", "licai20170620.key"))
 }

+ 4 - 2
server/tick/ds_bty.go

@@ -147,8 +147,9 @@ func (bds *BtyDS) getData(instrumentId, offset int64) {
 
 func GetEthTickbyPage(instrumentId, offset int64, cb func(*Market)) (int64, error) {
 	symbol, _ := markinfo.SymbolName(int(instrumentId))
-	url := "http://47.75.62.253:46658/tender/default/kline?symbol=" + symbol + "&offset=" + fmt.Sprintf("%d", offset) + "&limit=100"
+	//url := "http://47.75.62.253:46658/tender/default/kline?symbol=" + symbol + "&offset=" + fmt.Sprintf("%d", offset) + "&limit=100"
 	//url := "http://47.74.9.155:45656/tender/default/kline?symbol=" + symbol + "&offset=" + fmt.Sprintf("%d", offset) + "&limit=100"
+	url := "http://10.0.1.5:45656/tender/default/kline?symbol=" + symbol + "&offset=" + fmt.Sprintf("%d", offset) + "&limit=100"
 	//url := "http://121.196.205.182:45656/tender/default/kline?symbol=" + symbol + "&offset=" + fmt.Sprintf("%d", offset) + "&limit=100"
 	response, err := http.Get(url)
 	if err != nil {
@@ -326,9 +327,10 @@ func toEthMK(data map[string]interface{}) (*Market, int64, error) {
 }
 
 func parseKTime(timeStr string) int64 {
+	loc, _ := time.LoadLocation("Asia/Chongqing")
 	var year, month, day, hour, minute, second int
 	fmt.Sscanf(timeStr, "%04d-%02d-%02d %02d:%02d:%02d", &year, &month, &day, &hour, &minute, &second)
-	t := time.Date(year, time.Month(month), day, hour, minute, second, 0, time.Local)
+	t := time.Date(year, time.Month(month), day, hour, minute, second, 0, loc)
 	return t.Unix() * 1000
 }
 

+ 1 - 1
server/tick/history.go

@@ -192,7 +192,7 @@ func (cm *CandleMaker) parse() {
 	// 保存数据到文件
 	ticker := time.Tick(time.Second * 30)
 	for t := range ticker {
-		if t.Hour() == 8 && t.Minute() == 30 { // 8:30点时保存
+		if t.Hour() == 0 && t.Minute() == 30 { // 8:30点时保存
 			if len(cm.files) > 0 {
 				for len(cm.files) > 0 {
 					bHas := false