Learn R Programming

Authors

Yanrong Song, yrsong129 at gmail.com

Zijie Zhu, zijie.miller.zhu at gmail.com

David Kane, dave.kane at gmail.com

Ziqi Lu, ziqilu at g.harvard.edu

Karan Tibrewal, karan.tibrewal at williams.edu

Fan Zhang, fan.zhang at williams.edu

About

backtestGraphics package creates an interactive graphical interface to visualize backtest results for different financial instruments, including but not limited to equities, futures, and credit default swaps. The package does not run backtests, but instead displays the backtest results graphically. Available summary statistics include average gross market value, cumulative profit and loss, sharpe ratio, top three drawdowns, etc. Available plots include cumulative and point-in -time profit and loss, and gross and net market value, etc. backtestGraphics also support backtest results with different strategies, substrategies, and overlapping portfolios, if the necessary columns are provided.

Installation

You can easily install backtestGraphics by typing:

install.packages("backtestGraphics")

or

library(devtools)
install_github("yanrong-stacy-song/backtestGraphics")

Usage

The package comes with three sample data frames: commodity, equity, and credit. These are backtest results for commodity futures, equities, and credit default swaps (CDS), respectively. We use these data frames to demonstrate the capabilities of the backtestGraphics package. (Note: The user may also use her own data frame, as long as it adheres to the format specified in the documentation).

As an example, let us look at backtestGraphics at work for the commodity data frame. Type the following command, and click the "Visualize" button on the Shiny interface returned by the function call.

library(backtestGraphics)
backtestGraphics(x = commodity)

For more details, please run the following to see the detailed vignette:

vignette("backtestGraphics")

Contributing

We welcome contributions! Please see our contributing guidelines in the Github Wiki for more details on how to report issues, request features, or submit a pull request.

Maintainer

Yanrong Song, yrsong129 at gmail.com

Copy Link

Version

Install

install.packages('backtestGraphics')

Monthly Downloads

261

Version

0.1.8

License

GPL-3

Maintainer

Yanrong Song

Last Published

January 8th, 2025

Functions in backtestGraphics (0.1.8)

stat_calculation

Calculate Statistics
sum_data

Summarize data for the overall portfolio
cumpnl_plot

Draw an interactive line plot for cumulative P&L
drawdown

The Three Biggest Drawdowns in the portfolio
equity

Equity Data from 2005 to 20014.
trade_freq

Find Trading Frequency
interactive_plot

Interactive plot with dygraph
create_instrument_optGroups

Create opt group list for selectizeInput for instruments
calc_pnl

Calculate cumulative pnl, mean pnl, dollar sharpe ratio
best_worst_month

Find the best-performing and the worst-performing months
backtestGraphics

Interactive Backtest Graphics
backtestGraphics-package

A package to visualize backtest results
commodity

Commodity Futures Data from 2003 to 2005.
best_worst_three

Find the three best-performing and worst-performing commodities
create_strategy_optGroups

Create opt group list for selectizeInput for strategies
cleanup_column

Clean up the input data set
next_trading_day

Next trading day
slice_data

Slice Data Set
credit

Credit Default Swap Data from 2007 to 2009.