def getBalance(self) -> object: dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getBalance", dit)
def getPayOutAddress(self, coin: str): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "coin": coin, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getPayOutAddress", dit)
def getFunds(self, account: int): dit = { "accesskey": self.accessKey, "account": account, "nonce": getTimestamp(), } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getFunds", dit)
def getBatchOrders(self, market: str, *ids: str): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "market": market, "data": ids, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getBatchOrders", dit)
def getOrder(self, market: str, id: str): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "market": market, "id": id, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getOrder", dit)
def batchOrder(self, market: str, jsonData: str): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "market": market, "data": jsonData, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().post(self.URL + "/trade/api/v1/batchOrder", dit)
def getPayOutRecord(self, coin: str, page, pageSize): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "coin": coin, "page": page, "pageSize": pageSize, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getPayOutRecord", dit)
def getOpenOrders(self, market: str, page, pageSize): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "market": market, "page": page, "pageSize": pageSize, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/getOpenOrders", dit)
def order(self, market: str, price: float, number: float, type, entrustType: float): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "market": market, "price": price, "number": number, "type": type, "entrustType": entrustType, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().post(self.URL + "/trade/api/v1/order", dit)
def withdraw(self, coin: str, safePwd: str, amount: float, address: str): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "coin": coin, "safePwd": safePwd, "amount": amount, "address": address, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().get(self.URL + "/trade/api/v1/withdraw", dit)
def transfer(self, _from, to, amount: float, coin: str, safePwd: str, ): dit = { "accesskey": self.accessKey, "nonce": getTimestamp(), "from": _from, "to": to, "amount": amount, "coin": coin, "safePwd": safePwd, } dit["signature"] = getSignature(dit, self.secretKey) return HttpUtil().post(self.URL + "/trade/api/v1/transfer", dit)
def getAccounts(self): return HttpUtil().get(self.URL + "/trade/api/v1/getAccounts")
def getMarketConfig(self): return HttpUtil().get(self.URL + "/data/api/v1/getMarketConfig")
def getTrades(self, market: str): return HttpUtil().get(self.URL + "/data/api/v1/getTrades?market=" + market)
def getDepth(self, market: str): return HttpUtil().get(self.URL + "/data/api/v1/getDepth?market=" + market)
def getTickers(self): return HttpUtil().get(self.URL + "/data/api/v1/getTickers")
def getKLine(self, market: str): return HttpUtil().get(self.URL + "/data/api/v1/getTicker?market=" + market)