# Use Trades as Input for PerformanceAnalytics

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?

-

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

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