Skip to content

Commit

Permalink
Larger problems
Browse files Browse the repository at this point in the history
  • Loading branch information
phschiele committed Dec 20, 2023
1 parent c5a986c commit 8899f5f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion experiments/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def daily_turnover(self) -> pd.Series:
prices = load_data()[0].loc[self.history]
valuation_trades = trades * prices
relative_trades = valuation_trades.div(self.portfolio_value, axis=0)
return relative_trades.abs().sum(axis=1)
return relative_trades.abs().sum(axis=1) / 2

@property
def turnover(self) -> float:
Expand Down
8 changes: 5 additions & 3 deletions experiments/scaling_large.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


def main():
fitting = False
fitting = True
scenarios = get_scenarios(fitting=fitting)
res = []
for n_assets, n_factors in scenarios:
Expand Down Expand Up @@ -151,11 +151,13 @@ def get_scenarios(fitting=False):
(2000, 100),
(10000, 50),
(10000, 100),
(50_000, 200),
(50_000, 500),
]
else:
# fine grid for fitting
assets = np.logspace(3, 3.5, 10, dtype=int)
factors = np.logspace(3, 3.5, 10, dtype=int)
assets = np.logspace(3, 4.7, 10, dtype=int)
factors = np.logspace(3, 4, 10, dtype=int)
pairs = [(a, f) for a in assets for f in factors if a >= f]
return pairs

Expand Down

0 comments on commit 8899f5f

Please sign in to comment.