R筋

プログラミング、金融、育児

【R】quantmodでファイナンスデータを取得

ファイナンスデータの取得・分析に強いquantmodのget系関数でできることをを挙げます。

toyota <- getSymbols("7203",src="yahooj",auto.assign=FALSE)

参考:
www.dmjtmj-stock.com

getSymbols.yahooj()を使って
getSymbols('7203.T',src='yahooj')でも可能ですね。

トヨタの10年間の4本値

YJ7203.Open YJ7203.High YJ7203.Low YJ7203.Close YJ7203.Volume YJ7203.Adjusted
2007-01-04 8110 8140 8060 8090 6986200 8090
2007-01-05 8100 8100 7860 7900 10876000 7900
2007-01-09 7900 7930 7810 7870 9750900 7870
2007-01-10 7890 7890 7660 7690 11632000 7690
2007-01-11 7750 7790 7630 7660 10417100 7660
2007-01-12 7740 7840 7720 7820 11302500 7820


getFX("USD/JPY")

過去半年間の為替レートが取得できます。

USD.JPY
2017-03-01 113.4712
2017-03-02 114.1899
2017-03-03 114.3148
2017-03-04 114.0033
2017-03-05 114.0050
2017-03-06 113.8457

getDividends("IBM", from = "1970-01-01", to = Sys.Date())

1970-01-01からのIBMの配当データが取得できます。
東証の株価データの取得については分かりませんでした。。

getFin('NASDAQ:AAPL')
viewFin(NASDAQ.AAPL.f, "CF", "A")

4半期分のファイナンスデータが取得できます。
Google Financeから取得しているとのことですが、
こちらも東証については取得方法がわからず…

2016-09-24
Net Income/Starting Line 45687
Depreciation/Depletion 10505
Amortization NA
Deferred Taxes 4938
Non-Cash Items 4210
Changes in Working Capital 484
Cash from Operating Activities 65824
Capital Expenditures -13548
Other Investing Cash Flow Items, Total -32429
Cash from Investing Activities -45977
Financing Cash Flow Items -1163
Total Cash Dividends Paid -12150
Issuance (Retirement) of Stock, Net -29227
Issuance (Retirement) of Debt, Net 22057
Cash from Financing Activities -20483
Foreign Exchange Effects NA
Net Change in Cash -636
Cash Interest Paid, Supplemental 1316
Cash Taxes Paid, Supplemental 10444
2015-09-26
Net Income/Starting Line 53394
Depreciation/Depletion 11257
Amortization NA
Deferred Taxes 1382
Non-Cash Items 3586
Changes in Working Capital 11647
Cash from Operating Activities 81266
Capital Expenditures -11488
Other Investing Cash Flow Items, Total -44786
Cash from Investing Activities -56274
Financing Cash Flow Items -750
Total Cash Dividends Paid -11561
Issuance (Retirement) of Stock, Net -34710
Issuance (Retirement) of Debt, Net 29305
Cash from Financing Activities -17716
Foreign Exchange Effects NA
Net Change in Cash 7276
Cash Interest Paid, Supplemental 514
Cash Taxes Paid, Supplemental 13252

getMetals("gold")

金/ドル相場
https://www.oanda.com/lang/ja/
から取得します。

getOptionChain()

http://secwords.com/%E3%82%AA%E3%83%97%E3%82%B7%E3%83%A7%E3%83%B3%E3%83%BB%E3%83%81%E3%82%A7%E3%82%A4%E3%83%B3.htmlsecwords.com
だそうです。

getQuate()

現在の株価を取得できます。
今日は日曜日なので試してないです。

getSymbols.csv
getSymbols.FRED
getSymbols.google
getSymbols.MySQL
getSymbols.oanda
getSymbols.rda
getSymbols.SQLite
getSymbols.yahoo

その他ソースを指定して取得する関数たち