I send an order to buy binance, an error arrives in response:
{"code":-1111,"msg":"Precision is over the maximum defined for this asset."}
Here's how the quanity is calculated:
string quanyty = Convert.ToString(Math.Round(Balance()/PriceCTSIBTC(),8));//balance/Price = 10.5673824567
The request looks like this:
var request = new RestRequest("/api/v3/order", Method.POST);
request.AddHeader("X-MBX-APIKEY", apikey);
request.AddQueryParameter("symbol", "CTSIBTC");
request.AddQueryParameter("side", "BUY");
request.AddQueryParameter("type", "STOP_LOSS_LIMIT");
request.AddQueryParameter("timeInForce", "GTC");
request.AddQueryParameter("quantity", quanyty);
request.AddQueryParameter("price", price);
request.AddQueryParameter("timestamp", timestamp);
request.AddQueryParameter("signature", CreateSignature(request.Parameters, secret));
request.AddQueryParameter("stopPrice", stopPrice);
var response = client.Get(request);
At first I was rounding with Math.Floor()
,
then implemented through Math.Round()
. The error did not go away.