5

I want to get real time trade buy/sell data of BTC via binance websocket.

I use this method in following websocket module:

URL: https://python-binance.readthedocs.io/en/latest/binance.html#module-binance.streams

method:aggtrade_futures_socket(symbol: str, futures_type: binance.enums.FuturesType = <FuturesType.USD_M: 1>)

This method return following value:

data:
{
"e": "aggTrade", // Event type
"E": 123456789, // Event time
"s": "BTCUSDT", // Symbol
"a": 5933014, // Aggregate trade ID
"p": "0.001", // Price
"q": "100", // Quantity
"f": 100, // First trade ID
"l": 105, // Last trade ID
"T": 123456785, // Trade time
"m": true, // Is the buyer the market maker?
}

But,This data does not seem to be able to determine whether to sell or buy. How can I get the data for buy and sell transactions?

Michael Rovinsky
  • 6,807
  • 7
  • 15
  • 30
komandap
  • 87
  • 2
  • 7

1 Answers1

16

This thread helped me out to finally understand this concept of market maker/taker: https://money.stackexchange.com/questions/90686/what-does-buyer-is-maker-mean

basically it is below:

  • isBuyerMaker = true -> SELL
  • isBuyerMaker = false -> BUY
dulldulldull
  • 176
  • 1
  • 2
  • That's exactly what I was looking for! Spent a bit too much time looking for other endpoints "that actually contain the buy/sell information" Thank you! – Play4u Nov 02 '21 at 17:30