简体   繁体   English

如何获取币安的买卖数据?

[英]How can I get trade buy/sell data of Binance?

I want to get real time trade buy/sell data of BTC via binance websocket.我想通过币安websocket获取BTC的实时买卖数据。

I use this method in following websocket module:我在下面的 websocket 模块中使用了这种方法:

URL: https://python-binance.readthedocs.io/en/latest/binance.html#module-binance.streams 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?如何获取买卖交易的数据?

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这个帖子帮助我最终理解了做市商/接受者的概念: https://money.stackexchange.com/questions/90686/what-does-buyer-is-maker-mean

basically it is below:基本上如下:

  • isBuyerMaker = true -> SELL isBuyerMaker = true -> 卖出
  • isBuyerMaker = false -> BUY isBuyerMaker = false -> 购买

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM