Crypto-toolbox / bitex

Crypto-currency Exchange API Framework
MIT License
484 stars 136 forks source link

Problem with Bitfinex ticker #192

Closed torquemada163 closed 6 years ago

torquemada163 commented 6 years ago

I insert in file ..api/REST/api.py string print(url) in:

url = urljoin(self.uri, endpoint_path)

print(url)

if authenticate:  # sign off kwargs and url before sending request
            url, request_kwargs = self.sign(url, endpoint, endpoint_path,
                                            method_verb, *args, **kwargs)

This is my example:

from bitex.api.REST import BitfinexREST
import json

b = BitfinexREST()
b.load_key('bitfinex.key')

response = b.query('GET','pubticker', params={'pair': 'BTCUSD'})

print(response)

And I see this in terminal:

https://api.bitfinex.com/v1/pubticker
<Response [404]>

If I did how write in docs: https://i.imgur.com/hkJfWh0.jpg response = b.query('GET','pubticker', params={'symbol': 'BTCUSD'}) I see the same output..... What is wrong?

deepbrook commented 6 years ago

BitfinexRest is the API class - it does no additional wrapping or insertion of parameters for you (except signature generation) hence, you need to do this:

b = BitfinexREST(version
'v1')
b.load_key('key_file')
response = b.query('GET', 'pubticker/btcusd')
print(response)

If you're going to use the API classes, I suggest you familiarize yourself with the code and its doc strings. Thanks for using bitex!