12

I am looking at the Binance Websocket Stream and have a question about Event time and Trade time. If this is raw trade information, how can there be 2 different times for a "Trade"? What is the "Event Time"?

From the github API docs:

Trade Streams

The Trade Streams push raw trade information; each trade has a unique buyer and seller.

Stream Name: @trade

Payload:

{
  "e": "trade",     // Event type
  "E": 123456789,   // Event time
  "s": "BNBBTC",    // Symbol
  "t": 12345,       // Trade ID
  "p": "0.001",     // Price
  "q": "100",       // Quantity
  "b": 88,          // Buyer order Id
  "a": 50,          // Seller order Id
  "T": 123456785,   // Trade time
  "m": true,        // Is the buyer the market maker?
  "M": true         // Ignore.
}
RandyMy
  • 1,013
  • 1
  • 8
  • 9
  • There is also an OrderId which always come in the right order, but TradeTime is not always in the right order, meaning you can get a bigger order with a lower trade time. – Sorin Feb 19 '21 at 18:14

1 Answers1

14

The "T" or "Trade time" is the time of the transaction in milliseconds. I recommend using this time.

The "E" or "Event time" is the time value is inherent only to the sockets. It is associated with creating a socket object.

Usually "Event time" more then "Trade time" and the difference between these values is only a few milliseconds. Less than 30-40 milliseconds. Sometimes "Event time" less then "Trade time".

Sergey P
  • 141
  • 2