Closed andrew-benson closed 3 years ago
hey @andrew-benson. nice catch. this change definitely makes sense. The change can be found here: https://github.com/dougdellolio/coinbasepro-csharp/commit/ccee8f5eea51ad25ac666b43db84071a08a88357 and will go out with the next release.
Hi @dougdellolio , I've been passing to the service a date time with a milliseconds value of 999. The string format value
"s"
is stripping the millisecond precision out of the date time therefore returning inaccurate data, usually for the Close property.source
The query being generated looks something like this. https://api.pro.coinbase.com/products/BTC-GBP/candles?start=2021-05-03T18:45:00&end=2021-05-03T18:59:59&granularity=900
Here's one suggestion
produces the expected milliseconds https://api.pro.coinbase.com/products/BTC-GBP/candles?start=2021-05-03T19:00:00.0000000Z&end=2021-05-03T19:15:00.9990000Z&granularity=900
.ToString("o")
however produces a bit more precision than we need so you could alternatively use.ToString("yyyy-MM-ddTHH:mm:ss.fffK")
:DateTime constructor takes milliseconds 0 to 999 so this looks neater in my opinion: https://api.pro.coinbase.com/products/BTC-GBP/candles?start=2021-05-03T19:15:00.000Z&end=2021-05-03T19:29:59.999Z&granularity=900
Kind regards Andrew