plot.xts for Performance and Risk - rstats-gsoc/gsoc2016 GitHub Wiki

Improve financial data visualization in finance packages with plot.xts

Summary

Improve the visualization of performance, risk, and other financial data in quantmod, PerformanceAnalytics, quantstrat, blotter, and PortfolioAnalytics R packages.

Description

Improved time series charting has been a subject of GSOC projects in prior years. Participating students have developed a flexible charting "engine" for xts::plot.xts and associated functions in the xts package, originally based on the quantmod::chart_Series functions. While chart_Series was developed specifically for financial OHLC time series, plot.xts builds on the chart_Series framework to generalize charting xts objects. This generalized framework allows for replacing code in charting functions in the quantmod and PerformanceAnalytics R packages, allowing for greater flexibility and easier maintainability.

This project would aspire to replace the various time series charts in PerformanceAnalytics, PortfolioAnalytics, and quantmod with xts::plot.xts, while preserving and extending the interfaces for those functions.

Charting functions in PerformanceAnalytics and PortfolioAnalytics are written to provide specific visualizations on data derived from calculations in each package. Those functions are currently built in base graphics to better handle large sets of data.

Charting functionality in blotter and quantstrat visualizes the performance of real or hypothetical trading strategies, and is based on the chart_Series() function in quantmod. quantmod's chartSeries and chart_Series and related addTA and add_Ta functions should be rewritten to use plot.xts, including extensions for special charts such as candlesticks.

In addition, those functions would be extended to use invisible so that a well-documented data object containing well-formatted calculated results could be passed to other graphics packages or frameworks (e.g., dygraphs, ggviz, etc.), including interactive frameworks.

While time series plotting is the highest priority, there are also opportunities to improve other graphing primitives in those packages, such as the scatterplots. Features like data label collision, automatic legend generation, etc., may be added to improve convenience in data exploration.

General

The student in this project will develop a list of specific functions identified from this outline in the packages discussed above that will be modified/re-written to integrate new functionality. New code will be consistent and backwards compatible with interfaces of other functions in its respective package.

In addition, the student will review and extend as necessary the complete documentation for each function.

Students should strongly consider creating a vignette that goes beyond the functional documentation to show how the functions might be used, perhaps with some extended examples. Building interactive examples using Shiny would also be very interesting.

References

Skills required

Applicants should have:

  • Prior experience using or developing in R, and comfort with tools such as svn, git, Roxygen2, LaTeX (for equations in particular), and familiarity with base graphics.
  • Those with demonstrable experience with finance-related or graphics related R packages will be preferred.
  • A background in computer science or engineering with graduate training in finance would likely be ideal.

Test

  • Discuss the list of proposed functionality for inclusion in quantmod, PerformanceAnalytics, and PortfolioAnalytics.
  • Develop a specific plan with a timeline for development, documentation (consider adding a vignette as well), and testing the functionality.
  • Provide a complete code example of a function with documentation that could be used in the PerformanceAnalytics or similar package (exceptional examples will be considered for inclusion in the package and their author given full credit for the contribution). The example does not need to pertain to the subject of this project, but should demonstrate your coding ability and familiarity with the tools used in development.
  • Clearly identify any other commitments or possible conflicts for your time during the coming summer.

Mentors

Brian Peterson ([[email protected]](mailto:brian {at} braverock {dot} com)) is one of the primary authors of these packages, and has previously mentored GSoC projects.

Peter Carl ([[email protected]](mailto:peter {at} braverock {dot} com)) is one of the primary authors of these packages, and has previously mentored GSoC projects.

Ross Bennett ([[email protected]](mailto:rossbennett34 {at} gmail {dot} com)) is a contributor to these packages, and has previously participated in GSoC as a student.