0

我正在尝试在 python 中为 yobit 开发一个泵和转储机器人;但我不太了解如何使用他们的 API。

文档链接---> https://yobit.net/en/api

这效果不好,我不明白出了什么问题。

class yobit(object):

    def __init__(self, key, secret):
        self.key = key
        self.secret = secret
        self.public = ['info', 'ticker', 'depth', 'trades']
        self.trade = ['activeorders']


    def query(self, method, values={}):
        if method in self.public:
            url = 'https://yobit.net/api/3/'
        elif method in self.trade:
            url = 'https://yobit.net/tapi/'
        else:
            return 'You are doing it wrong'

        urlString = ''
        for i, k in values.items():
            urlString += k+'/'

        url += method + '/' + urlString

        print(url)
        if method not in self.public:
            url += '&apikey=' + self.key
            url += '&nonce=' + str(int(time.time()))
            signature = hmac.new(self.secret, url, hashlib.sha512).hexdigest()
            headers = {'apisign': signature}
        else:
            headers = {}
        print(url)

        req = requests.get(url, headers=headers)
        response = json.loads(req.text)
        return response

获取余额和下订单的语法是什么?

4

0 回答 0