Skip to main content

sortino_ratio

Get rolling Sortino Ratio.

The Sortino Ratio enhances the evaluation of investment returns by distinguishing harmful volatility from total volatility. Unlike other metrics that treat all volatility as risk, this command specifically assesses the volatility of negative returns relative to a target or desired return. It's particularly useful for investors who are more concerned with downside risk than with overall volatility. By calculating the Sortino Ratio, investors can better understand the risk-adjusted return of their investments, focusing on the likelihood and impact of negative returns. This approach offers a more nuanced tool for portfolio optimization, especially in strategies aiming to minimize the downside.

For method & terminology see: http://www.redrockcapital.com/Sortino__A__Sharper__Ratio_Red_Rock_Capital.pdf

Examples

from openbb import obb
# Get Rolling Sortino Ratio.
stock_data = obb.equity.price.historical(symbol="TSLA", start_date="2023-01-01", provider="fmp").to_df()
returns = stock_data["close"].pct_change().dropna()
obb.quantitative.performance.sortino_ratio(data=stock_data, target="close")
obb.quantitative.performance.sortino_ratio(data=stock_data, target="close", target_return=0.01, window=126, adjusted=True)
obb.quantitative.performance.sortino_ratio(target='close', window=2, data='[{'date': '2023-01-02', 'close': 0.05}, {'date': '2023-01-03', 'close': 0.08}, {'date': '2023-01-04', 'close': 0.07}, {'date': '2023-01-05', 'close': 0.06}, {'date': '2023-01-06', 'close': 0.06}]')

Parameters

data: list[openbb_core.provider.abstract.data.Data]
Time series data.

target: str
Target column name.

target_return: float
Target return, by default 0.0

window: int
Default: 252
Window size, by default 252

adjusted: bool
Adjust sortino ratio to compare it to sharpe ratio, by default False

index: str
Default: date
Index column for input data


Returns

results: list[Data]

Serializable results.

provider: None

Provider name.

warnings: Optional[list[Warning_]]

list of warnings.

chart: Optional[Chart]

Chart object.

extra: dict[str, Any]

Extra info.