5
$\begingroup$

I'd like to use the PerformanceAnalytics R package to view various metrics from a list of trades with profit values. From looking at the documentation from the PerformanceAnalytics package that most functions are set up to use a time series of prices rather than an array of profit values (which of course can be negative).

Can PerformanceAnalytics be used on an array of profit values (from a backtest that might have several instruments in it for example)? If not, is there a way to convert the profit values to a format that makes sense to input into most PerformanceAnalytics functions?

$\endgroup$
8
$\begingroup$

If you've got a list of trades, I would first suggest using the blotter package to enter those transactions and compute your cash P&L. Then you can use the tradeStats function to see trade related statistics, or the portfReturns function to extract percent returns for your portfolio of symbols as a contribution to total account equity returns. After calling portfReturns, all the functions in PerformanceAnalytics will have the inputs that they expect.

$\endgroup$
0
$\begingroup$

...is there a way to convert the profit values to a format that makes sense to input into most PerformanceAnalytics functions?

Assume trade outcomes of 10, -5, 15,... for example, and starting equity of 100, then your equity time series will be 100, 110, 105, 120,... from which returns can be calculated.

Taken from the link you gave "In general, this library requires return (rather than price) data."

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.