BTCMarkets / API

API
119 stars 30 forks source link

Floating point error - tradingFeeRate #113

Closed sketchthat closed 6 years ago

sketchthat commented 6 years ago

Adding to #112, there is a floating point error in the tradingFeeRate endpoint.

The fees schedule list the base rate as 0.85%.

Trading Fee % 30 Day AUD Volume
0.85% $0.01 - $500
0.83% $500.01 - $1,000
0.80% $1,000.01 - $3,000
0.75% $3,000.01 - $9,000
0.70% $9,000.01 - $18,000
0.65% $18,000.01 - $40,000
0.60% $40,000.01 - $60,000
0.55% $60,000.01 - $70,000
0.50% $70,000.01 - $80,000
0.45% $80,000.01 - $90,000
0.40% $90,000.01 - $115,000
0.35% $115,000.01 - $125,000
0.30% $125,000.01 - $200,000
0.25% $200,000.01 - $400,000
0.23% $400,000.01 - $650,000
0.20% $650,000.01 - $850,000
0.18% $850,000.01 - $1,000,000
0.15% $1,000,000.01 - $3,000,000
0.13% $3,000,000.01 - $5,000,000
0.10% > $5,000,000

However the response is returned as;

{
   "success":true,
   "errorCode":null,
   "errorMessage":null,
   "tradingFeeRate":849999,
   "volume30Day":0
}

Also appears on higher tiers - 0.40% returned as 399999 -> Expected 400000.

justin-ngin commented 6 years ago

Hi @sketchthat ,

I'm looking into this, and will have an answer for you soon.

Thanks, Justin

justin-ngin commented 6 years ago

Hi @sketchthat,

While the fees listed in the chart above are rounded to 2 places of precision (for simplicity on the website), the trading fee that is returned by the endpoint is the exact fee used by both the website and the API.

Cheers! Justin