def api_get(self, method, params={}): # 现货API if self.account: apikey, secretkey = get_account_key("okex", self.account) okcoinSpot = OKCoinSpot(okcoinRESTURL, apikey, secretkey) if method == "userinfo": api_do = "okcoinSpot.%s()" % (method) return eval(api_do) elif method in ["buy", "sell"]: return okcoinSpot.trade(params["symbol"], method, params["price"], params["amount"]) elif method == "cancelOrder": return okcoinSpot.cancelOrder(params["symbol"], params["id"]) elif method in ["order_info", "orders_info"]: return okcoinSpot.orderinfo(params["symbol"], params["id"]) elif method == "ticker": return okcoinSpot.ticker(symbol=params["symbol"]) elif method == "funds_transfer": return okcoinSpot.funds_transfer(params["amount"],params["From"],params["To"], params["symbol"]) elif method == "withdraw": #tradepwd = get_tradepwd("okex", self.account) tradepwd="huangxinyu2" return okcoinSpot.withdraw(params["symbol"], params["address"], params["amount"], tradepwd, params["fee"], params["addr_tag"])
def api_get(self, method, params={}): # 现货API if self.account: apikey, secretkey = get_account_key("okex", self.account) okcoinSpot = OKCoinSpot(okcoinRESTURL, apikey, secretkey) if method == "userinfo": api_do = "okcoinSpot.%s()" % (method) return eval(api_do) elif method in ["buy", "sell"]: return okcoinSpot.trade(params["symbol"], method, params["price"], params["amount"]) elif method == "cancelOrder": return okcoinSpot.cancelOrder(params["symbol"], params["id"]) elif method in ["order_info", "orders_info"]: return okcoinSpot.orderinfo(params["symbol"], params["id"]) elif method == "ticker": return okcoinSpot.ticker(symbol=params["symbol"]) elif method == "funds_transfer": return okcoinSpot.funds_transfer(params["amount"], params["from"], params["to"], symbol=params["symbol"])