Skip to content

Commit

Permalink
Merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
phschiele committed Dec 10, 2023
2 parents 96db757 + 395ffae commit f19a180
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 59 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "pip" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
6 changes: 3 additions & 3 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
with:
extra_args: '--verbose --all-files'

test:
experiment:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: testing
- name: experiments
shell: bash
run: |
make test
make experiment
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
checkpoints

.idea
.vscode
.python-version
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ fmt: install ## Run autoformatting and linting
${VENV}/bin/pre-commit install
${VENV}/bin/pre-commit run --all-files

.PHONY: test
test: install ## Run tests
${VENV}/bin/pip install pytest
${VENV}/bin/pytest tests

.PHONY: clean
clean: ## Clean up caches and build artifacts
@git clean -X -d -f
Expand Down
13 changes: 3 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,13 @@ It contains a reference implementation of the Markowitz portfolio optimization
problem and the data used in the paper. Please note that the tickers of the
stocks have been obfuscated to comply with the data provider's terms of use.

## Installation

Please start any experiment with

```bash
make install
```

to replicate the virtual environment we have defined in 'requirements.txt'.

## Experiments

Please run all experiments using

```bash
make experiments
```

Before the experiments start the virtual environment defined in 'requirements.txt'
is replicated locally.
Empty file removed data/.gitkeep
Empty file.
3 changes: 3 additions & 0 deletions experiments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from pathlib import Path

from experiments.taming import main as taming_main

if __name__ == "__main__":
Path("checkpoints").mkdir(exist_ok=True)
taming_main()
6 changes: 1 addition & 5 deletions experiments/backtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
from functools import lru_cache
from pathlib import Path
import pickle
import sys
import time
from typing import Callable
import numpy as np
import cvxpy as cp
import pandas as pd
from utils import synthetic_returns

# hack to allow importing from parent directory without having a package
sys.path.append(str(Path(__file__).parent.parent))
from experiments.utils import synthetic_returns


def data_folder():
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions experiments/taming.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import numpy as np
import pandas as pd
import cvxpy as cp
from backtest import BacktestResult, OptimizationInput, run_backtest
from utils import get_solver
from markowitz import Data, Parameters, markowitz

from experiments.backtest import BacktestResult, OptimizationInput, run_backtest
from experiments.markowitz import Data, Parameters, markowitz
from experiments.utils import get_solver


def basic_markowitz(inputs: OptimizationInput) -> tuple[np.ndarray, float, cp.Problem]:
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cvxpy
numpy
pandas
matplotlib
cvxpy==1.4.1
numpy==1.26.2
pandas[output-formatting]==2.1.4
matplotlib==3.8.2
Empty file removed tests/__init__.py
Empty file.
17 changes: 0 additions & 17 deletions tests/conftest.py

This file was deleted.

Empty file removed tests/resources/.gitkeep
Empty file.
12 changes: 0 additions & 12 deletions tests/test_markowitz.py

This file was deleted.

0 comments on commit f19a180

Please sign in to comment.