I want to build historical OHLC data from the Kraken trades. Since Kraken does not provide historical OHLC data (at least not going far back), they recommend one builds it oneself using the list of trades (https://support.kraken.com/hc/en-us/articles/218198197-How-to-pull-all-trade-data-using-the-Kraken-REST-API). Their trades API does indeed return trades as far back as October 2013, but I do not understand how to interpret the data.

They return the following information for each trade (see https://www.kraken.com/help/api#get-recent-trades):

  • Price
  • Volume
  • Time
  • Buy/sell
  • Market/limit

All of these make sense except the last one, market/limit. How can a trade be a market trade or a limit trade? I am very familiar with market and limit orders, but I thought that every trade is a market order matched against one or more limit orders. So how can a trade be market or limit?

Can I perhaps treat a market sell trade as a limit buy trade and vice versa? And so it would just be random whether they call it market sell or limit buy? This would seem a little odd to me...

Any insight would be appreciated!

  • 1
    Hi Flecto. Building historical data from kraken as well. I'm looking for OHLCV for 1 minut as far as possible for BTCEUR. Do you have that?
    – Justme
    May 10, 2018 at 16:51
  • No, I didn't download BTCEUR, since I'm only interested in USD and crypto pairs. Here's the Python script I use to download trade data from Kraken: pastebin.com/jeP2QEUQ This dumps all the trades in an HDF5 file. I then use other code to aggregate the trades into 1 minute (or any other timeframe) OHLCV data. Hope this helps!
    – Flecto
    May 12, 2018 at 19:03
  • Hi @Justme, I may have what you need. Let me know on gilmijar at gmail. Jan 8, 2019 at 16:21

1 Answer 1


Indeed they don't specify what it means, but the only sane option is that market/limit tag comes from the type of order that closed the deal.

For example there are two lowest sell(ask) orders hanging in the order book:

  • 0.05 BTC at 2000 EUR

  • 0.03 BTC at 2300 EUR

I come to Kraken and place a Market order, buy(bid) for 0.07 BTC, thus the first trade will be for 0.05 BTC, and the second will be for 0.02 BTC. Both will have designation 'market'.

It is possible, however that I want to buy some bitcoin, (let's say 0.9 BTC), but not higher than 2300 EUR. Then to make sure I don't pay more than planned, I make a LIMIT order and the two awaiting orders are matched to mine and what is left of my order amount may hang in the order book on the Buy side. In this scenario the trades as seen via API will have designation 'limit'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.