How to build a universal crypto candlestick iterator in Golang

The author of this blog post open-sourced a

Universal crypto candlestick iterator library in Go

called crypto-candles:

There is no Golang library alternative he’s found, or he would have used it. There are some exchange SDKs, though.

In this blog post, he shares all the interesting challenges he found while building this library over the past few months.

What is a candlestick?

Candlesticks, also known as OHLC (i.e. Open, High, Low, Close), Klines and Bucketed Trades, are a way to display the high, low, open, and closing prices of crypto market pairs (and traditional securities) for a specific period.


Candlestick charts are a common sight for crypto investors, and they are used to make buy/sell decisions, either manually or via bots or some other automated mechanisms.

Crypto exchanges like Binance or Coinbase expose APIs with market information for all their supported market pairs (e.g. BTC/USDT) and allow you to consume them for free within fair-use limits.

What is a crypto candlestick iterator?

A Crypto Candlestick Iterator is an iterator that you construct for: