微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何获取币安的交易买入/卖出数据?

如何解决如何获取币安的交易买入/卖出数据?

我想通过币安 websocket 获取 BTC 的实时交易买卖数据。

我在以下 websocket 模块中使用此方法

网址: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>)

方法返回以下值:

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?
}

但是,这个数据似乎并不能决定是卖还是买。如何获取买卖交易的数据?

解决方法

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

基本上如下:

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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。