Giter Club home page Giter Club logo

openexchangerates's People

Contributors

baratrion avatar kadirpekel avatar kyso avatar sprt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openexchangerates's Issues

JSON parsing should use decimals

The library returns floats at the moment, which may result in loss of accuracy. parse_float=decimal.Decimal needs to be passed to the JSON decoding somehow.

Package not python 3 compatible

The code uses the old style of exception handling. It appears that a small change

requests.exceptions.RequestException, e:    

to

requests.exceptions.RequestException as e:

on lines 52, 78 and 107 makes the code python 3.4 compatible using the anaconda distribution.

Time series data endpoint

Hello, I find your package to be pretty convenient. However, could you please add a time series endpoint?

KeyError caused by nonexistent currency

Getting a KeyError on exchange.tasks.update_task

Here's the info about the exception:

KeyError 'EEK'

exchange/adapters/__init__.py in _get_rate_through_usd at line 70
    
def _get_rate_through_usd(self, source, target, usd_rates):
        # from: https://openexchangerates.org/documentation#how-to-use
        # gbp_hkd = usd_hkd * (1 / usd_gbp)
        usd_source = usd_rates[source]
        usd_target = usd_rates[target]
        rate = usd_target * (Decimal(1.0) / usd_source)
        rate = rate.quantize(Decimal('0.123456'))  # round to 6 decimal places
        return rate
self <exchange.adapters.openexchangerates.OpenExchangeRatesAdapter object at 0x7f23d0dbed10>
source u'ZWL'
target u'EEK'
usd_rates {u'BBD': Decimal('2'), u'BIF': Decimal('1725.5'), u'BMD': Decimal('1'), u'BRL': Decimal('3.153503'), u'BSD': Decimal('1'), u'BZD': Decimal('2.015409'), u'CAD': Decimal('1.259755'), u'CVE': Decimal('95.6'), u'EGP': Decimal('17.9477'), u'GHS': Decimal('4.395'), u'GNF': Decimal('9000'), u'GYD': Decimal('207.98'), u'HNL': Decimal('23.46'), u'JEP': Decimal('0.766716'), u'JMD': Decimal('127.82'), u'KHR': Decimal('4101'), u'KPW': Decimal('900.09'), u'MXN': Decimal('17.504933'), u'MZN': Decimal('60.994761'), u'PKR': Decimal('105.25'), u'PYG': Decimal('5550.8'), u'RON': Decimal('3.96905'), u'SCR': Decimal('13.424847'), u'SSP': Decimal('124.6179'), u'UYU': Decimal('28.645625'), u'VND': Decimal('22723.99374'), u'XAU': Decimal('0...., u'ZWL': Decimal('322.322775')}
usd_source Decimal('322.322775')

After further investigation, getting a 400 when getting EEK rates too.

get_exchangerates('EEK')
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File "/app/.heroku/src/django-exchange/exchange/adapters/openexchangerates.py", line 29, in get_exchangerates
    return self.client.latest(base)['rates'].items()
  File "/app/.heroku/python/lib/python2.7/site-packages/openexchangerates/__init__.py", line 52, in latest
    raise OpenExchangeRatesClientException(e)
OpenExchangeRatesClientException: 400 Client Error: Bad Request for url: http://openexchangerates.org/api/latest.json?app_id=xxxxxxxxxxxxxxxxx&base=EEK

I obscured the app_id.

Shouldn't this be caught in some way?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.