I'm using Python 3.9 and the Python - Binance API, version python-binance==1.0.15. In their test environment, I'm placing buy orders like so
order=self._get_auth_client(account).order_limit_buy(symbol=formatted_name,
quantity=amount,
price=fiat_price)
This returns the following JSON
{'symbol': 'ETHUSDT', 'orderId': 2603582, 'orderListId': -1, 'clientOrderId': 'Ru4Vv2jmxHIfGI21vIMtjD', 'transactTime': 1650828003836, 'price': '2915.16000000', 'origQty': '0.34303000', 'executedQty': '0.00000000', 'cummulativeQuoteQty': '0.00000000', 'status': 'NEW', 'timeInForce': 'GTC', 'type': 'LIMIT', 'side': 'BUY', 'fills': []}
Using the "orderId" field, I check the status of the order, and then get back the result
{'symbol': 'ETHUSDT', 'orderId': 2603582, 'orderListId': -1, 'clientOrderId': 'Ru4Vv2jmxHIfGI21vIMtjD', 'price': '2915.16000000', 'origQty': '0.34303000', 'executedQty': '0.08067000', 'cummulativeQuoteQty': '235.16595720', 'status': 'PARTIALLY_FILLED', 'timeInForce': 'GTC', 'type': 'LIMIT', 'side': 'BUY', 'stopPrice': '0.00000000', 'icebergQty': '0.00000000', 'time': 1650828003836, 'updateTime': 1650828050722, 'isWorking': True, 'origQuoteOrderQty': '0.00000000'}
the status indicates a partial fill. I was wondering if there was a way to specify my buy order such that it either fills completely or not at all. I don't see anything specified in their docs though but they are a little sparse.
I don't think it is possible. This is due to the nature of an exchange order-matching system. When you send an order to buy 0.34303ETH @2915.16, the exchange looks for people who wants to sell ETH @2915.16, aka. the counter-party. However the amount they want to sell can rarely be exactly 0.34303ETH. It can be greater or lesser than this quantity. That's why you can get partially filled when the market moves around the price level specified vastly.