On Mon, May 23, 2016 at 8:57 PM, David Menezes <david.n.mene...@gmail.com> wrote: > Hi > > Apologies if this has already been asked and answered or if I've labelled > the subject incorrectly but I can't find a solution using the search > function for this group; the vignette documentation for quantmod or general > google searches. > > I'm attempting to use quantmod to download foreign currency exchange > rates. I'm using the call "getFX" however the output results are always > restricted to 4 decimal places. Generally this is fine but when comparing > developing and mature economies this can lead to no answer being returned > due to how weak a specific currency is (in relative terms). > > For example, compare the following two results for converting USD to > Vietnamese Dong (VND): > > a) *1/getFX("USD/VND",from="2016-05-22",to ="2016-05-22", source = > "oanda", auto.assign=FALSE)* > > This yields… > > USD.VND > > 2016-05-22 4.473272e-05 > > However my preferred call would be: > > b)* getFX("VND/USD",from="2016-05-22",to ="2016-05-22", source = > "oanda", auto.assign=FALSE)* > > However this yields a zero result: > > VND.USD > > 2016-05-22 0 > > > which is clearly wrong. > That's the data Oanda provides via the URL quantmod::getSymbols.oanda uses. Look for yourself:
http://www.oanda.com/currency/historical-rates/download?quote_currency=VND&end_date=2016-05-22&start_date=2016-05-22&period=daily&display=absolute&rate=0&data_range=d7&price=mid&view=table&base_currency_0=USD&base_currency_1=&base_currency_2=&base_currency_3=&base_currency_4=&download=csv > > I've tried various things including trying to invoke options (digits = 10) > at the start of the script, and even within the getFX wrapper as an extra > argument, but it doesn't work. I can of course run select cross currency > rates and invert the results, but that is pretty awkward and it feels like > there ought to be a smarter and simpler solution. > In case it's not clear from what I said above, there's nothing you can do to fix this after you've retrieved the data. You need a more accurate data source. > Any help greatly appreciated. > > Thanks > Dave > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Joshua Ulrich | about.me/joshuaulrich FOSS Trading | www.fosstrading.com R/Finance 2016 | www.rinfinance.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.