File: fin-returns.Rd

package info (click to toggle)
r-cran-timeseries 4041.111-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,704 kB
  • sloc: makefile: 14
file content (116 lines) | stat: -rw-r--r-- 2,433 bytes parent folder | download
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
\name{returns}
\alias{returns}

\alias{returns,ANY-method}
\alias{returns,timeSeries-method}

\alias{returns0}

\alias{returnSeries}
\alias{getReturns}


\title{Financial returns}

\description{
    
  Compute financial returns from prices or indexes.
       
}

\usage{
returns(x, \dots)
returns0(x, \dots)

\S4method{returns}{ANY}(x, method = c("continuous", "discrete", 
    "compound", "simple"), percentage = FALSE, \dots)
\S4method{returns}{timeSeries}(x, method = c("continuous", "discrete", 
    "compound", "simple"), percentage = FALSE, na.rm = TRUE, 
    trim = TRUE, \dots) 
}

\arguments{

  \item{x}{
    an object of class \code{timeSeries}.
  }
  \item{method}{

    a character string. Which method should be used to compute the
    returns, one of "continuous", "discrete", or "compound", "simple".
    The second pair of methods is a synonym for the first two methods.

  }    
  \item{percentage}{
    
    a logical value. By default \code{FALSE}, if \code{TRUE} the series
    will be expressed in percentage changes.

  }
  \item{na.rm}{
    a logical value. Should NAs be removed? By default \code{TRUE}.
  }    
  \item{trim}{
    a logical value. Should the time series be trimmed? By Default 
    \code{TRUE}.
  }    
  \item{\dots}{
    arguments to be passed.
  }
        
}

\value{

  an object of class \code{timeSeries}.
    
  \code{returns0} returns an untrimmed series with the first
  row of returns set to zero(s).
        
}

\note{

  The functions \code{returnSeries} and \code{getReturns} will be
  removed in the near future. They are synonyms for the function
  \code{returns} and their use was discouraged for many years. Just use
  \code{returns}.

  The function \code{returnSeries} is no longer
  exported. \code{getReturns} is exported only because we are waiting
  for a package on CRAN to be updated.

}

\seealso{
  %\code{\link{returns}},
  \code{\link{cumulated}},
  \code{\link{drawdowns}},
  \code{\link{splits}},
  \code{\link{spreads}},
  \code{\link{midquotes}},
  \code{\link{index2wealth}}
}

\examples{
## Load Microsoft Data - 
   setRmetricsOptions(myFinCenter = "GMT")
   data(MSFT)
   X = MSFT[1:10, 1:4]
   X

## Continuous Returns - 
   returns(X)
   returns0(X)
  
## Discrete Returns:
   returns(X, method = "discrete")
   
## Don't trim:
   returns(X, trim = FALSE)
   
## Use Percentage Values:
   returns(X, percentage = TRUE, trim = FALSE)
}

\keyword{chron}