Closed BZ-CO closed 3 months ago
There are some tradeoffs between decimal
and double
. It is true that double
does lose some precision. However, decimal
is more limited in range.
Since the volume
of the candles is rounded at the exchange, there is no need for high precision at the client. Rather, high range is more important.
I've compiled a short list of why I think decimal
would be a better choice for representing volume data.
double
from decimal
so range is already lost.decimal.MaxValue
.decimal
for representing the volume.Okay, you've convinced me. If you could send a PR, we can make the change.
Great. Will submit a PR soon.
Why are we using
double
forBaseCurrencyVolume
andQuoteCurrencyVolume
inMarketCandle
? Shouldn't we usedecimal
instead?I've noticed that casting
baseVolume
andconvertVolume
to double the precision is lost. https://github.com/DigitalRuby/ExchangeSharp/blob/1729aaf896979adaeb90e5eb413aee05fb8d65e1/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPIExtensions.cs#L1099 https://github.com/DigitalRuby/ExchangeSharp/blob/1729aaf896979adaeb90e5eb413aee05fb8d65e1/src/ExchangeSharp/API/Exchanges/_Base/ExchangeAPIExtensions.cs#L1100