I'm looking at some trade history provided by the kraken.com API (formatting mine):

``````    Price         Volume         Time        Buy/sell Limit/market  Remarks
["7833.00000", "0.17400000", 1559721453.3446,   "s",      "l",        ""],
["7830.00000", "0.04984709", 1559721484.6288,   "b",      "m",        ""]
``````

Limit trades go on either side of the order book, at the limit set by the initiator. Buy orders go to the `bid` side and sell orders to the `ask` side. When a `bid` meets an `ask` a trade gets executed, up to the lowest amount from either side. Any remainder will remain on the order book until matched again.

Marked trades are executed near-instant by emptying the order book on the appropriate side until the order is filled.

As such, a trade is always both a buy and sell in the same time.

My questions: what is the exact definition of a buy/sell indication in the trade history? Is the sum of the volumes the total volume traded? Or should it be divided by 2?

what is the exact definition of a buy/sell indication in the trade history?

A trade whether it will be marked as buy/sell will depend on how the order book is consumed. Assume the last traded price (LTP) is \$100 and for simplicity sake assume the order book allows only integer increments in the bid and ask prices. So your order book will have bids starting from \$99 all the way down and the asks starting from \$101 all the way up. When a user posts an order that consumes the order book from the bid side, it is treated as sell while on the other hand if an order consumes the ask side it is treated as a buy.

Is it the sum of the volumes the total volume traded?

No. It is the amount consumed from the order book. So going back to our previous example, assume there are 50 ask units at \$101 and 50 at \$102. When a user places a buy market order for 100 units, the trade book will show:

``````Price      Volume     Buy/sell   Limit/market  Remarks
["\$101",     "50",       "b",        "m",        ""],
["\$102",     "50",       "b",        "m",        ""]
``````

Now the LTP is \$102. There will be bid orders starting \$101 all the way down and ask orders from \$103 all the way up. Assume we have 50 units each in bids ranging from \$101-\$95. Now assume a user wants to sell 100 units and his risk tolerance allows him to sell only at \$101. Hence the user will place a limit sell order at \$101 for 100 units. But since there are only 50 units at the bid, that will be consumed and the rest 50 units will be added to the ask side of the order book. Now the trade book will be:

``````Price      Volume     Buy/sell   Limit/market  Remarks
["\$101",     "50",       "s",        "l",        ""],
``````
• Excellent explanation!
– Tim
Jun 5, 2019 at 9:38