MF_funcs: mutual fund stats functions

Description Usage Arguments Examples

Description

mutual fund stats functions

MF_getQuote get fund's quote from multiple data source.

MF_rtn_table get fund's nav stats.

MF_rtn_plot get funds' hedge nav plot

MF_rtn_get get fund's nav return

MF_basicinfo get fund's basic info

MF_getStockPort get fund's stock portfolio from financial reports.

MF_getStockPort get fund's industry allocation from financial reports.

MF_Turnover_annual get fund's annual turnover rate.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
MF_getQuote(fundID, begT, endT, variables = "NAV_adj_return1",
  datasrc = c("wind", "jy", "ts"), NAfill = FALSE)

MF_rtn_table(fundID, begT, endT, bmk = NULL, freq = NULL, scale = 250,
  datasrc = c("jy", "wind"))

MF_rtn_plot(fundID, begT, endT, bmk = NULL, datasrc = c("jy", "wind"),
  plottype = c("all", "excess"), wrap_sacles = c("free", "free_x", "free_y",
  "fixed"))

MF_rtn_get(fundID, begT, endT, bmk = NULL, datasrc = c("jy", "wind"))

MF_basicinfo(fundID, info = c("fundName", "setupday", "benchindex"),
  datasrc = c("jy", "wind"))

MF_getStockPort(fundID, rptDate, mode = c("all", "top10"), datasrc = c("jy",
  "ts", "wind"))

MF_getindustry(fundID, rptDate, datasrc = c("jy", "ts", "wind"))

MF_Turnover_annual(fundID, begrptDate, endrptDate)

Arguments

fundID

is vector of fundID.

begT

is a vector of begin date,can be missing,if missing,then fund's set up date will be begT

endT

is end date,can be missing,if missing,then the nearest trading day for today will be endT.

variables

see examples.

freq

is fund's nav statistic frequency,default value is NULL,same as rtn.periods.

scale

is number of periods in a year,for daily return default value is 250,for monthly return default value is 12.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#---MF_getQuote--------------------------------------------------------------
fundID <- c("519983.OF","519987.OF")
begT <- as.Date("2016-01-05")
# -- get one variable from wind
variables <- "NAV_adj_return1"
re <- MF_getQuote(fundID = fundID, begT = begT, variables = variables)
# -- get multiple variables from wind
variables <- "nav,NAV_adj,NAV_adj_return1"
re <- MF_getQuote(fundID = fundID, begT = begT, variables = variables)
# -- get one variable from jy
variables <- "NVDailyGrowthRate"
re <- MF_getQuote(fundID = fundID, variables = variables,datasrc = 'jy')
variables <- "UnitNV,NVDailyGrowthRate"
re <- MF_getQuote(fundID = fundID, variables = variables,datasrc = 'jy')

#---MF_getStockPort----------------------------------------------------------
fundID <- c("519983.OF","519987.OF")
re <- MF_getStockPort(fundID,as.Date("2016-09-30"),mode="top10",datasrc = "jy")

#---MF_Turnover_annual-------------------------------------------------------
begrptDate <- as.Date("2015-06-30")
endrptDate <- as.Date("2016-12-31")
fundID <- c("519983.OF","519987.OF")
re <- MF_Turnover_annual(fundID, begrptDate, endrptDate)

#---MF_basicinfo-------------------------------------------------------
#get fund's fundname and setupday
re <- MF_basicinfo(fundID)
#get setupday only
re <- MF_basicinfo(fundID,info='setupday')

#---MF_rtn_table----------------------------------------------------------
# -- get one fund's nav stats from set up date.
mfstat <- MF_rtn_table(fundID='100038.OF')
# -- get one fund's yearly nav stats from set up date.
mfstat <- MF_rtn_table(fundID='100038.OF',freq='year')
# -- get mutiple funds' nav stats from specified date.
fundID <- c('162411.OF','501018.OF')
begT <- as.Date('2016-01-04')
endT <- as.Date('2017-12-31')
mfstat <- MF_rtn_table(fundID=fundID,begT=begT,endT=endT)
# -- define benchmark by yourself.
fundID <- c('000978.OF','000877.OF')
bmk <- c('EI000905','EI000300')
mfstat <- MF_rtn_table(fundID=fundID,bmk=bmk)
#---MF_navrtn_plot----------------------------------------------------------
#all hs300 enchanced funds
fundID <- c("000478.OF","002311.OF","002510.OF","002906.OF","003986.OF","161017.OF")
begT <- as.Date('2018-01-02')
bmk <- 'EI000905'
MF_rtn_plot(fundID,begT,bmk=bmk)
# set begT as setupdate+
begT <- MF_basicinfo(fundID,info = 'setupday')+months(1)
MF_rtn_plot(fundID,begT,bmk=bmk)
# hs300 and zz500 enhanced funds
fundID <- c("000478.OF","002311.OF","310318.OF","002906.OF","003986.OF","161017.OF","100038.OF","163407.OF")
MF_rtn_plot(fundID) #bmk can be missing

raphael210/QDataGet documentation built on May 26, 2019, 11:02 p.m.