如何从雅虎(使用 Quantmod)获取 ETF 财务信息(例如资产净值)? [英] How to get ETF Financial information (e.g. NAV) from Yahoo (with Quantmod)?

查看:51
本文介绍了如何从雅虎(使用 Quantmod)获取 ETF 财务信息(例如资产净值)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以使用 quantmod 包从雅虎轻松获取股票财务信息.例如,如果我想获得成交量、市盈率和股息收益率:

I know that I can use the quantmod package to get stock financial information easily from yahoo. For example, if I want to get the Volume, P/E ratio and Dividend Yield:

> library(quantmod)
> AAPL <- getSymbols("AAPL")
Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  :
  downloaded length 167808 != reported length 200
> what_metrics <- yahooQF(c("Name",
+                    "Volume", 
+                    "P/E Ratio",
+                    "Dividend Yield"
+                    
+ ))
> 
> getQuote(AAPL, what=what_metrics)
              Trade Time       Name   Volume P/E Ratio Dividend Yield
AAPL 2016-03-02 04:00:00 Apple Inc. 33143834     10.72           2.15
> 
> 
> yahooQF()

 1:   Ask                                                        2:   Average Daily Volume                                    
 3:   Ask Size                                                   4:   Bid                                                     
 5:   Ask (Real-time)                                            6:   Bid (Real-time)                                         
 7:   Book Value                                                 8:   Bid Size                                                
 9:   Change & Percent Change                                   10:   Change                                                  
11:   Commission                                                12:   Change (Real-time)                                      
13:   After Hours Change (Real-time)                            14:   Dividend/Share                                          
15:   Last Trade Date                                           16:   Trade Date                                              
17:   Earnings/Share                                            18:   Error Indication (returned for symbol changed / invalid)
19:   EPS Estimate Current Year                                 20:   EPS Estimate Next Year                                  
21:   EPS Estimate Next Quarter                                 22:   Float Shares                                            
23:   Days Low                                                  24:   Days High                                               
25:   52-week Low                                               26:   52-week High                                            
27:   Holdings Gain Percent                                     28:   Annualized Gain                                         
29:   Holdings Gain                                             30:   Holdings Gain Percent (Real-time)                       
31:   Holdings Gain (Real-time)                                 32:   More Info                                               
33:   Order Book (Real-time)                                    34:   Market Capitalization                                   
35:   Market Cap (Real-time)                                    36:   EBITDA                                                  
37:   Change From 52-week Low                                   38:   Percent Change From 52-week Low                         
39:   Last Trade (Real-time) With Time                          40:   Change Percent (Real-time)                              
41:   Last Trade Size                                           42:   Change From 52-week High                                
43:   Percent Change From 52-week High                          44:   Last Trade (With Time)                                  
45:   Last Trade (Price Only)                                   46:   High Limit                                              
47:   Low Limit                                                 48:   Days Range                                              
49:   Days Range (Real-time)                                    50:   50-day Moving Average                                   
51:   200-day Moving Average                                    52:   Change From 200-day Moving Average                      
53:   Percent Change From 200-day Moving Average                54:   Change From 50-day Moving Average                       
55:   Percent Change From 50-day Moving Average                 56:   Name                                                    
57:   Notes                                                     58:   Open                                                    
59:   Previous Close                                            60:   Price Paid                                              
61:   Change in Percent                                         62:   Price/Sales                                             
63:   Price/Book                                                64:   Ex-Dividend Date                                        
65:   P/E Ratio                                                 66:   Dividend Pay Date                                       
67:   P/E Ratio (Real-time)                                     68:   PEG Ratio                                               
69:   Price/EPS Estimate Current Year                           70:   Price/EPS Estimate Next Year                            
71:   Symbol                                                    72:   Shares Owned                                            
73:   Short Ratio                                               74:   Last Trade Time                                         
75:   Trade Links                                               76:   Ticker Trend                                            
77:   1 yr Target Price                                         78:   Volume                                                  
79:   Holdings Value                                            80:   Holdings Value (Real-time)                              
81:   52-week Range                                             82:   Days Value Change                                       
83:   Days Value Change (Real-time)                             84:   Stock Exchange                                          
85:   Dividend Yield           

是否有类似的方法可以下载特定于 ETF 的财务信息(使用雅虎或任何其他来源)?

Is there a similar method for downloading Financial information specific for ETFs (using yahoo or any other sources) ?

例如,我如何下载 QQQ(ETF 基金)的 NAV 或净资产?yahooQF

For example, how can I download the NAV or Net Asset for QQQ (an ETF fund)? There are no NAV for yahooQF

提前致谢

推荐答案

library(FinancialInstrument)
currency(c("USD", "EUR"))
exchange_rate("EURUSD")
stock(c("SPY", "QQQ", "AAPL", "GS"), currency="USD")
ls_stocks()
ls_instruments()
update_instruments.yahoo(ls_stocks())
update_instruments.masterDATA(ls_stocks())
getInstrument("SPY")
getInstrument("QQQ")

## > getInstrument("QQQ")
## primary_id          :"QQQ"
## currency            :"USD"
## multiplier          :1
## tick_size           :0.01
## identifiers         : list()
## type                :"stock"
## name                :"PowerShares QQQ Trust, Series 1"
## exchange            :"NGM"
## avg.volume          :45327500
## EPS                 :23.6
## EPS.current.year.est:1.34
## book.value          :0
## range.52wk          :"84.74 - 115.75"
## defined.by          :"yahoo;masterDATA"
## updated             : POSIXct, format: "2016-03-06 02:54:10"
## Fund.Type           :"US Equity ETF"

你也可以使用这个:

library(qmao)
getQuote("QQQ")
getHoldings("QQQ") ## for holdings of ETF / MF  

这篇关于如何从雅虎(使用 Quantmod)获取 ETF 财务信息(例如资产净值)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆