charting one etf
play

Charting one ETF H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. - PowerPoint PPT Presentation

Charting one ETF H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. Regenstein, Jr. Director of Financial Services, RStudio, Inc. Five ETF prices in one xts object etf_prices_xts SPY EFA IJS EEM AGG 2012-12-31 128.3092


  1. Charting one ETF H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. Regenstein, Jr. Director of Financial Services, RStudio, Inc.

  2. Five ETF prices in one xts object etf_prices_xts SPY EFA IJS EEM AGG 2012-12-31 128.3092 49.16410 75.06590 39.89233 98.19626 2013-01-02 131.5977 49.92501 77.12553 40.67489 98.08131 2013-01-03 131.3004 49.44080 77.02349 40.38705 97.83374 2013-01-04 131.8771 49.69155 77.62656 40.46800 97.93983 2013-01-07 131.5166 49.47539 77.17194 40.16218 97.88681 2013-01-08 131.1382 49.19869 76.87505 39.80238 97.97523 2013-01-09 131.4716 49.44944 77.09772 39.97328 97.90449 2013-01-10 132.5168 50.08064 77.19049 40.32409 97.89565 2013-01-11 132.5077 50.18440 77.13483 40.00026 97.99291 2013-01-14 132.4177 50.24492 77.11628 40.17117 98.08131 HIGHCHARTER FOR FINANCE IN R

  3. A line chart of SPY etf_prices_xts$SPY SPY 2012-12-31 128.3092 2013-01-02 131.5977 2013-01-03 131.3004 2013-01-04 131.8771 2013-01-07 131.5166 2013-01-08 131.1382 2013-01-09 131.4716 2013-01-10 132.5168 2013-01-11 132.5077 2013-01-14 132.4177 HIGHCHARTER FOR FINANCE IN R

  4. Start with a blank chart highchart(type = "stock") HIGHCHARTER FOR FINANCE IN R

  5. Add data highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY) HIGHCHARTER FOR FINANCE IN R

  6. HIGHCHARTER FOR FINANCE IN R

  7. Chart the price of EEM highchart(type = "stock") %>% hc_add_series(etf_prices_xts$EEM, color = "green") HIGHCHARTER FOR FINANCE IN R

  8. Let's chart some ETF prices! H IGH CH ARTER F OR F IN AN CE IN R

  9. Chart the price of many stocks from xts H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. Regenstein, Jr. Director of Financial Services, RStudio, Inc.

  10. Multiple ETFs for charting etf_prices_xts SPY EFA IJS EEM AGG 2012-12-31 128.3092 49.16410 75.06590 39.89233 98.19626 2013-01-02 131.5977 49.92501 77.12553 40.67489 98.08131 2013-01-03 131.3004 49.44080 77.02349 40.38705 97.83374 2013-01-04 131.8771 49.69155 77.62656 40.46800 97.93983 2013-01-07 131.5166 49.47539 77.17194 40.16218 97.88681 2013-01-08 131.1382 49.19869 76.87505 39.80238 97.97523 2013-01-09 131.4716 49.44944 77.09772 39.97328 97.90449 2013-01-10 132.5168 50.08064 77.19049 40.32409 97.89565 2013-01-11 132.5077 50.18440 77.13483 40.00026 97.99291 2013-01-14 132.4177 50.24492 77.11628 40.17117 98.08131 HIGHCHARTER FOR FINANCE IN R

  11. Add another series highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY) %>% hc_add_series(etf_prices_xts$IJS) HIGHCHARTER FOR FINANCE IN R

  12. HIGHCHARTER FOR FINANCE IN R

  13. Color each series highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue") %>% hc_add_series(etf_prices_xts$IJS, color = "red") HIGHCHARTER FOR FINANCE IN R

  14. HIGHCHARTER FOR FINANCE IN R

  15. Naming the series highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_add_series(etf_prices_xts$IJS, color = "red", name = "IJS") HIGHCHARTER FOR FINANCE IN R

  16. HIGHCHARTER FOR FINANCE IN R

  17. Two price histories on a customized chart HIGHCHARTER FOR FINANCE IN R

  18. Three ETFs highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_add_series(etf_prices_xts$IJS, color = "red", name = "IJS") %>% hc_add_series(etf_prices_xts$EEM, color = "green", name = "EEM") HIGHCHARTER FOR FINANCE IN R

  19. HIGHCHARTER FOR FINANCE IN R

  20. Let's practice charting several price histories! H IGH CH ARTER F OR F IN AN CE IN R

  21. Title, subtitle and axes (not of evil)! H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. Regenstein, Jr. Director of Financial Services, RStudio, Inc.

  22. Adding a title highchart(type = "stock") %>% hc_title(text = "5 ETFs Price History") HIGHCHARTER FOR FINANCE IN R

  23. Adding a subtitle highchart(type = "stock") %>% hc_title(text = "5 ETFs Price History") %>% hc_subtitle(text = "daily prices") HIGHCHARTER FOR FINANCE IN R

  24. Title, subtitle, and data highchart(type = "stock") %>% hc_title(text = "5 ETFs Price History") %>% hc_subtitle(text = "daily prices") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_add_series(etf_prices_xts$IJS, color = "red", name = "IJS") %>% hc_add_series(etf_prices_xts$EEM, color = "green", name = "EEM") %>% hc_add_series(etf_prices_xts$EFA, color = "purple", name = "EFA") %>% hc_add_series(etf_prices_xts$AGG, color = "orange", name = "AGG") HIGHCHARTER FOR FINANCE IN R

  25. HIGHCHARTER FOR FINANCE IN R

  26. Customizing the y-axis highchart(type = "stock") %>% hc_title(text = "5 ETFs Price History") %>% hc_subtitle(text = "daily prices") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_add_series(etf_prices_xts$IJS, color = "red", name = "IJS") %>% hc_add_series(etf_prices_xts$EEM, color = "green", name = "EEM") %>% hc_add_series(etf_prices_xts$EFA, color = "purple", name = "EFA") %>% hc_add_series(etf_prices_xts$AGG, color = "orange", name = "AGG") hc_yAxis(title = list(text = "Prices (USD)"), labels = list(format = "${value}"), opposite = FALSE) HIGHCHARTER FOR FINANCE IN R

  27. HIGHCHARTER FOR FINANCE IN R

  28. Let's practice the title, subtitle and y- axis H IGH CH ARTER F OR F IN AN CE IN R

  29. Tooltips and legends H IGH CH ARTER F OR F IN AN CE IN R Jonathan K. Regenstein, Jr. Director of Financial Services, RStudio, Inc.

  30. HIGHCHARTER FOR FINANCE IN R

  31. HIGHCHARTER FOR FINANCE IN R

  32. Customizing the tooltip highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_tooltip(pointFormat = "text in the tooltip") HIGHCHARTER FOR FINANCE IN R

  33. HIGHCHARTER FOR FINANCE IN R

  34. Dynamic tooltip highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_tooltip(pointFormat = "${point.y}") HIGHCHARTER FOR FINANCE IN R

  35. HIGHCHARTER FOR FINANCE IN R

  36. Rounding the tooltip highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_tooltip(pointFormat = "${point.y: .2f}") HIGHCHARTER FOR FINANCE IN R

  37. HIGHCHARTER FOR FINANCE IN R

  38. Dynamic tooltip names highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_tooltip(pointFormat = "{point.series.name}: ${point.y: .2f}) HIGHCHARTER FOR FINANCE IN R

  39. HIGHCHARTER FOR FINANCE IN R

  40. HIGHCHARTER FOR FINANCE IN R

  41. Adding a legend highchart(type = "stock") %>% hc_add_series(etf_prices_xts$SPY, color = "blue", name = "SPY") %>% hc_add_series(etf_prices_xts$IJS, color = "red", name = "IJS") %>% hc_add_series(etf_prices_xts$EEM, color = "green", name = "EEM") %>% hc_add_series(etf_prices_xts$EFA, color = "purple", name = "EFA") %>% hc_add_series(etf_prices_xts$AGG, color = "orange", name = "XXX") %>% hc_yAxis(title = list(text = "Prices (USD)"), labels = list(format = "${value}"), opposite = FALSE) %>% hc_tooltip(pointFormat = "{point.series.name}: ${point.y: .2f}") %>% hc_legend(enabled = TRUE) HIGHCHARTER FOR FINANCE IN R

  42. HIGHCHARTER FOR FINANCE IN R

  43. Let's go customize some tooltips and add some legends! H IGH CH ARTER F OR F IN AN CE IN R

Recommend


More recommend