|
@@ -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"))
|
|
|
}
|