Skip to content

Commit f6f082f

Browse files
author
Samrat Chowdhury
committed
fix: replace ambiguous unicode sigma and shorten long docstring line
1 parent 6f3f428 commit f6f082f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

financial/sharpe_ratio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ def sharpe_ratio(returns: list[float], risk_free_rate: float = 0.0) -> float:
2323
Calculate the Sharpe Ratio for a series of returns.
2424
2525
The Sharpe Ratio formula:
26-
S = (R - Rf) / σ
26+
S = (R - Rf) / std_dev
2727
2828
Where:
2929
S = Sharpe Ratio
3030
R = Average return of the investment
3131
Rf = Risk-free rate of return
32-
σ = Standard deviation of returns (volatility)
32+
std_dev = Standard deviation of returns (volatility)
3333
3434
:param returns: List of periodic returns (e.g., daily, monthly)
3535
:param risk_free_rate: Risk-free rate of return per period, default 0.0
@@ -96,7 +96,8 @@ def annualized_sharpe_ratio(
9696
:param periods_per_year: Number of periods in a year, default 252 (daily)
9797
:return: Annualized Sharpe Ratio
9898
99-
>>> round(annualized_sharpe_ratio([0.001, 0.002, 0.0015, 0.0005, 0.0012], 0.0, 252), 4)
99+
>>> round(annualized_sharpe_ratio(
100+
... [0.001, 0.002, 0.0015, 0.0005, 0.0012], 0.0, 252), 4)
100101
35.1844
101102
>>> round(annualized_sharpe_ratio([0.01, 0.02, 0.015, 0.005, 0.012], 0.0, 12), 4)
102103
7.6779

0 commit comments

Comments
 (0)