# NOT RUN {
# Example I
# query history prices from yahoo
dt_yahoo1 = md_stock(symbol=c("^GSPC", "000001.SS"))
# FAANG
FAANG = md_stock(c('FB', 'AMZN', 'AAPL', 'NFLX', 'GOOG'), date_range = 'max')
# for Chinese shares/fund
## the symbol without suffix
dt_yahoo2 = md_stock(c("000001", "^000001", "512510"))
## the symbol with suffix
dt_yahoo3 = md_stock(c("000001.sz", "000001.ss"))
# adjust factors, splits and dividend
dt_adj = md_stock(symbol=c("AAPL", "000001.SZ", "000001.SS"),
type='adjfactor', date_range='max')
# Example II
# query history prices from 163
dt1 = md_stock(symbol=c('600000', '000001', '^000001', '^399001'),
source="163")
# valuation ratios (pe, pb, ps)
# only available for stock shares in sse and szse
dt2 = md_stock(symbol=c('600000', '000001', '^000001', '^399001'),
source="163", valuation = TRUE)
# Example III
# query spot prices
dt_spot1 = md_stock(symbol=c('600000.SS', '000001.SZ', '000001.SS', '399001.SZ'),
type='spot', source="163")
# query spot prices of all A shares in sse and szse
dt_spot2 = md_stock(symbol='a', source="163", type='spot')
# query spot prices of all A/B shares and index in sse and szse
dt_spot3 = md_stock(symbol=c('a', 'b', 'index'), source="163", type='spot')
# show spot prices and sector/industry
dt_spot4 = md_stock(symbol = c('a', 'b', 'index', 'fund'), source = '163',
type = 'spot', show_tags = TRUE)
# Example IV
# query company information, including profile, IPO, structure of income, structure of employee
dt_info = md_stock('600036', type = 'info')
# query structure of income in history only
dt_info2 = md_stock('600036', type = 'info', str_income_hist = TRUE)
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab