relative_rotation
Calculate the Relative Strength Ratio and Relative Strength Momentum for a group of symbols against a benchmark.
Examples
from openbb import obb
# Calculate the Relative Strength Ratio and Relative Strength Momentum for a group of symbols against a benchmark.
stock_data = obb.equity.price.historical(symbol='AAPL,MSFT,GOOGL,META,AMZN,TSLA,SPY', start_date='2022-01-01', provider='yfinance')
rr_data = obb.technical.relative_rotation(data=stock_data.results, benchmark='SPY')
rs_ratios = rr_data.results.rs_ratios
rs_momentum = rr_data.results.rs_momentum
# When the assets are not traded 252 days per year,adjust the momentum and volatility periods accordingly.
crypto_data = obb.crypto.price.historical( symbol='BTCUSD,ETHUSD,SOLUSD', start_date='2021-01-01', provider='yfinance')
rr_data = obb.technical.relative_rotation(data=crypto_data.results, benchmark='BTC-USD', long_period=365, short_period=30, window=30, trading_periods=365)
Parameters
- standard
data
: list[openbb_core.provider.abstract.data.Data]
The data to be used for the relative rotation calculations.