Пример #1
0
    async def get_open_orders(self, symbol):
        """Get all open order information.
        Args:
            symbol: Symbol name, e.g. `BTCUSDT`.

        Returns:
            success: Success results, otherwise it's None.
            error: Error information, otherwise it's None.
        """
        uri = "/api/v3/openOrders"
        params = {
            "symbol": symbol,
            "timestamp": tools.get_cur_timestamp_ms()
        }
        success, error = await self.request("GET", uri, params=params, auth=True)
        return success, error
Пример #2
0
    async def get_order_status(self, symbol, order_id, client_order_id):
        """Get order details by order id.

        Args:
            symbol: Symbol name, e.g. `BTCUSDT`.
            order_id: Order id.
            client_order_id: Client order id.

        Returns:
            success: Success results, otherwise it's None.
            error: Error information, otherwise it's None.
        """
        uri = "/api/v3/order"
        params = {
            "symbol": symbol,
            "orderId": str(order_id),
            "origClientOrderId": client_order_id,
            "timestamp": tools.get_cur_timestamp_ms()
        }
        success, error = await self.request("GET", uri, params=params, auth=True)
        return success, error
Пример #3
0
    async def revoke_order(self, symbol, order_id, client_order_id=None):
        """Cancelling an unfilled order.
        Args:
            symbol: Symbol name, e.g. `BTCUSDT`.
            order_id: Order id.
            client_order_id: Client order id.

        Returns:
            success: Success results, otherwise it's None.
            error: Error information, otherwise it's None.
        """
        uri = "/api/v3/order"
        params = {
            "symbol": symbol,
            "orderId": order_id,
            "timestamp": tools.get_cur_timestamp_ms()
        }
        if client_order_id:
            params["origClientOrderId"] = client_order_id
        success, error = await self.request("DELETE", uri, params=params, auth=True)
        return success, error