INNER CODE UNIT · Python

cancel_bulk_orders

nkaz001/sample-trading-bot · tradingbot/binancefutures.py:299

    async def cancel_bulk_orders(self, origClientOrderIdList):
        if len(origClientOrderIdList) > 10:
            raise Exception('The number of orders cannot exceed 10.')
        resp = await self.__curl_binancefutures(verb='DELETE', path='/v1/batchOrders',
                                                query={'symbol': self.symbol, 'origClientOrderIdList': origClientOrderIdList},
                                                max_retries=0)
        for item in resp:
            if 'code' in item:
                if item['code'] != -2011:
                    logging.warning('cancel_bulk_orders: error response=%s' % str(item))
                continue
            order_id = item['clientOrderId']
            order = self.open_orders_ws[order_id]
            if 'updateTime' not in order or order['updateTime'] < item['updateTime']:
                order.update(item)
        return resp

    async def cancel_all_orders(self):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…