# daily_yearly: Convert Daily Gain to X-year Gain In stocks: Stock Market Analysis

## Description

Converts a daily proportion gain to a corresponding annual (or several year) gain. For example, an investment that gains 0.1% per day would gain approximately 28.5% in a year (252 trading days). The formula is: `total.gain = (1 + daily.gain) ^ (252 * years) - 1`. Here `total.gain` and `daily.gain` are proportions, e.g. 0.15 for 15%.

## Usage

 `1` ```daily.yearly(daily.gain, years = 1) ```

## Arguments

 `daily.gain` Numeric value (or vector) representing the daily proportion gain of an investment. `years` Number of years over which you would like to calculate the corresponding total gain. For example, set to 3 if you wish to calculate the 3-year gain for an investment that has a daily gain of `daily.gain`.

## Value

Numeric value indicating total gain.

## Author(s)

Dane R. Van Domelen

## References

Acknowledgment: This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-0940903.

`yearly.daily`, `convert.rate`

## Examples

 ```1 2 3 4 5``` ```# Calculate annual gain for an investment that gains 0.1% per day daily.yearly(daily.gain = 0.001) # Calculate 5-year gains corresponding to various daily gains daily.yearly(daily.gain = seq(0, 0.001, 0.0001), years = 5) ```

### Example output

```Loading required package: rbenchmark
[1] 0.2851489
[1] 0.0000000 0.1337081 0.2852778 0.4570933 0.6518562 0.8726287 1.1228811
[8] 1.4065463 1.7280815 2.0925377 2.5056394
```

stocks documentation built on May 2, 2019, 5:22 p.m.