def get_account_history(self, account_id: 'int', currency: 'str' = None, transact_types: 'str' = None, start_time: 'int' = None, end_time: 'int' = None, sort: 'str' = None, size: 'int' = None): """ get account change record :return: account change record list. """ return call_sync_perforence_test( self.request_impl.get_account_history(account_id, currency, transact_types, start_time, end_time, sort, size))
def get_withdraw_history(self, currency: 'str', from_id: 'int', size: 'int', direct=None) -> list: """ Get the withdraw records of an account. :param currency: The currency, like "btc". (mandatory) :param from_id: The beginning withdraw record id. (mandatory) :param size: The size of record. (mandatory) :param direct: "prev" is order by asc, "next" is order by desc, default as "prev" :return: The list of withdraw records. """ return call_sync_perforence_test( self.request_impl.get_withdraw_history(currency, from_id, size, direct))
def cancel_open_orders(self, symbol: 'str', account_type: 'AccountType', side: 'OrderSide' = None, size: 'int' = None) -> BatchCancelResult: """ Request to cancel open orders. :param symbol: The symbol, like "btcusdt". (mandatory) :param account_type: Account type. (mandatory) :param side: The order side, buy or sell. If no side defined, will cancel all open orders of the account. (optional) :param size: The number of orders to cancel. Range is [1, 100]. Default is 100. (optional) :return: Status of batch cancel result. """ return call_sync_perforence_test( self.request_impl.cancel_open_orders(symbol, account_type, side, size))
def get_match_result(self, symbol: 'str', order_type: 'OrderSide' = None, start_date: 'str' = None, end_date: 'str' = None, size: 'int' = None, from_id: 'int' = None, direct:'str'=None): """ Search for the trade records of an account. :param symbol: The symbol, like "btcusdt" (mandatory). :param order_type: The types of order to include in the search (optional). :param start_date: Search starts date in format yyyy-mm-dd. (optional). :param end_date: Search ends date in format yyyy-mm-dd. (optional). :param size: The number of orders to return, range [1-100] default is 100. (optional). :param from_id: Search order id to begin with. (optional). :return: """ return call_sync_perforence_test(self.request_impl.get_match_results(symbol, order_type, start_date, end_date, size, from_id, direct))
def get_last_trade_and_best_quote(self, symbol: 'str') -> LastTradeAndBestQuote: """ Get last trade, best bid and best ask of a symbol. :param symbol: The symbol, like "btcusdt". (mandatory) :return: The data includes last trade, best bid and best ask. """ best_quote = call_sync_perforence_test(self.request_impl.get_best_quote(symbol)) last_trade = self.get_last_trade(symbol) last_trade_and_best_quote = LastTradeAndBestQuote() last_trade_and_best_quote.bid_amount = best_quote.bid_amount last_trade_and_best_quote.bid_price = best_quote.bid_price last_trade_and_best_quote.ask_amount = best_quote.ask_amount last_trade_and_best_quote.ask_price = best_quote.ask_price last_trade_and_best_quote.last_trade_price = last_trade.price last_trade_and_best_quote.last_trade_amount = last_trade.amount return last_trade_and_best_quote
def get_cross_margin_loan_orders(self, currency: 'str' = None, state: 'str' = None, start_date: 'str' = None, end_date: 'str' = None, from_id: 'int' = None, size: 'int' = None, direct: 'str' = None, sub_uid: 'int' = None) -> list: """ get cross margin loan orders :return: return list. """ return call_sync_perforence_test( self.request_impl.get_cross_margin_loan_orders( currency, state, start_date, end_date, from_id, size, direct, sub_uid))
def get_historical_orders(self, symbol: 'str', order_state: 'OrderState', order_type: 'OrderType' = None, start_date: 'str' = None, end_date: 'str' = None, start_id: 'int' = None, size: 'int' = None) -> list: """ Get historical orders. :param symbol: The symbol, like "btcusdt". (mandatory) :param order_state: Order state , SUBMITTED etc. (mandatory) :param order_type: Order type. (optional) :param start_date: Start date in format yyyy-mm-dd. (optional) :param end_date: End date in format yyyy-mm-dd. (optional) :param start_id: Start id. (optional) :param size: The size of orders. (optional) :return: """ return call_sync_perforence_test( self.request_impl.get_historical_orders(symbol, order_state, order_type, start_date, end_date, start_id, size))
def get_deposit_withdraw(self, op_type: 'str', currency: 'str' = None, from_id: 'int' = None, size: 'int' = None, direct: 'str' = None) -> list: """ Get the withdraw records of an account. :param currency: The currency, like "btc". (optional) :param from_id: The beginning withdraw record id. (optional) :param op_type: deposit or withdraw, see defination DepositWithdraw (mandatory) :param size: The size of record. (optional) :param direct: "prev" is order by asc, "next" is order by desc, default as "prev"(optional) :return: The list of withdraw records. """ return call_sync_perforence_test( self.request_impl.get_deposit_withdraw(op_type, currency, from_id, size, direct))
def get_order_in_recent_48hour(self, symbol=None, start_time=None, end_time=None, size=None, direct=None) -> list: """ Transfer Asset between Futures and Contract. :param direct: :param symbol: The target sub account uid to transfer to or from. (mandatory) :param start_time: The crypto currency to transfer. (mandatory) :param end_time: The amount of asset to transfer. (mandatory) :param size: The type of transfer, need be "futures-to-pro" or "pro-to-futures" (mandatory) :return: The Order list. """ return call_sync_perforence_test( self.request_impl.get_order_in_recent_48hour( symbol, start_time, end_time, size, direct))
def withdraw(self, address: 'str', amount: 'float', currency: 'str', fee: 'float' = None, address_tag: 'str' = None) -> int: """ Submit a request to withdraw some asset from an account. :param address: The destination address of this withdraw. (mandatory) :param amount: The amount of currency to withdraw. (mandatory) :param currency: The crypto currency to withdraw. (mandatory) :param fee: The fee to pay with this withdraw. (optional) :param address_tag: A tag specified for this address. (optional) :return: Withdraw id """ return call_sync_perforence_test( self.request_impl.withdraw(address, amount, currency, fee, address_tag))
def get_candlestick(self, symbol: 'str', interval: 'CandlestickInterval', size: 'int' = 150, start_time: 'int' = 0, end_time: 'int' = 0) -> list: """ Get the candlestick/kline for the specified symbol. The data number is 150 as default. :param symbol: The symbol, like "btcusdt". To query hb10, put "hb10" at here. (mandatory) :param interval: The candlestick/kline interval, MIN1, MIN5, DAY1 etc. (mandatory) :param size: The start time of of requested candlestick/kline data. (optional) :param start_time: The start time of of requested candlestick/kline data. (optional) :param end_time: The end time of of requested candlestick/kline data. (optional) :return: The list of candlestick/kline data. """ return call_sync_perforence_test( self.request_impl.get_candlestick(symbol, interval, size, start_time, end_time))
def get_account_ledger(self, account_id: 'int', currency: 'str' = None, transact_types: 'str' = None, start_time: 'int' = None, end_time: 'int' = None, sort: 'str' = None, limit: 'int' = None, from_id: 'int' = None) -> list: """ get account ledger :return: account ledger list. """ return call_sync_perforence_test( self.request_impl.get_account_ledger(account_id, currency, transact_types, start_time, end_time, sort, limit, from_id))
def get_open_orders(self, symbol: 'str', account_type: 'AccountType', side: 'OrderSide' = None, size: 'int' = 100, from_id=None, direct=None) -> list: """ The request of get open orders. :param symbol: The symbol, like "btcusdt". (mandatory) :param account_type: account type, all defination to see AccountType in SDK. (mandatory) :param side: The order side, buy or sell. If no side defined, will return all open orders of the account. (optional) :param size: The number of orders to return. Range is [1, 500]. Default is 100. (optional) :param direct: 1:prev order by ID asc from from_id, 2:next order by ID desc from from_id :param from_id: start ID for search :return: The orders information. """ return call_sync_perforence_test( self.request_impl.get_open_orders(symbol, account_type, size, side, from_id, direct))
def get_loan_history(self, symbol: 'str', start_date: 'str' = None, end_date: 'str' = None, status: 'LoanOrderState' = None, from_id: 'int' = None, size: 'int' = None, direction: 'QueryDirection' = None) -> list: """ Get the margin loan records. :param symbol: The symbol, like "btcusdt" (mandatory). :param start_date: The search starts date in format yyyy-mm-dd. (optional). :param end_date: The search end date in format yyyy-mm-dd.(optional, can be null). :param status: The loan order states, it could be created, accrual, cleared or invalid. (optional) :param from_id: Search order id to begin with. (optional) :param size: The number of orders to return.. (optional) :param direction: The query direction, prev or next. (optional) :return: The list of the margin loan records. """ return call_sync_perforence_test( self.request_impl.get_loan(symbol, start_date, end_date, status, from_id, size, direction))