calculate_returns#

API documentation for tradeexecutor.analysis.returns.calculate_returns Python function.

calculate_returns(strategy_universe, column='close')[source]#

Calculate returns to every asset in the trading universe.

Example:

Returns:

DataFrame of price candle returns, with MultiIndex (pair_id, timestamp).

For the first time frame, NaN is set as returns.

DataFrame will also contain the original OHLCV candle data with columns “open”, “close”, etc.

Parameters:

strategy_universe (TradingStrategyUniverse) –

Return type:

Series