feat(Evaluate): increase transactions costs, to get a more realistic view on performance (#137)

This commit is contained in:
Mark Aron Szulyovszky
2022-01-09 14:18:20 +01:00
committed by GitHub
parent fc5eba4e2d
commit 22b3167cb9
2 changed files with 13 additions and 2 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ from utils.helpers import get_first_valid_return_index
import pandas as pd
import numpy as np
def backtest(returns: pd.Series, signal: pd.Series, transaction_cost = 0.002) -> pd.Series:
def backtest(returns: pd.Series, signal: pd.Series, transaction_cost = 0.008) -> pd.Series:
delta_pos = signal.diff(1).abs().fillna(0.)
costs = transaction_cost * delta_pos
return (signal * returns) - costs