def cancelOrder(self, coinType, id, method="cancel_order"): coinType = chooseType(coinType) params = {"txid":id} result = "" try: result = ku.query_private(method, params, account=self.account) return result except BaseException as e: return {"result": "fail", "msg": "%s_%s" % (e, result)}
def getOrders(self, coinType, method="OpenOrders"): coinType = chooseType(coinType) method = 'OpenOrders' params = {"pair": coinType} result = "" try: result = ku.query_private(method, params, account=self.account) return result except BaseException as e: return {"result": "fail", "msg": "%s_%s" % (e, result)}
def sell(self, coinType, price, amount, method="AddOrder"): coinType = chooseType(coinType) params = {'pair': coinType, 'price': price, 'volume': amount, 'type': "sell", 'ordertype': "limit"} result = "" try: result = ku.query_private(method, params, account=self.account) return result except BaseException as e: return {"result": "fail", "msg": "%s_%s" % (e, result)}
def getAccountInfo(self,method="get_account_info"): try: method = "Balance" result = ku.query_private(method,account=self.account) coins = ["eos","usd","neo"] result = result["result"] _result = {} for c in result: _result[c[1:]] = result[c] for c in coins: if c not in result.keys(): _result[c] = {"available": 0, "frozen": 0} return result except BaseException as e: return {"result":"fail","msg":"%s"%e}
def order(self,pair,price,volume,Type,ordertype,method="AddOrder"): ''' params = {'pair': 'XXBTZEUR', 'type': 'buy', 'ordertype': 'limit', 'price': '1', 'volume': '1', 'close[pair]': 'XXBTZEUR', 'close[type]': 'sell', 'close[ordertype]': 'limit', 'close[price]': '9001', 'close[volume]': '1'} ''' method = 'AddOrder' params = {'pair': pair, 'price': price, 'volume': volume, 'type': Type, 'ordertype': ordertype} result = ku.query_private(method, params, account=self.account) return result
def QueryOrders(self,method=""): method = 'QueryOrders' params = {"txid":'1111'} result = ku.query_private(method, params, account=self.account) return result