<blockquote>
  <p>what is the exact definition of a buy/sell indication in the trade history?</p>
</blockquote>

<p>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 <strong>bids</strong> starting from $99 all the way down and the <strong>asks</strong> 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. </p>

<blockquote>
  <p>Is it the sum of the volumes the total volume traded?</p>
</blockquote>

<p>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:</p>

<pre><code>Price      Volume     Buy/sell   Limit/market  Remarks
["$101",     "50",       "b",        "m",        ""],
["$102",     "50",       "b",        "m",        ""]
</code></pre>

<p>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:</p>

<pre><code>Price      Volume     Buy/sell   Limit/market  Remarks
["$101",     "50",       "s",        "l",        ""],
</code></pre>

CC BY-SA 4.0
2019-06-05T09:38:24.403Z
Excellent explanation!
Tim
CC BY-SA 4.0
2019-06-05T09:24:54.323Z
2019-06-05T09:24:54.323Z
Ugam Kamat
<p>I'm looking at some trade history provided by the kraken.com API (formatting mine):</p>

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

<p>What I understood about trading so far:</p>

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

<p><strong>Marked trades</strong> are executed near-instant by emptying the order book on the appropriate side until the order is filled.</p>

<p>As such, a trade is always both a <strong>buy</strong> and <strong>sell</strong> in the same time.</p>

<p><strong>My questions:</strong> 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?</p>

<api><historical-trade-data><exchange-order><kraken>
Confused about buy/sell definition in trades history
Tim
# Confused about buy/sell definition in trades history

(Asked by: username_0 on 2019-06-05)

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",        ""]

```

What I understood about trading so far:

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

**Tags:** api, historical-trade-data, exchange-order, kraken


---

## 1 answers

### Answer by username_1 on 2019-06-05. Score: 2 | Accepted answer

> 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",        ""],

```

> **Comments:**
> **username_0**: Excellent explanation!  

---

