def loan_orders(symbol, currency, start_date="", end_date="", start="", direct="", size=""): """ :param symbol: :param currency: :param direct: prev 向前,next 向后 :return: """ params = {"symbol": symbol, "currency": currency} if start_date: params["start-date"] = start_date if end_date: params["end-date"] = end_date if start: params["from"] = start if direct and direct in ["prev", "next"]: params["direct"] = direct if size: params["size"] = size url = "/v1/margin/loan-orders" return Utils.api_key_get(params, url)
def get_accounts(): """ :return: """ path = "/v1/account/accounts" params = {} return Utils.api_key_get(params, path)
def orders_matchresults(symbol, types=None, start_date=None, end_date=None, _from=None, direct=None, size=None): """ :param symbol: :param types: 可选值 {buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖} :param start_date: :param end_date: :param _from: :param direct: 可选值{prev 向前,next 向后} :param size: :return: """ params = {'symbol': symbol} if types: params[types] = types if start_date: params['start-date'] = start_date if end_date: params['end-date'] = end_date if _from: params['from'] = _from if direct: params['direct'] = direct if size: params['size'] = size url = '/v1/order/matchresults' return Utils.api_key_get(params, url)
def get_symbols(long_polling=None): """ """ params = {} if long_polling: params['long-polling'] = long_polling path = '/v1/common/symbols' return Utils.api_key_get(params, path)
def order_matchresults(order_id): """ :param order_id: :return: """ params = {} url = "/v1/order/orders/{0}/matchresults".format(order_id) return Utils.api_key_get(params, url)
def order_info(order_id): """ :param order_id: :return: """ params = {} url = "/v1/order/orders/{0}".format(order_id) return Utils.api_key_get(params, url)
def margin_balance(symbol): """ :param symbol: :return: """ params = {} url = "/v1/margin/accounts/balance" if symbol: params['symbol'] = symbol return Utils.api_key_get(params, url)
def get_balance(acct_id=None): """ :param acct_id :return: """ if not acct_id: accounts = get_accounts() acct_id = accounts['data'][0]['id'] url = "/v1/account/accounts/{0}/balance".format(acct_id) params = {"account-id": acct_id} return Utils.api_key_get(params, url)
def orders_list(symbol, states, types=None, start_date=None, end_date=None, _from=None, direct=None, size=None): """ :param symbol: :param states: 可选值 {pre-submitted 准备提交, submitted 已提交, partial-filled 部分成交, partial-canceled 部分成交撤销, filled 完全成交, canceled 已撤销} :param types: 可选值 {buy-market:市价买, sell-market:市价卖, buy-limit:限价买, sell-limit:限价卖} :param start_date: :param end_date: :param _from: :param direct: 可选值{prev 向前,next 向后} :param size: :return: """ params = {'symbol': symbol, 'states': states} if types: params[types] = types if start_date: params['start-date'] = start_date if end_date: params['end-date'] = end_date if _from: params['from'] = _from if direct: params['direct'] = direct if size: params['size'] = size url = '/v1/order/orders' return Utils.api_key_get(params, url)