2016年8月28日 星期日

從OANDA取得外匯匯率

> setSymbolLookup(EURUSD=list(name="EUR/USD",src="oanda"))
> getSymbols("EURUSD")
>
> # 查看前30筆
> head(EURUSD,30)
            EURUSD
2015-04-17 1.07838
2015-04-18 1.08067
2015-04-19 1.08067
2015-04-20 1.07684
2015-04-21 1.07210
2015-04-22 1.07404
2015-04-23 1.07481
2015-04-24 1.08391
2015-04-25 1.08749
2015-04-26 1.08749
2015-04-27 1.08654
2015-04-28 1.09168
2015-04-29 1.10292
2015-04-30 1.11577
2015-05-01 1.12224
2015-05-02 1.11975
2015-05-03 1.11975
2015-05-04 1.11681
2015-05-05 1.11470
2015-05-06 1.12569
2015-05-07 1.13194
2015-05-08 1.12262
2015-05-09 1.12035
2015-05-10 1.12035
2015-05-11 1.11623
2015-05-12 1.12042
2015-05-13 1.12725
2015-05-14 1.13834
2015-05-15 1.14010
2015-05-16 1.14480
>
> # 查看後30筆
> tail(EURUSD,30)
            EURUSD
2016-07-29 1.11173
2016-07-30 1.11746
2016-07-31 1.11746
2016-08-01 1.11695
2016-08-02 1.11945
2016-08-03 1.11940
2016-08-04 1.11392
2016-08-05 1.11183
2016-08-06 1.10873
2016-08-07 1.10873
2016-08-08 1.10870
2016-08-09 1.10912
2016-08-10 1.11572
2016-08-11 1.11624
2016-08-12 1.11544
2016-08-13 1.11621
2016-08-14 1.11621
2016-08-15 1.11725
2016-08-16 1.12393
2016-08-17 1.12734
2016-08-18 1.13188
2016-08-19 1.13298
2016-08-20 1.13253
2016-08-21 1.13253
2016-08-22 1.13020
2016-08-23 1.13265
2016-08-24 1.12822
2016-08-25 1.12777
2016-08-26 1.12724
2016-08-27 1.11966
>

沒有留言:

張貼留言