in websocket aggregate trades , how to know if its buy or its sell … on usually it show sell is (red) and buy is (green) but is aggregate api its not show nothig if its sell or buy !!
and in fututre aggregate trade (how to know if its short or long ) ??
Aggregate trade only represents the trade pair (buy-sell) itself, so you won’t be able to know which side (buy or sell) the price came from. Same goes for futures.
many thanks to replay ,ok , is there is any solution how to knew if its sell or buy ?? in binance trade boq show the sell is (red) and buy is (green) how to apply it on api aggregate ? please i need solution
You need to have a better understanding of what a trade means. Each spot trade has buy side and sell side and each futures trade has long and short side. Are you actually trying to ask which side is a maker?
{
“e”: “aggTrade”, // Event type
“E”: 123456789, // Event time
“s”: “BNBBTC”, // Symbol
“a”: 12345, // 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?
“M”: true // Ignore
}
Maybe the problem is that you are calling the open method before declaring the listeners, try setting the listener of the onload event after creating the XMLHttpRequest object and before using the open and send methods