Candles built from "matches" channel trades do not match candles from https://api.exchange.coinbase.com/products/{product_id}/candles

Here are the “match” messages in a few minutes for 1INCHUSD from the “matches” channel, all trade_ids are consecutive, there are no gaps
{“type”:“last_match”,“trade_id”:5079544,“maker_order_id”:“51b845a4-3a18-4004-b885-889fe3f6f587”,“taker_order_id”:“d6981d33-1f5e-42ea-b105-cf578dd33061”,“side”:“buy”,“size”:“1.99”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021906346,“time”:“2022-06-14T11:24:55.984409Z”}
{“type”:“match”,“trade_id”:5079545,“maker_order_id”:“8a137e35-821d-4c50-84c3-20186499e665”,“taker_order_id”:“b80bc6b0-d6a5-457b-bd0a-4db7f6524a40”,“side”:“buy”,“size”:“14”,“price”:“0.584”,“product_id”:“1INCH-USD”,“sequence”:1021906683,“time”:“2022-06-14T11:25:19.259053Z”}
{“type”:“match”,“trade_id”:5079546,“maker_order_id”:“e21a3449-7184-41dc-8267-417bd8da896c”,“taker_order_id”:“487544e6-d5d1-46e8-a449-696bb8a86d23”,“side”:“sell”,“size”:“14”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021907259,“time”:“2022-06-14T11:25:41.092445Z”}
{“type”:“match”,“trade_id”:5079547,“maker_order_id”:“762b0bfe-855d-4688-bf4e-78bded2fdeb2”,“taker_order_id”:“52b405ff-232c-4dc0-af48-1a1335dac8b2”,“side”:“sell”,“size”:“14”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021907267,“time”:“2022-06-14T11:25:41.187887Z”}
{“type”:“match”,“trade_id”:5079548,“maker_order_id”:“cac267ee-9ba7-4346-b6f3-5406c91f2ab8”,“taker_order_id”:“215e64a7-2f5f-4ecc-bb40-fa040e7e10f3”,“side”:“sell”,“size”:“14”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021907278,“time”:“2022-06-14T11:25:41.424139Z”}
{“type”:“match”,“trade_id”:5079549,“maker_order_id”:“ac448c6d-9d9b-4bb9-8564-74e62b2e79de”,“taker_order_id”:“abf4caee-7236-4b17-a1e7-335779769eed”,“side”:“buy”,“size”:“14”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021907465,“time”:“2022-06-14T11:25:49.497929Z”}
{“type”:“match”,“trade_id”:5079550,“maker_order_id”:“bfe25981-c223-43c9-9414-f1aea2b65b67”,“taker_order_id”:“4acfe3c0-e171-4be8-b6d7-99b40c75a5c4”,“side”:“sell”,“size”:“2.61”,“price”:“0.584”,“product_id”:“1INCH-USD”,“sequence”:1021908684,“time”:“2022-06-14T11:26:45.334450Z”}
{“type”:“match”,“trade_id”:5079551,“maker_order_id”:“a9f65beb-ab50-462c-8d94-c7d6665512f2”,“taker_order_id”:“067d173c-29db-453d-b790-1555d4c0d67d”,“side”:“buy”,“size”:“14”,“price”:“0.583”,“product_id”:“1INCH-USD”,“sequence”:1021910407,“time”:“2022-06-14T11:28:25.206809Z”}
{“type”:“match”,“trade_id”:5079552,“maker_order_id”:“11c9f6e5-6210-4c60-94b4-e5c8f899b0b1”,“taker_order_id”:“719cd079-e31d-4d7e-bcae-a08ddf15c51d”,“side”:“sell”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021911730,“time”:“2022-06-14T11:29:04.151016Z”}
{“type”:“match”,“trade_id”:5079553,“maker_order_id”:“2ffdd147-e421-41e7-8460-21a4aa95b814”,“taker_order_id”:“6a0ac8b1-9ec7-48c1-915e-b732a4a4033d”,“side”:“sell”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021911759,“time”:“2022-06-14T11:29:05.504484Z”}
{“type”:“match”,“trade_id”:5079554,“maker_order_id”:“b4f8d39e-d3b8-4d69-8eea-d4cbaf2296cf”,“taker_order_id”:“7cd9c09a-7f19-480a-a97a-4fdc83bce48b”,“side”:“sell”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021911765,“time”:“2022-06-14T11:29:05.660280Z”}
{“type”:“match”,“trade_id”:5079555,“maker_order_id”:“4fc5e62b-4d51-4edd-a79c-97b32a2b0247”,“taker_order_id”:“128a8611-79ef-4ed9-adf6-ede9744504c6”,“side”:“sell”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021911777,“time”:“2022-06-14T11:29:06.228324Z”}
{“type”:“match”,“trade_id”:5079556,“maker_order_id”:“f9440046-7f8c-4fe1-8916-b08c76bbdd8d”,“taker_order_id”:“4b04c287-9ec2-42c6-b183-5e8f5b3d8d9f”,“side”:“buy”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021912852,“time”:“2022-06-14T11:29:56.003077Z”}
{“type”:“match”,“trade_id”:5079557,“maker_order_id”:“e6f57c94-8b53-4fe2-ae98-e68c4de9d5b7”,“taker_order_id”:“afb9e5ae-404c-48c0-bb4b-17d28b0c3f9d”,“side”:“buy”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021912873,“time”:“2022-06-14T11:29:58.864315Z”}
{“type”:“match”,“trade_id”:5079558,“maker_order_id”:“2273c1df-777c-40dc-8b0e-ba726e777681”,“taker_order_id”:“0c43aaa1-5d69-4730-b9e8-cecef38326dc”,“side”:“buy”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021913114,“time”:“2022-06-14T11:30:11.745382Z”}
{“type”:“match”,“trade_id”:5079559,“maker_order_id”:“68c5ec3e-c197-4c97-85b3-0812b5f87d7f”,“taker_order_id”:“90ed32c9-501b-42b5-8929-f636ce3e48ce”,“side”:“buy”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021913124,“time”:“2022-06-14T11:30:11.809597Z”}
{“type”:“match”,“trade_id”:5079560,“maker_order_id”:“9913b5e6-aa56-4a2e-9cb7-88a5a0605875”,“taker_order_id”:“1f017093-81d9-4299-a5f6-40ab9d909e0f”,“side”:“buy”,“size”:“14”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021913133,“time”:“2022-06-14T11:30:11.879655Z”}
{“type”:“match”,“trade_id”:5079561,“maker_order_id”:“569a6568-edc6-472b-a503-93c0719480f2”,“taker_order_id”:“511561f9-9e6f-4053-a82a-148cdff0bad9”,“side”:“buy”,“size”:“3.44”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021914802,“time”:“2022-06-14T11:31:50.547501Z”}
{“type”:“match”,“trade_id”:5079562,“maker_order_id”:“c14f5a75-0b6a-4056-9f0c-be6118a47534”,“taker_order_id”:“aa38b8bc-f843-4ff3-8584-ee50e9d5e229”,“side”:“buy”,“size”:“571.32”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021916443,“time”:“2022-06-14T11:34:14.711805Z”}
{“type”:“match”,“trade_id”:5079563,“maker_order_id”:“908395e9-23bb-456e-8263-a180e959165b”,“taker_order_id”:“aa38b8bc-f843-4ff3-8584-ee50e9d5e229”,“side”:“buy”,“size”:“191.67”,“price”:“0.581”,“product_id”:“1INCH-USD”,“sequence”:1021916445,“time”:“2022-06-14T11:34:14.711805Z”}
{“type”:“match”,“trade_id”:5079564,“maker_order_id”:“f879010a-3df9-485c-9ac3-87c4064f9d6f”,“taker_order_id”:“93387d8b-8369-4ffa-85fa-42d9e132dc81”,“side”:“buy”,“size”:“8.36”,“price”:“0.58”,“product_id”:“1INCH-USD”,“sequence”:1021916725,“time”:“2022-06-14T11:34:28.791082Z”}

And here is the query ‘https://api.pro.coinbase.com/products/1INCH-USD/candles?granularity=60&start=2022-06-14T11:24:00Z&end=2022-06-14T11:35:00Z’ result
[[1655206500,0.581,0.582,0.581,0.582,1099.49],[1655206440,0.58,0.581,0.581,0.581,773.23],[1655206200,0.581,0.581,0.581,0.581,45.44],[1655206140,0.581,0.581,0.581,0.581,28],[1655206080,0.581,0.583,0.583,0.581,70],[1655205900,0.583,0.584,0.584,0.584,72.61],[1655205840,0.583,0.584,0.584,0.583,26.84]]

In order to get the same candle for 1655205900 as in ‘products/1INCH-USD/candles’, I need to take “match” messages with trade_id=5079545…5079550, but the message with trade_id=5079550 must belong to candle 1655205960, which is not present at all in the ‘products/1INCH-USD/candles’ response

For 1655206080 candle, you need to take trade_id=5079551…5079555, but trade_id=5079552…5079555 belongs to the next

The same problem can be seen with other products

Is there anything I can do to make the candles built from the “matches” channel’s trades match what’s coming from ‘products/{product_id}/candles’. Or is it some kind of bug?

Hello @pavel-rusinov, Thank you for taking an interest in Coinbase APIs. For the details regarding your concern, we will check on this for you with our team. We will get back to you once we have more information. Keep in touch!

2 Likes

Hello @pavel-rusinov. After discussing this with our team, we noticed the following key points:

  1. Upon checking on our end, we found out that the candle for 1655205900 stops at trade_id 5079549 and not at 5079545 to 5079550.
  2. When calling the Get Product Candles endpoint, historical rate data may be incomplete. Hence, no data is published for intervals where there are no ticks. Historical rates should not be polled frequently. If you need real-time information, you may use the Get product trades endpoint and Get product book endpoint along with the Websocket feed.

We hope this helps. Thank you!

3 Likes

Hello @riza.espiritu

  1. Yes, if I use the “time” field to select the appropriate “match” messages for a candle, then for 1655205900 candle trade_id=5079545-5079549. This is the problem, the candle built from these messages is equal to [1655205900, 0.583, 0.584, 0.584, 0.583, 70]. The value of the same candle from ‘products/1INCH-USD/candles’ = [1655205900,0.583,0.584,0.584,0.584,72.61] does not match what was obtained from “match” messages.
  2. But there is a tick. It is “match” message with trade_id=5079550. According to the “time” field, it should be used in candle 1655205960, but it is not present in ‘products/1INCH-USD/candles’ response.

Hi @pavel-rusinov. We do understand your concern regarding this. However, as we stated in our previous response, it is expected that the historical rate data may be incomplete. No data is published for intervals where there are no ticks. Historical rates should not be polled frequently. We also call this out on our documentation that we do not guarantee the completeness of historic data for this endpoint. You may refer to this link: Get product candles

We recommend you to use the Get product trades endpoint and Get product book endpoint along with the Websocket feed if you need real-time information.

We apologize for the inconvenience that this has caused you.

2 Likes

Hello @BeardMan . I understand that the historical rate data may be incomplete, no data is published for intervals where there are no ticks. But it is not only incomplete, it also differs from what is obtained from the websocket channel.

Hi @pavel-rusinov! Thank you so much for your patience while we look into your concern. Can you share what specific differences in data you see and is such behavior still being observed recently? Meanwhile, we also recommend that you take a look at the new Advanced Trade API’s various websocket channels.

We hope to hear from you soon. Thank you so much!