mirror of
https://github.com/robertmartin8/PyPortfolioOpt.git
synced 2022-11-27 18:02:41 +03:00
binder support
This commit is contained in:
committed by
robertmartin8
parent
4ae6aa0cc5
commit
34c8efb8e6
@@ -5,9 +5,11 @@
|
||||
|
||||
!pypfopt
|
||||
!tests
|
||||
#!setup.py
|
||||
#!README.md
|
||||
!setup.py
|
||||
!README.md
|
||||
!requirements.txt
|
||||
!binder
|
||||
!cookbook
|
||||
|
||||
**/__pycache__
|
||||
**/*.pyc
|
||||
|
||||
8
Makefile
8
Makefile
@@ -4,6 +4,10 @@ PROJECT_VERSION := $(shell python setup.py --version)
|
||||
SHELL := /bin/bash
|
||||
PACKAGE := pypfopt
|
||||
|
||||
# needed to get the ${PORT} environment variable
|
||||
include .env
|
||||
export
|
||||
|
||||
.PHONY: help build test tag pypi
|
||||
|
||||
|
||||
@@ -19,7 +23,9 @@ help:
|
||||
@echo "make tag"
|
||||
@echo " Make a tag on Github."
|
||||
|
||||
|
||||
jupyter:
|
||||
echo "http://localhost:${PORT}/lab"
|
||||
docker-compose up jupyter
|
||||
|
||||
build:
|
||||
docker-compose build pypfopt
|
||||
|
||||
21
binder/Dockerfile
Normal file
21
binder/Dockerfile
Normal file
@@ -0,0 +1,21 @@
|
||||
FROM jupyter/base-notebook:lab-1.2.5 as jupyter
|
||||
|
||||
# File Author / Maintainer
|
||||
# MAINTAINER Thomas Schmelzer "thomas.schmelzer@gmail.com"
|
||||
|
||||
# copy the config file
|
||||
COPY ./binder/jupyter_notebook_config.py /etc/jupyter/jupyter_notebook_config.py
|
||||
|
||||
# copy the package over and install it
|
||||
COPY --chown=jovyan:users . /tmp/pyportfolioopt
|
||||
|
||||
RUN conda install -y -c conda-forge --file /tmp/pyportfolioopt/requirements.txt && \
|
||||
conda clean -y --all && \
|
||||
pip install --no-cache-dir /tmp/pyportfolioopt && \
|
||||
rm -rf /tmp/pyportfolioopt && \
|
||||
jupyter labextension install @jupyter-widgets/jupyterlab-manager && \
|
||||
jupyter labextension install beakerx-jupyterlab && \
|
||||
jupyter lab build
|
||||
|
||||
# hardcoded parameters!? see https://github.com/moby/moby/issues/35018
|
||||
COPY --chown=jovyan:users ./cookbook $HOME/work
|
||||
7
binder/jupyter_notebook_config.py
Normal file
7
binder/jupyter_notebook_config.py
Normal file
@@ -0,0 +1,7 @@
|
||||
c = get_config()
|
||||
c.NotebookApp.ip = '0.0.0.0'
|
||||
c.NotebookApp.port = 8888
|
||||
c.NotebookApp.open_browser = False
|
||||
c.NotebookApp.token = ''
|
||||
c.NotebookApp.password = ''
|
||||
c.NotebookApp.notebook_dir = "/home/jovyan/work"
|
||||
@@ -68,7 +68,7 @@
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"df = pd.read_csv(\"stock_prices.csv\", parse_dates=True, index_col=\"date\")\n",
|
||||
"df = pd.read_csv(\"data/stock_prices.csv\", parse_dates=True, index_col=\"date\")\n",
|
||||
"past_df, future_df = df.iloc[:-250], df.iloc[-250:]\n",
|
||||
"future_cov = risk_models.sample_cov(future_df)\n",
|
||||
"\n",
|
||||
@@ -278,9 +278,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.5"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
@@ -1557,7 +1557,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.5"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
@@ -1160,9 +1160,9 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.5"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 2
|
||||
}
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
@@ -955,7 +955,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.7.5"
|
||||
"version": "3.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
6766
cookbook/data/spy_prices.csv
Normal file
6766
cookbook/data/spy_prices.csv
Normal file
File diff suppressed because it is too large
Load Diff
7127
cookbook/data/stock_prices.csv
Normal file
7127
cookbook/data/stock_prices.csv
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,3 +5,12 @@ services:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: builder
|
||||
|
||||
jupyter:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: ./binder/Dockerfile
|
||||
volumes:
|
||||
- ./cookbook:${WORK}
|
||||
ports:
|
||||
- ${PORT}:8888
|
||||
Reference in New Issue
Block a user