Ejemplo n.º 1
0
    async def get_price(self, pair: Pair = None) -> dict:
        params = {}

        if pair is not None:
            params['symbol'] = map_pair(pair)

        return await self._create_get("price", params = params, headers = self._get_header())
Ejemplo n.º 2
0
    async def get_exchange_info(self, pair: Pair = None) -> dict:
        params = {}

        if pair is not None:
            params['symbol'] = map_pair(pair)

        return await self._create_get("market_summary", params = params, headers = self._get_header())
Ejemplo n.º 3
0
    async def create_order(self, pair: Pair, side: enums.OrderSide, type: enums.OrderType,
                                 amount: str, price: str = None, stop_price: str = None, post_only = None,
                                 trail_value: str = None, trigger_price: str = None,
                                 transction_type: enums.TransactionType = None,
                                 time_in_force: enums.TimeInForce = None, client_id: str = None) -> dict:
        data = self._clean_request_params({
            "symbol": map_pair(pair),
            "side": side.value,
            "type": type.value,
            "size": amount,
            "price": price,
            "stopPrice": stop_price,
            "postOnly": post_only,
            "clOrderID": client_id,
            "trailValue": trail_value,
            "triggerPrice": trigger_price
        })

        if time_in_force is not None:
            data['time_in_force'] = time_in_force.value

        if transction_type is not None:
            data['txType'] = transction_type.value

        return await self._create_post("order", data = data, headers = self._get_header(), signed = True)
Ejemplo n.º 4
0
    async def get_fees(self, pair: Pair = None) -> dict:
        params = {}

        if pair is not None:
            params['symbol'] = map_pair(pair)

        return await self._create_get("user/fees", params = params, headers = self._get_header(), signed = True)
Ejemplo n.º 5
0
    async def cancel_order(self, pair: Pair, order_id: str = None, client_order_id: str = None) -> dict:
        params = self._clean_request_params({
            "symbol": map_pair(pair),
            "orderId": order_id,
            "clOrderID": client_order_id
        })

        return await self._create_delete("order", params = params, headers = self._get_header(), signed = True)
Ejemplo n.º 6
0
    async def get_order_book(self, pair: Pair = None, depth: int = None) -> dict:
        params = self._clean_request_params({
            "depth": depth,
        })

        if pair is not None:
            params['symbol'] = map_pair(pair)

        return await self._create_get("orderbook/L2", params = params, headers = self._get_header())
Ejemplo n.º 7
0
 async def get_open_orders(self, pair: Pair) -> dict:
     params = {'symbol': map_pair(pair)}
     return await self._create_get("user/open_orders",
                                   params=params,
                                   headers=self._get_header(),
                                   signed=True)