barnumbirr / coinmarketcap

A python wrapper around the https://coinmarketcap.com API.
Apache License 2.0
436 stars 109 forks source link

Unable to use ticker #25

Closed JacobHepworth closed 6 years ago

JacobHepworth commented 6 years ago

I'm receiving the following error when trying to use the ticker method. I'm still able to access coinmarketcap.com regularly.

Traceback (most recent call last):
  File "C:/Users/Hepworth/Documents/portfolio.py", line 23, in <module>
    value = coinMarketCap.ticker(coin, limit=3, convert='USD')
  File "C:\Python36\lib\site-packages\coinmarketcap\core.py", line 54, in ticker
    response = self.__request('ticker/' + currency, params)
  File "C:\Python36\lib\site-packages\coinmarketcap\core.py", line 31, in __request
    raise Exception('An error occured, please try again.')
Exception: An error occured, please try again.
barnumbirr commented 6 years ago

Hello @JacobHepworth,

can you share the whole code snippet you're trying to use? (Pastebin or Gist will do).

Cheers.

tyknot commented 6 years ago

Getting the same error! Seems to happen when adding an optional currency.

Here's a code snippet:


[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from coinmarketcap import Market
>>> coin = Market()
>>> coin.ticker(currency='CAD')
barnumbirr commented 6 years ago

@404-brain That's mainly because you need to use the full name of the currency, so 'bitcoin' instead of 'BTC'.

Cheers.

JacobHepworth commented 6 years ago

@404-brain That was the problem. I was just confused by the exception that was given.

benibienz commented 6 years ago

@mrsmn Any chance the ticker function could be improved to accept ticker symbols as well? It's hard to integrate with other libraries at the moment.

barnumbirr commented 6 years ago

@benibienz The coinmarketcap API doesn't really allow for symbol input, only ID input is supported. Guess I could come up with something if people are interested.