Skip to content

Commit

Permalink
Put README figure files into a folder
Browse files Browse the repository at this point in the history
  • Loading branch information
vandomed committed Oct 14, 2019
1 parent cb24f73 commit d8f1056
Show file tree
Hide file tree
Showing 19 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
^.*\.Rproj$
^\.Rproj\.user$
^LICENSE$
^README.*$
^README*$
^Thumbs.db$
^.travis.yml$
^bibliography.bib$
Expand Down
Binary file added README-figures/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added README-figures/unnamed-chunk-11-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added README-figures/unnamed-chunk-4-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added README-figures/unnamed-chunk-8-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed README-unnamed-chunk-10-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-11-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-13-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-14-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-15-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-16-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-4-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-7-1.png
Binary file not shown.
Binary file removed README-unnamed-chunk-8-1.png
Binary file not shown.
3 changes: 2 additions & 1 deletion README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ nocite: |
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-",
#fig.path = "README-",
fig.path = "README-figures/",
warning = FALSE,
message = FALSE,
out.width = '80%',
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Get Rich with 'stocks'
================
Dane Van Domelen <br> <vandomed@gmail.com>
2019-10-12
2019-10-13

<!-- README.md is generated from README.Rmd. Please edit that file -->
[![Build Status](https://travis-ci.org/vandomed/stocks.svg?branch=master)](https://travis-ci.org/vandomed/stocks)
Expand Down Expand Up @@ -118,7 +118,7 @@ For a visual comparison of the returns and volatility of these two ETF's, we can
plot_metrics(metrics, mean ~ sd)
```

<img src="README-unnamed-chunk-4-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-4-1.png" width="80%" />

No surprise, the S&P 500 ETF had more growth, but also higher volatility.

Expand All @@ -135,7 +135,7 @@ c("SPY", "TLT") %>%
plot_metrics_overtime(pearson ~ .)
```

<img src="README-unnamed-chunk-5-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-5-1.png" width="80%" />

While the tendency is certainly for negative correlation, there's a lot of variability, and in some years the correlation was actually slightly positive.

Expand Down Expand Up @@ -177,7 +177,7 @@ plot_metrics_2funds(gains = gains,
tickers = c("SPY", "TLT"))
```

<img src="README-unnamed-chunk-8-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-8-1.png" width="80%" />

In terms of risk-adjusted growth, the Sharpe ratio curve is somewhat more interesting. The maximum Sharpe ratio occurs around 40% SPY, and the Sharpe ratio gets much worse as you approach 60% SPY and higher.

Expand All @@ -187,7 +187,7 @@ plot_metrics_2funds(gains = gains,
tickers = c("SPY", "TLT"))
```

<img src="README-unnamed-chunk-9-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-9-1.png" width="80%" />

We can gain additional insight by plotting two metrics against each other, across all possible allocations. A common strategy is to plot the mean vs. standard deviation as a function of the allocation:

Expand All @@ -197,7 +197,7 @@ plot_metrics_2funds(gains = gains,
tickers = c("SPY", "TLT"))
```

<img src="README-unnamed-chunk-10-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-10-1.png" width="80%" />

This plot yields an interesting finding: starting at 100% TLT, increasing the allocation to SPY simultaneously *reduces volatility* and *increases returns*. In other words, you'd be crazy not to ride the curve up and to the left, adding at least a 30% SPY allocation.

Expand All @@ -215,7 +215,7 @@ plot_metrics_3funds(formula = mean ~ sd,
tickers = c("VWEHX", "VBLTX", "UPRO"))
```

<img src="README-unnamed-chunk-11-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-11-1.png" width="80%" />

By default, SPY is included on the plot, so you can compare metrics to the S&P. Notice that many points on the UPRO-VBLTX-VWEHX surface are higher and to the left of SPY, meaning this strategy has the potential to trump the S&P in terms of risk-reward.

Expand All @@ -229,7 +229,7 @@ I'll close it out with a hot stock tip: buy FANG.
plot_growth(tickers = c("FB", "AAPL", "NFLX", "GOOG"), from = "2015-01-01")
```

<img src="README-unnamed-chunk-12-1.png" width="80%" />
<img src="README-figures/unnamed-chunk-12-1.png" width="80%" />

<!-- ## Conclusions -->
<!-- Hopefully this gives you a good idea of the main functions in **stocks**. There are a lot of options I didn't cover, especially for the graphics functions. You can read about these options by looking at the relevant help files (e.g. run `?twofunds_graph` in R). Please feel free to e-mail me at <vandomed@gmail.com> with questions or suggestions, or, better yet, contribute to the project on [GitHub](https://github.com/vandomed/stocks). -->
Expand Down

0 comments on commit d8f1056

Please sign in to comment.