flake8 fix
This commit is contained in:
parent
f410b1b14d
commit
611e35ed81
@ -219,6 +219,7 @@ def calculate_expectancy(trades: pd.DataFrame) -> float:
|
|||||||
|
|
||||||
return expectancy
|
return expectancy
|
||||||
|
|
||||||
|
|
||||||
def calculate_sortino(trades: pd.DataFrame,
|
def calculate_sortino(trades: pd.DataFrame,
|
||||||
min_date: datetime, max_date: datetime) -> float:
|
min_date: datetime, max_date: datetime) -> float:
|
||||||
"""
|
"""
|
||||||
@ -226,7 +227,7 @@ def calculate_sortino(trades: pd.DataFrame,
|
|||||||
:param trades: DataFrame containing trades (requires columns profit_ratio)
|
:param trades: DataFrame containing trades (requires columns profit_ratio)
|
||||||
:return: sortino
|
:return: sortino
|
||||||
"""
|
"""
|
||||||
if (len(trades) == 0) or (min_date == None) or (max_date == None) or (min_date == max_date):
|
if (len(trades) == 0) or (min_date is None) or (max_date is None) or (min_date == max_date):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
total_profit = trades["profit_ratio"]
|
total_profit = trades["profit_ratio"]
|
||||||
@ -252,6 +253,7 @@ def calculate_sortino(trades: pd.DataFrame,
|
|||||||
# print(expected_returns_mean, down_stdev, sortino_ratio)
|
# print(expected_returns_mean, down_stdev, sortino_ratio)
|
||||||
return sortino_ratio
|
return sortino_ratio
|
||||||
|
|
||||||
|
|
||||||
def calculate_sharpe(trades: pd.DataFrame,
|
def calculate_sharpe(trades: pd.DataFrame,
|
||||||
min_date: datetime, max_date: datetime) -> float:
|
min_date: datetime, max_date: datetime) -> float:
|
||||||
"""
|
"""
|
||||||
@ -259,7 +261,7 @@ def calculate_sharpe(trades: pd.DataFrame,
|
|||||||
:param trades: DataFrame containing trades (requires columns close_date and profit_ratio)
|
:param trades: DataFrame containing trades (requires columns close_date and profit_ratio)
|
||||||
:return: sharpe
|
:return: sharpe
|
||||||
"""
|
"""
|
||||||
if (len(trades) == 0) or (min_date == None) or (max_date == None) or (min_date == max_date):
|
if (len(trades) == 0) or (min_date is None) or (max_date is None) or (min_date == max_date):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
total_profit = trades["profit_ratio"]
|
total_profit = trades["profit_ratio"]
|
||||||
@ -282,6 +284,7 @@ def calculate_sharpe(trades: pd.DataFrame,
|
|||||||
# print(expected_returns_mean, up_stdev, sharp_ratio)
|
# print(expected_returns_mean, up_stdev, sharp_ratio)
|
||||||
return sharp_ratio
|
return sharp_ratio
|
||||||
|
|
||||||
|
|
||||||
def calculate_calmar(trades: pd.DataFrame,
|
def calculate_calmar(trades: pd.DataFrame,
|
||||||
min_date: datetime, max_date: datetime) -> float:
|
min_date: datetime, max_date: datetime) -> float:
|
||||||
"""
|
"""
|
||||||
@ -289,7 +292,7 @@ def calculate_calmar(trades: pd.DataFrame,
|
|||||||
:param trades: DataFrame containing trades (requires columns close_date and profit_ratio)
|
:param trades: DataFrame containing trades (requires columns close_date and profit_ratio)
|
||||||
:return: calmar
|
:return: calmar
|
||||||
"""
|
"""
|
||||||
if (len(trades) == 0) or (min_date == None) or (max_date == None) or (min_date == max_date):
|
if (len(trades) == 0) or (min_date is None) or (max_date is None) or (min_date == max_date):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
total_profit = trades["profit_ratio"]
|
total_profit = trades["profit_ratio"]
|
||||||
|
Loading…
Reference in New Issue
Block a user