Skip to content

OANDA returning string for currency above 1000, creating error when reversing the currency #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
STguerin opened this issue Apr 4, 2017 · 0 comments · Fixed by #366
Closed

Comments

@STguerin
Copy link

STguerin commented Apr 4, 2017

OANDA is returning string when currency is above 1000, so when you try to reverse the currency ( 1/df ) it raise an error

Code example:

from pandas_datareader.oanda import get_oanda_currency_historical_rates

fx_rates = get_oanda_currency_historical_rates(start='1990-01-01', end=None, quote_currency='USD', base_currency='KRW')


Traceback (most recent call last):
  File "C:\Anaconda2\lib\site-packages\IPython\core\interactiveshell.py", line 2881, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-14c50a5808d3>", line 3, in <module>
    fx_rates = get_oanda_currency_historical_rates(start='1990-01-01', end=None, quote_currency='USD', base_currency='KRW')
  File "C:\Anaconda2\lib\site-packages\pandas_datareader\oanda.py", line 52, in get_oanda_currency_historical_rates
    df = 1 / df
  File "C:\Anaconda2\lib\site-packages\pandas\core\ops.py", line 1097, in f
    return self._combine_const(other, na_op)
  File "C:\Anaconda2\lib\site-packages\pandas\core\frame.py", line 3555, in _combine_const
    raise_on_error=raise_on_error)
  File "C:\Anaconda2\lib\site-packages\pandas\core\internals.py", line 2911, in eval
    return self.apply('eval', **kwargs)
  File "C:\Anaconda2\lib\site-packages\pandas\core\internals.py", line 2890, in apply
    applied = getattr(b, f)(**kwargs)
  File "C:\Anaconda2\lib\site-packages\pandas\core\internals.py", line 1139, in eval
    result = handle_error()
  File "C:\Anaconda2\lib\site-packages\pandas\core\internals.py", line 1123, in handle_error
    (repr(other), str(detail)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant