Skip to content

Commit

Permalink
Bump and fix ewma vol
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-leme committed May 12, 2021
1 parent 9627b9f commit 0b865a7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
master_doc = 'index'

# The full version, including alpha/beta/rc tags
release = '0.2.0'
release = '0.2.1'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="turingquant",
version="0.2.0",
version="0.2.1",
packages=find_packages(),
install_requires=["pandas", "pandas_datareader", "numpy", "matplotlib", "alpha_vantage", "bs4", "plotly", "yfinance"],

Expand Down
6 changes: 2 additions & 4 deletions turingquant/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,22 +206,20 @@ def rolling_sharpe(returns, window, risk_free=0, plot=False):
return rolling_sharpe


def ewma_volatility(close_prices, return_type, window, plot=False):
def ewma_volatility(returns, window, plot=False):
"""
Essa função possibilita a visualização da volatilidade a partir do cálculo da EWMA e da plotagem do gráfico
dessa métrica ao longo de um período.
Args:
close_prices (pd.DataFrame): série de preços de fechamento que será utilizado de base para o cálculo da EWMA;
return_type (string): tipo de retorno (simple - 'simp' ou logarítmico - 'log') que será utilizado de base para cálculo;
returns (pd.DataFrame): série de retornos para o qual o EWMA será calculado.
window (int): janela móvel para cálculo da EWMA;
plot (bool): se True, plota o gráfico de linha da EWMA ao longo do tempo
Returns:
ewma_volatility (pd.DataFrame): um dataframe indexado à data com os valores de EWMA dos últimos window dias
"""

returns = returns(close_prices, return_type)

ewma_volatility = returns.ewm(span=window).std()
ewma_volatility = pd.Series.to_frame(ewma_volatility)
Expand Down

0 comments on commit 0b865a7

Please sign in to comment.