Example #1
0
    def get_margin_max_transfer(self, asset: 'str') -> any:
        """
        Query Max Transfer-Out Amount (USER_DATA)

        Get /sapi/v1/margin/maxTransferable
        """
        return call_sync(self.request_impl.get_margin_max_transfer(asset))
Example #2
0
    def get_sub_account_status(self, email: 'str' = None) -> any:
        """
        Get Sub-account's Status on Margin/Futures(For Master Account)

        GET /sapi/v1/sub-account/status (HMAC SHA256)
        """
        return call_sync(self.request_impl.get_sub_account_status(email))
Example #3
0
    def get_open_oco(self) -> any:
        """
        Query Open OCO (USER_DATA)

        GET /api/v3/openOrderList (HMAC SHA256)
        """
        return call_sync(self.request_impl.get_open_oco())
Example #4
0
    def get_margin_pair(self, symbol: 'str') -> any:
        """
        Query Margin Pair (MARKET_DATA)

        GET /sapi/v1/margin/pair
        """
        return call_sync(self.request_impl.get_margin_pair(symbol))
Example #5
0
    def post_order(
            self,
            symbol: 'str',
            side: 'OrderSide',
            ordertype: 'OrderType',
            timeInForce: 'TimeInForce' = TimeInForce.INVALID,
            quantity: 'float' = None,
            quoteOrderQty: 'float' = None,
            price: 'float' = None,
            newClientOrderId: 'str' = None,
            stopPrice: 'float' = None,
            icebergQty: 'float' = None,
            newOrderRespType: 'OrderRespType' = OrderRespType.INVALID) -> any:
        """
        New Order (TRADE)

        POST /api/v3/order (HMAC SHA256)

        Send in a new order.
        """
        return call_sync(
            self.request_impl.post_order(symbol, side, ordertype, timeInForce,
                                         quantity, quoteOrderQty, price,
                                         newClientOrderId, stopPrice,
                                         icebergQty, newOrderRespType))
Example #6
0
    def get_margin_priceindex(self, symbol: 'str') -> any:
        """
        Query Margin PriceIndex (MARKET_DATA)

        GET /sapi/v1/margin/priceIndex
        """
        return call_sync(self.request_impl.get_margin_priceindex(symbol))
Example #7
0
    def get_margin_pairs(self) -> any:
        """
        Get All Margin Pairs (MARKET_DATA)

        GET /sapi/v1/margin/allPairs
        """
        return call_sync(self.request_impl.get_margin_pairs())
Example #8
0
    def post_margin_order(
            self,
            symbol: 'str',
            side: 'OrderSide',
            ordertype: 'OrderType',
            quantity: 'float' = None,
            price: 'float' = None,
            stopPrice: 'float' = None,
            newClientOrderId: 'str' = None,
            icebergQty: 'float' = None,
            newOrderRespType: 'OrderRespType' = OrderRespType.INVALID,
            sideEffectType: 'SideEffectType' = SideEffectType.INVALID,
            timeInForce: 'TimeInForce' = TimeInForce.INVALID) -> any:
        """
        Margin Account New Order (TRADE)

        POST /sapi/v1/margin/order (HMAC SHA256) 
        
        Post a new order for margin account.
        """
        return call_sync(
            self.request_impl.post_margin_order(symbol, side, ordertype,
                                                quantity, price, stopPrice,
                                                newClientOrderId, icebergQty,
                                                newOrderRespType,
                                                sideEffectType, timeInForce))
Example #9
0
    def get_order_book(self, symbol: 'str', limit: 'int' = None) -> any:
        """
        Order Book

        GET /api/v3/depth
        """
        return call_sync(self.request_impl.get_order_book(symbol, limit))
Example #10
0
    def get_margin_open_orders(self, symbol: 'str' = None) -> any:
        """
        Query Margin Account's Open Order (USER_DATA)

        GET /sapi/v1/margin/openOrders (HMAC SHA256)
        """
        return call_sync(self.request_impl.get_margin_open_orders(symbol))
Example #11
0
    def get_margin_account(self) -> any:
        """
        Query Margin Account Details (USER_DATA)

        GET /sapi/v1/margin/account (HMAC SHA256)
        """
        return call_sync(self.request_impl.get_margin_account())
Example #12
0
    def get_margin_max_borrow(self, asset: 'str') -> any:
        """
        Query Max Borrow (USER_DATA)

        Get /sapi/v1/margin/maxBorrowable
        """
        return call_sync(self.request_impl.get_margin_max_borrow(asset))
Example #13
0
    def get_sub_account_futures_summary(self) -> any:
        """
        Get Summary of Sub-account's Margin Account (For Master Account)

        GET /sapi/v1/sub-account/futures/accountSummary (HMAC SHA256)
        """
        return call_sync(self.request_impl.get_sub_account_futures_summary())
Example #14
0
    def get_margin_asset(self, asset: 'str') -> any:
        """
        Query Margin Asset (MARKET_DATA)

        GET /sapi/v1/margin/asset
        """
        return call_sync(self.request_impl.get_margin_asset(asset))
Example #15
0
    def post_oco(
            self,
            symbol: 'str',
            side: 'OrderSide',
            quantity: 'float',
            price: 'float',
            stopPrice: 'float',
            listClientOrderId: 'str' = None,
            limitClientOrderId: 'str' = None,
            limitIcebergQty: 'float' = None,
            stopClientOrderId: 'str' = None,
            stopLimitPrice: 'float' = None,
            stopIcebergQty: 'float' = None,
            stopLimitTimeInForce: 'TimeInForce' = TimeInForce.INVALID,
            newOrderRespType: 'OrderRespType' = OrderRespType.INVALID) -> any:
        """
        New OCO (TRADE)

        POST /api/v3/order/oco (HMAC SHA256)

        Send in a new OCO
        """
        return call_sync(
            self.request_impl.post_oco(symbol, listClientOrderId, side,
                                       quantity, limitClientOrderId, price,
                                       limitIcebergQty, stopClientOrderId,
                                       stopPrice, stopLimitPrice,
                                       stopIcebergQty, stopLimitTimeInForce,
                                       newOrderRespType))
Example #16
0
    def get_sub_account_futures_detail(self, email: 'str') -> any:
        """
        Get Detail on Sub-account's Futures Account (For Master Account)

        GET /sapi/v1/sub-account/futures/account (HMAC SHA256)
        """
        return call_sync(
            self.request_impl.get_sub_account_futures_detail(email))
Example #17
0
    def get_sub_account_margin_detail(self, email: 'str' = None) -> any:
        """
        Get Detail on Sub-account's Margin Account (For Master Account)

        GET /sapi/v1/sub-account/margin/account (HMAC SHA256)
        """
        return call_sync(
            self.request_impl.get_sub_account_margin_detail(email))
Example #18
0
    def get_sub_account_futures_positionrisk(self, email: 'str') -> any:
        """
        Get Futures Postion-Risk of Sub-account (For Master Account)

        GET /sapi/v1/sub-account/futures/positionRisk (HMAC SHA256)
        """
        return call_sync(
            self.request_impl.get_sub_account_futures_positionrisk(email))
Example #19
0
    def post_sub_account_enable_futures(self, email: 'str' = None) -> any:
        """
        Enable Futures for Sub-account (For Master Account)

        POST /sapi/v1/sub-account/futures/enable (HMAC SHA256)
        """
        return call_sync(
            self.request_impl.post_sub_account_enable_futures(email))
Example #20
0
    def post_dust_transfer(self, asset: 'list') -> any:
        """
        Dust Transfer (USER_DATA)

        Post /sapi/v1/asset/dust (HMAC SHA256)

        Convert dust assets to BNB.
        """
        return call_sync(self.request_impl.post_dust_transfer(asset))
Example #21
0
    def get_open_orders(self, symbol: 'str' = None) -> any:
        """
        Current Open Orders (USER_DATA)

        GET /api/v3/openOrders (HMAC SHA256)

        Get all open orders on a symbol. Careful when accessing this with no symbol.
        """
        return call_sync(self.request_impl.get_open_orders(symbol))
Example #22
0
    def get_servertime(self) -> any:
        """
        Check Server Time

        GET /api/v3/time

        Test connectivity to the Rest API and get the current server time.
        """
        return call_sync(self.request_impl.get_servertime())
Example #23
0
    def get_all_coins_information(self) -> any:
        """
        All Coins' Information (USER_DATA)

        GET /sapi/v1/capital/config/getall (HMAC SHA256)

        Get all coins' information for user.
        """
        return call_sync(self.request_impl.get_all_coins_information())
Example #24
0
    def get_current_average_price(self, symbol: 'str') -> any:
        """
        Current Average Price

        GET /api/v3/avgPrice

        Current average price for a symbol.
        """
        return call_sync(self.request_impl.get_current_average_price(symbol))
Example #25
0
    def get_exchange_information(self) -> any:
        """
        Exchange Information

        GET /api/v3/exchangeInfo

        Current exchange trading rules and symbol information
        """
        return call_sync(self.request_impl.get_exchange_information())
Example #26
0
    def get_symbol_price_ticker(self, symbol: 'str' = None) -> any:
        """
        Symbol Price Ticker

        GET /api/v3/ticker/price

        Latest price for a symbol or symbols.
        """
        return call_sync(self.request_impl.get_symbol_price_ticker(symbol))
Example #27
0
    def get_symbol_orderbook_ticker(self, symbol: 'str' = None) -> any:
        """
        Symbol Order Book Ticker

        GET /api/v3/ticker/bookTicker

        Best price/qty on the order book for a symbol or symbols.
        """
        return call_sync(self.request_impl.get_symbol_orderbook_ticker(symbol))
Example #28
0
    def get_account_information(self) -> any:
        """
        Account Information (USER_DATA)

        GET /api/v3/account (HMAC SHA256)

        Get current account information.
        """
        return call_sync(self.request_impl.get_account_information())
Example #29
0
    def post_margin_repay(self, asset: 'str', amount: 'float') -> any:
        """
        Margin Account Repay (MARGIN)

        POST /sapi/v1/margin/repay (HMAC SHA256)

        Repay loan for margin account.
        """
        return call_sync(self.request_impl.post_margin_repay(asset, amount))
Example #30
0
    def post_margin_borrow(self, asset: 'str', amount: 'float') -> any:
        """
        Margin Account Borrow (MARGIN)

        POST /sapi/v1/margin/loan (HMAC SHA256)

        Apply for a loan.
        """
        return call_sync(self.request_impl.post_margin_borrow(asset, amount))