coinbase/coinbase-python

get_*_price doesn't use specified currency

zoomorph opened this issue · 12 comments

It appears to mostly return in CAD instead of USD, despite asking for USD:

In [9]: client.get_spot_price(currency_pair='BTC-USD')
Out[9]:
<APIObject @ 0x38b7880> {
  "amount": "1386.45",
  "currency": "CAD"
}

Although sometimes it returns USD....

For the time being I'm using the REST API without authentication as a workaround.

@zoomorph does this still happen for you? I'm seeing this work as expected both in version 2.0.6, and on a build of master.

I'm experiencing a similar issue. I can't see to pass a custom currency_pair to get_spot_price, it will always default to BTC-USD for me. Also the 'date' parameter does not work with spot price either.

This was with
Python 3.6.0
coinbase 2.0.6
requests 2.13.0

Wasn't this fixed with #30 ?

Still facing the issue, when asking for ETH price it sometimes returns ETH otherwise USD.

I'm facing a similar issue, get_buy_price() returns BTC-GBP which is my account setting rather than the specified currency code BTC-USD. When I change my account setting to USD, I receive the BTC-USD price.

ki9us commented

Possibly not working to due to #35 and #30.

I am definitely getting EUR back in spite of requesting USD. The odd thing is that occasionally it actually returns USD. I am not sure why, perhaps there is some bad caching going on now with the massive and rapid growth in user base?

Note: Installing master has fixed this.

Same issue. The currency I get seems to be a random choice between USD, GBP, and EUR, and the currency argument seems to be completely ignored. Python 3.6.2, Coinbase 2.0.6.

I just ditched using coinbase package and started using urllib to fetch prices.

Working fine for 2 months now.
Here is the code:

http = urllib3.PoolManager()
r = http.request('GET', 'https://api.coinbase.com/v2/exchange-rates?currency=ETH')
rate = json.loads(r.data.decode('utf-8'))

@raaaaaymond I was wondering if it might be some sort of caching layer gone wrong. But, maybe it's just the client library not properly working with a newer API.

Have you tried the master branch?

Not working!

sds commented

We recently released a new version of this library. Please try it out and open a new issue if you're still encountering problems. Thanks!