Awesome Open Source
Awesome Open Source

Portfolio Management with R

About PMwR

Functions for the practical management of financial portfolios: backtesting investment and trading strategies, computing profit-and-loss and returns, analysing trades, reporting, and more. The aim of PMwR is to provide a small set of reliable, efficient and convenient tools that help in processing and analysing trade/portfolio data. The package does not provide a complete application that could be used ‘as is’, but building blocks for creating such an application.

PMwR grew out of various pieces of software that I have written since 2008. The package is under active development and changes frequently, simply because the code has been written over many years and is in need of being groomed for general use. Specifically, the interfaces to functions are not stable (e.g., argument names are currently being made consistent across functions); in some cases, generic functions will be introduced. The recommended practice is therefore to explicitly name arguments in function calls (and not pass arguments by position). Any changes in argument names will be documented in the NEWS file ( and so can be followed easily. More details are in the ChangeLog (

What PMwR provides

The package provides functions that can serve as building blocks for many activities in portfolio management.

Keeping track of transactions
The package provides functions for handling journals (sometimes called blotters). See ?journal and ?position.
Testing strategies
See ?btest (and this tutorial on backtesting).
Computing profit/loss and returns
See ?returns, ?rc ?pl or ?unit_prices.

All details are in the manual:

New features are often described in these notes.

I am grateful for comments, suggestions and corrections.


The latest release of the package is available from You can install the package directly from within R:

                 repos = c('',

The package depends on several other packages, which can be obtained from the same repository and from CRAN.

There is currently no automatic build for Windows. If you wish to use the package on Windows and have problems building it, then please contact me and I will provide you with a Windows version.

There are also publicly-available repositories at and

Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
R (70,840
Accounting (357
Financial Data (231
Backtesting (148
Related Projects