Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

...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."

share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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