Weird wicks on aggTrade streams

Hi,

I have subscribed to aggTrade stream on futures. But when market is volatile, i see so much weird prices that causes unreal wicks. This doesn’t happen on kline streams.

Are there any solutions to this?

Could you provide a sample or log of this occurrence so that we can further diagnose the issue?

This even exists in Binance. Look at the picture. There was no wick at that time. This is Binance’s own page

Key: p returns unreal value when subscribed to aggTrade or trade.

The wick is available using the following url

https://fapi.binance.com/fapi/v1/klines?symbol=BTCUSDT&interval=1h&startTime=1627261200000&limit=1

These spikes are based on real trades and should be expected.

For future reference, the API endpoint’s startTime and endTime are UTC based, while the timestamp shown on the UI is based on local time.

Look at this spike and the next one. First one is from aggTrade and the second one is from kline

And here’s the what kline shows

Could you provide the symbol and aggTradeId that does not match so that we can further investigate?

BTCUSDT in 1m chart 2021-10-27 09:24 is the UTC time

I was unable to reproduce this scenario.

Kline at that timestamp

https://fapi.binance.com/fapi/v1/klines?symbol=BTCUSDT&interval=1m&startTime=1635326640000&limit=1

[
    1635326640000,
    "58838.09",
    "58839.36",
    "58654.98",
    "58750.34",
    "698.216",
    1635326699999,
    "41004234.66831",
    6652,
    "249.081",
    "14629862.69551",
    "0"
]

Highest priced aggTrade Id 893625179 with price set as 58839.36 which falls between the range of the kline listed above (low: 58654.98, high: 58839.36)

If you are still certain that this is an issue from the API, please provide the direct AggTrade ID which price falls outside of the Kline’s High-Low range.

There are no problems with kline streams. This problem only occurs with aggTrade or trade streams

We are unable to find an aggTrade within that Kline window which falls outside of the Kline’s price range.

If this happens again, take note of the aggTradeId and inform us.

i have started to log the streams now

One question. What happens if we subscribe to “trade” instead of “aggTrade” for futures? I think this happens in “trade”

Get compressed, aggregate market trades. Market trades that fill at the time, from the same order, with the same price will have the quantity aggregated.

The trade stream does not include aggregated market trades, meaning that you will have more messages for market orders when compared to aggTrade stream. If you do not need that granularity of data, I suggest using aggTrade.

Ok i think this is only hapenning in “trade” streams. Also it’s undocumented in Binance (for USD-M)

1 Like

Hi again

Here’s the problem. If i subscribe to “trades” i got the following. As it is not “aggTrade” i don’t have any ids

2021-10-27 13:46:00,BTCUSDT,0,57471.04,0.011,632.18144

The @trade stream is not supported for USD-M. Please use the aggTrade stream.