BTCMarkets / API

API
119 stars 30 forks source link

[websockets] What does the "trades" field mean in the `MarketTrade` event #147

Closed mitchmindtree closed 6 years ago

mitchmindtree commented 6 years ago

I'm testing the MarketTrade event but don't quite understand the data returned under the "trades" field. An example of a returned event:

{
    "id": 0,
    "timestamp": 0,
    "marketId": 2001,
    "agency": "BTCMarkets",
    "instrument": "BTC",
    "currency": "AUD",
    "trades": [
        [1532333307052, 1040000000000, 1589225, 2038602603]
    ]
}

Could you please explain:

  1. what the 4 elements in the inner "trades" array mean and
  2. what does it mean to get more than one element in the outer "trades" array?

Thanks for your time!

JoshuaBatty commented 6 years ago

Also requiring further detail about what the trades array represents. Haven't been able to find anything so far.... Can anyone provide a quick description of what the 4 fields in the array represent? Thanks.

ahmohamed commented 6 years ago

Unofficial answer here. The four elements in "trades" correspond to [timestamp (in milliseconds), price (multiplied by 1e8), amount (multiplied by 1e8), trade_id]

mitchmindtree commented 6 years ago

Perfect, thanks so much!

On Sun, 12 Aug 2018 at 9:13 pm, Ahmed Mohamed notifications@github.com wrote:

Unofficial answer here. The four elements in "trades" correspond to [timestamp (in milliseconds), price (multiplied by 1e8), amount (multiplied by 1e8), trade_id]

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/BTCMarkets/API/issues/147#issuecomment-412345663, or mute the thread https://github.com/notifications/unsubscribe-auth/AEX_bTn451Vzh9Lej7Bbjgg4j_FVwJptks5uQDfsgaJpZM4Vajrb .

justin-ngin commented 6 years ago

The answer provided by ahmohamed is correct. In addition, if there is more than one element in the trades array, each element represents one trade since the last socket event. We're looking to give some love to the websocket and its documentation soon.

Cheers, Justin

JoshuaBatty commented 6 years ago

Thanks @justin-ngin +1 for more web socket support. Especially those account related events that keep getting teased ;)

JoshuaBatty commented 6 years ago

This issue can probably be closed now.