So based on theses informations I should use only 1 decimal for the amounts (quantity/lot size).
But I get amounts with 2 decimals which creates an error in my system:
OrderBook->setElement(Object(Brick\Math\BigDecimal), ‘2677497.7500000…’, ‘asks’)
So basically why is there 2 decimals instead of one, and if I should not use the LOT_SIZE.tick_size as base asset amount precision, which value should I use ?
$conn->send(json_encode([
‘method’ => ‘SUBSCRIBE’,
‘params’ => [
strtolower($this->pair)."@depth", // Orderbook updates - THIS ONE IS THE ONE THAT RETURNS BAD DECIMALS
“@userdata” // Trade updates
],
‘id’ => 1,
]));
I’m not able to reproduce the 2 decimals in quantity for xlmusdt@depth with the market stream: websocat "wss://stream.binance.com:9443/stream?streams=xlmusdt@depth"
I have the same error on price. Here is another example : EGLDUSDT
Taken today from /exchangeInfo:
filterType: “PRICE_FILTER”,
minPrice: “0.01000000”,
maxPrice: “100000.00000000”,
tickSize: “0.01000000”
So we agree that every prices should only have 2 decimals.
What I received from websocket API => OrderBook->setElement('121.93900000’, ‘7.50000000’, ‘asks’)
Function parameters definition => setElement($price, $qty, $side).
So sometimes I get 3 decimals in price instead of 2. This data is fresh and taken from today.
We will also keep track of the 2 symbols on our side and look out for this abnormal response. Please state the exact timestamp in your logs, thank you.
Here is raw data I received for pair EGLDUSDT. Check price for the 2 last elements of the array (13 & 14). This is the ASK array. tick_size is 0.01, so 2 decimals, but got 3.