Skip to content

Commit

Permalink
add clear cache
Browse files Browse the repository at this point in the history
  • Loading branch information
quantfreedom committed May 5, 2024
1 parent 2edb889 commit c1cdbdb
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 4 deletions.
29 changes: 27 additions & 2 deletions clear_cache.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,28 @@
from quantfreedom.helpers.utils import clear_cache
from pathlib import Path
from IPython.paths import get_ipython_cache_dir

clear_cache()

def delete_dir(p: Path):
for sub in p.iterdir():
if sub.is_dir():
delete_dir(sub)
else:
sub.unlink()
p.rmdir()


def clear_cache():
for p in Path(get_ipython_cache_dir() + "\\numba_cache").rglob("*.nb*"):
p.unlink()
for p in Path(__file__).parent.parent.rglob("numba_cache"):
delete_dir(p)
for p in Path(__file__).parent.parent.rglob("__pycache__"):
delete_dir(p)
for p in Path(__file__).parent.parent.rglob("cdk.out"):
delete_dir(p)
for p in Path(__file__).parent.parent.rglob("*.py[co]"):
p.unlink()


if __name__ == "__main__":
clear_cache()
2 changes: 1 addition & 1 deletion tests/backtest/vol_backtest/long_backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
remove("backtest_results.h5")

print("Downloading candles")
with open('thing.pkl', 'rb') as f:
with open('Volume_Candles_Tuple_mar_apr.pkl', 'rb') as f:
candles = pickle.load(f)
backtest_results = run_df_backtest(
backtest_settings_tuple=backtest_settings_tuple,
Expand Down
2 changes: 1 addition & 1 deletion tests/backtest/vol_backtest/testing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"import pickle\n",
"\n",
"\n",
"with open(\"thing.pkl\", \"rb\") as f:\n",
"with open(\"Volume_Candles_Tuple_mar_apr.pkl\", \"rb\") as f:\n",
" candles = pickle.load(f)\n",
"\n",
"\n",
Expand Down

0 comments on commit c1cdbdb

Please sign in to comment.