11115
December 15, 2020, 12:20pm
1
Hi
I have encountered such a problem
I try via API sell ETH from BTC, i create Market order
I am trying to sell 0.03 ETH from BTC
And i get an error:{
“code”: -1013,
“msg”: “Filter failure: LOT_SIZE”
}
But if i try exchange via site Trade->Classic, Market i can sell 0,03 ETH from BTC - and everything is ok
My code
public function createOrder($data) {
$request = [];
$timestamp = time() * 1000;
if($data['side'] == ExchangeService::BUY) {
$string = "symbol=".$data['currency_to'].$data['currency_from']."&type=MARKET&side=".$data['side']."&quantity=".$data['sum_to']."&recvWindow=60000×tamp=".$timestamp;
} else {
$string = "symbol=".$data['currency_from'].$data['currency_to']."&type=MARKET&side=".$data['side']."&quantity=".$data['body']."&recvWindow=60000×tamp=".$timestamp;
}
// $string = "symbol=".$data['currency_to'].$data['currency_from']."&side=BUY&type=LIMIT&timeInForce=GTC&quantity=".$data['sum_to']."&price=".$data['sum_from']."&recvWindow=6000×tamp=".$timestamp;
$signature = hash_hmac('sha256', $string, getenv('BINANCE_API_SECRET'));
$request['link'] = self::URL.'api/v3/order';
$request['method'] = 'POST';
$request['headers'] = ["X-MBX-APIKEY: " . getenv('BINANCE_API_KEY')];
$request['body'] = $string . "&signature=" . $signature;
$out = $this->sendRequest($request);
$out = json_decode(stristr($out,'{'));
return $out;
Why i can’t sell 0,03 ETH from BTC via API ?
MJW
December 15, 2020, 12:59pm
2
please var_dump($request) and post all the msgs with your APIKEY as well as signature masked
MJW
December 15, 2020, 1:19pm
4
I deleted your API key; don’t show it publicly
11115
December 15, 2020, 1:22pm
6
My code works, the problem is that the minimum amount of ETHBTC that I want to sell is 0.2 ETH, although on the site in Trade - > Classic I can both buy and sell 0.02 ETH without problems
Why can’t I sell less than 0.2 ETH via the API ?
Yes, i see this error
{
“code”: -1013,
“msg”: “Filter failure: LOT_SIZE”
}
MJW
December 15, 2020, 1:24pm
7
Are you sure the quantity is exactly 0.2? Please use var_dump to share the request details again
MJW
December 15, 2020, 1:29pm
9
Just var_dump the failed request details not the successful ones
11115
December 15, 2020, 1:33pm
10
I try sell 0,15 ETH from BTC
fail request
array(4) {
["link"]=>
string(36) "https://api.binance.com/api/v3/order"
["method"]=>
string(4) "POST"
["headers"]=>
["body"]=>
string(168) "symbol=ETHBTC&type=MARKET&side=SELL&quantity=0.14925&recvWindow=60000×tamp=1608039017000&signature=19f283cd6c22c99c9ae52cdecb8c4b3e623fa516a07012060b1390e1aa95b390"
}
MJW
December 15, 2020, 1:37pm
11
quantity=0.14925
Against the lot size filter:
{
“filterType”: “LOT_SIZE”,
“minQty”: “0.00100000”,
“maxQty”: “100000.00000000”,
“stepSize”: “0.00100000”
},
so your quantity can only have 3 digits in decimal part; 0.149 works but 0.14925 not
11115
December 15, 2020, 1:45pm
12
Oooh god, understud
Thanks so much)))
MJW
December 15, 2020, 1:20pm
5
11115:
quantity=0.02985
You see this? The quantity is against lot size filter:
{
“filterType”: “LOT_SIZE”,
“minQty”: “0.00100000”,
“maxQty”: “100000.00000000”,
“stepSize”: “0.00100000”
},