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_getStockPort get fund's stock portfolio from financial reports.

MF_Turnover_annual get fund's annual turnover rate.

MF_setupday get fund's set up date.

MF_nav_stat get fund's nav stats.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
MF_getQuote(fundID, begT, endT, variables = "NAV_adj_return1",
  datasrc = c("wind", "jy", "ts"), NAfill = FALSE)

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

MF_Turnover_annual(fundID, begrptDate, endrptDate)

MF_setupday(fundID, datasrc = c("jy", "wind"))

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

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.

fundnav

is a data frame with four columns,contains date,fundID,nav_rtn,bmk_rtn.fundnav can be missing,if missing,this function with get data from specified data source.

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
#---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_setupday-------------------------------------------------------
re <- MF_setupday(fundID)

#---MF_nav_stat----------------------------------------------------------
# -- get one fund's nav stats from set up date.
mfstat <- MF_nav_stat(fundID='100038.OF')
# -- get one fund's yearly nav stats from set up date.
mfstat <- MF_nav_stat(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_nav_stat(fundID=fundID,begT=begT,endT=endT)
# -- define benchmark by yourself.
fundID <- c('000978.OF','000877.OF')
bmk <- c('EI000905','EI000300')
mfstat <- MF_nav_stat(fundID=fundID,bmk=bmk,datasrc='jy')
# -- pass raw data by yourself.
mfstat <- MF_nav_stat(fundnav=fundnav)

QuantAndrew/QDataGet documentation built on May 14, 2019, 7:35 a.m.