Skip to content

Commit

Permalink
Add the flag for confirmed (aka final, closed) candles (#4742)
Browse files Browse the repository at this point in the history
  • Loading branch information
romanbsd authored Aug 13, 2023
1 parent bc328d4 commit 27ada96
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public final class BinanceKline {
private final long numberOfTrades;
private final BigDecimal takerBuyBaseAssetVolume;
private final BigDecimal takerBuyQuoteAssetVolume;
private final boolean closed;

public BinanceKline(Instrument instrument, KlineInterval interval, Object[] obj) {
this.instrument = instrument;
Expand All @@ -38,6 +39,7 @@ public BinanceKline(Instrument instrument, KlineInterval interval, Object[] obj)
this.numberOfTrades = Long.parseLong(obj[8].toString());
this.takerBuyBaseAssetVolume = new BigDecimal(obj[9].toString());
this.takerBuyQuoteAssetVolume = new BigDecimal(obj[10].toString());
this.closed = (Boolean)obj[11];
}

public BigDecimal getAveragePrice() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package info.bitrich.xchangestream.binance.dto;

import static org.knowm.xchange.utils.StreamUtils.singletonCollector;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Arrays;
import java.util.Map;
import lombok.Getter;
import org.knowm.xchange.binance.BinanceAdapters;
import org.knowm.xchange.binance.dto.marketdata.BinanceKline;
import org.knowm.xchange.binance.dto.marketdata.KlineInterval;

import java.util.Arrays;
import java.util.Map;

import static org.knowm.xchange.utils.StreamUtils.singletonCollector;

@Getter
public class KlineBinanceWebSocketTransaction extends BaseBinanceWebSocketTransaction {

Expand All @@ -32,7 +31,7 @@ public KlineBinanceWebSocketTransaction(
}

private static Object[] getParameters(Map<String, Object> kline) {
Object[] parameters = new Object[11];
Object[] parameters = new Object[12];
parameters[0] = kline.get("t");
parameters[1] = kline.get("o");
parameters[2] = kline.get("h");
Expand All @@ -44,6 +43,7 @@ private static Object[] getParameters(Map<String, Object> kline) {
parameters[8] = kline.get("n");
parameters[9] = kline.get("V");
parameters[10] = kline.get("Q");
parameters[11] = kline.get("x");
return parameters;
}

Expand Down

0 comments on commit 27ada96

Please sign in to comment.