public function marketSell(string $symbol, $quantity, array $flags = [])
{
// Get exchange information and filters for a specific symbol
$exchangeInfo = $this->exchangeInfo();
$symbolFilters = $exchangeInfo['symbols'][$symbol]['filters'];
$minQty = null;
// Look for the LOT_SIZE filter and get the minQty from there
foreach ($symbolFilters as $filter) {
if ($filter['filterType'] === 'LOT_SIZE' && isset($filter['minQty'])) {
$minQty = $filter['minQty'];
break;
}
}
// If minQty is not found, record an error and return false
if ($minQty === null) {
error_log("Not found minQty for LOT_SIZE filter for $symbol pair");
return false;
}
// Determine the number of decimal places for minQty and round the number of decimal places
$c = $this->numberOfDecimals($minQty);
$quantity = $this->floorDecimal($quantity, $c);
// Create Order
return $this->order("SELL", $symbol, $quantity, 0, "MARKET", $flags);
}
Example for function marketSell Before:
After:
public function marketSell(string $symbol, $quantity, array $flags = []) { // Get exchange information and filters for a specific symbol $exchangeInfo = $this->exchangeInfo(); $symbolFilters = $exchangeInfo['symbols'][$symbol]['filters'];