joshuaulrich / quantmod

Quantitative Financial Modelling Framework
http://www.quantmod.com/
GNU General Public License v3.0
794 stars 219 forks source link

getSymbols.oanda fails due to unexpected response from oanda.com #388

Closed 66NsaIm4EJ closed 1 year ago

66NsaIm4EJ commented 1 year ago

Description

getSymbols.oanda() and functions that call it such as getFX and getMetals() fail with a warning message that they are unable to import data and error messages indicating that unexpected, unparseable output was received from oanda.com:

getSymbols.oanda("EUR/USD",from="2023-07-01",to="2023-07-07",auto.assign=FALSE) Warning: Unable to import “EUR/USD”. lexical error: invalid char in json text. <!DOCTYPE html> <html lang="en" (right here) ------^

Error in getSymbols.oanda("EUR/USD", from = "2023-07-01", to = "2023-07-07", : object 'fr' not found

Expected behavior

Functions return price data from oanda.com

Minimal, reproducible example

library(quantmod)
getFX("CAD/USD")
getSymbols.oanda("EUR/USD",from="2023-07-01",to="2023-07-07",auto.assign=FALSE)
getMetals(c("gold","XPD"))

Session Info

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.2 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.10.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] quantmod_0.4.20   TTR_0.24.3        xts_0.12.2        zoo_1.8-11       
[5] data.table_1.14.4

loaded via a namespace (and not attached):
[1] compiler_4.2.2  curl_4.3.3      grid_4.2.2      jsonlite_1.8.3 
[5] lattice_0.20-45
joshuaulrich commented 1 year ago

This was reported in #387 and has been fixed. Please update to the latest development version.

I also see that you're running quantmod version 0.4.20. That's 3 versions (and over 1 year old).

66NsaIm4EJ commented 1 year ago

Thank you, and apologies for not seeing that this had already been reported and fixed.

joshuaulrich commented 1 year ago

No worries! It could save your time in the future if you update to the latest development version and/or search for similar GitHub issues before spending your time writing a report. It only took me a few seconds to write my comment and close the issue. ;-)