Poloniex.py 文件源码

python
阅读 45 收藏 0 点赞 0 评论 0

项目:poloniex-python3 作者: a904guy 项目源码 文件源码
def _call(self, topic: str, args: dict() = {}):
        if topic in ['returnTicker', 'return24Volume', 'returnOrderBook', 'returnTradeHistory', 'returnChartData', 'returnCurrencies', 'returnLoanOrders']:
            api = [self.public_url, 'get', topic]
        else:
            api = [self.private_url, 'post', topic, self.secrets]

        def __call(api_details, uri):
            request = getattr(requests, api_details[1])
            headers = {}
            del uri['self']
            uri['command'] = api_details[2]
            if api_details[2] == 'post':
                uri['nonce'] = int(time.time() * 1000)
                sign = hmac.new(api_details[3]['secret'], uri, hashlib.sha512).hexdigest()
                headers['Sign'] = sign
                headers['Key'] = api_details[3]['api_key']
            return json.loads(request(api_details[0], uri, headers=headers).content.decode())

        with self.limiter:
            return __call(api, args)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号