How does Coinbase / GDAX calculate volume in historical candles? How does Coinbase/GDAX calculate the "Volume" in candle data?

I'm pulling data from the GDAX API in 2 ways; 1, by requesting candles similar to this endpoint, and 2, by tallying up raw tick data from the GDAX WebSocket.

My problem is that when I try to create candle data from tick data, my volumes are very different than what GDAX reports for the same/similar periods. (See the blue and red outlines below...)

In my hand-made candles (shown below, highlighted red), I'm simply taking the sum of all the BTC transacted during that interval, but the numbers are much higher than what GDAX is reporting in similar periods.

What am I doing wrong?

Here's the format I'm using to make my candles:




While researching this, I found this post saying that Coinbase uses the # of transactions to calculate volume, but I tried that, and the numbers are still way off. I even tried dividing and multiplying the # of transactions with my calculated volume, but they're still way off.
I can't answer for the discrepancy that you're seeing, but the "right" way to calculate volume would be to add the "total" column from each trade that occurred during the period. That is, assuming that candle charts are based on stock market candle charts.

It doesn't surprise me that you're seeing this discrepancy, however. I've noticed a few different cryptocurrency APIs that have no idea how to calculate OHLCV data the right way. If your candle data isn't correct, then none of the traditional TA-Lib functions will mean anything!