Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Versioning updates #325

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
.lsp_symlink
.ipynb_checkpoints
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ The code examples rely on a wide range of Python libraries from the data science

It is not necessary to try and install all libraries at once because this increases the likeliihood of encountering version conflicts. Instead, we recommend that you install the libraries required for a specific chapter as you go along.

> As of August 2024, the `ml4t` channel is no longer available in conda. To begin, please use the provided dockerfile instead. The pyproject.toml file has been verified to work with poetry on conda python version 3.10 and 3.11 locally without docker.

#### Build docker image on apple silicon
```
docker build -t ml4t-project -f docker/Dockerfile.applesilicon .
```

#### Build docker image on x86_64
```
docker build -t ml4t-project -f docker/Dockerfile.x86 .
```
#### Run docker image
```
docker run -p 8888:8888 -e QUANDL_API_KEY=yourkey -v $(pwd):/app ml4t-project
```

#### Run docker image (on Windows)
```
docker run -p 8888:8888 -e QUANDL_API_KEY=yourkey -v ${PWD}:/app ml4t-project
```

> Update March 2022: `zipline-reloaded`, `pyfolio-reloaded`, `alphalens-reloaded`, and `empyrical-reloaded` are now available on the `conda-forge` channel. The channel `ml4t` only contains outdated versions and will soon be removed.

> Update April 2021: with the update of [Zipline](https://zipline.ml4trading.io), it is no longer necessary to use Docker. The installation instructions now refer to OS-specific environment files that should simplify your running of the notebooks.
Expand Down
47 changes: 47 additions & 0 deletions docker/Dockerfile.applesilicon
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM python:3.10-bullseye

WORKDIR /app

RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
libatlas-base-dev \
gfortran \
pkg-config \
libfreetype6-dev \
hdf5-tools \
libhdf5-dev \
libhdf5-serial-dev \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
tar -xvzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && \
./configure --prefix=/usr --build=aarch64-unknown-linux-gnu && \
make && \
make install && \
cd .. && \
rm -rf ta-lib-0.4.0-src.tar.gz ta-lib/

ENV LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
ENV TA_LIBRARY_PATH=/usr/lib
ENV TA_INCLUDE_PATH=/usr/include

RUN curl -sSL https://install.python-poetry.org | python3 -

ENV PATH="${PATH}:/root/.local/bin"

COPY pyproject.toml poetry.lock* ./

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --only main

RUN pip install h5py || true

EXPOSE 8888

# Run JupyterLab when the container launches
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
47 changes: 47 additions & 0 deletions docker/Dockerfile.x86
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM python:3.10-bullseye

WORKDIR /app

RUN apt-get update && apt-get install -y \
build-essential \
curl \
software-properties-common \
git \
libatlas-base-dev \
gfortran \
pkg-config \
libfreetype6-dev \
hdf5-tools \
libhdf5-dev \
libhdf5-serial-dev \
wget \
&& rm -rf /var/lib/apt/lists/*

RUN wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz && \
tar -xvzf ta-lib-0.4.0-src.tar.gz && \
cd ta-lib/ && \
./configure --prefix=/usr && \
make && \
make install && \
cd .. && \
rm -rf ta-lib-0.4.0-src.tar.gz ta-lib/

ENV LD_LIBRARY_PATH=/usr/lib:$LD_LIBRARY_PATH
ENV TA_LIBRARY_PATH=/usr/lib
ENV TA_INCLUDE_PATH=/usr/include

RUN curl -sSL https://install.python-poetry.org | python3 -

ENV PATH="${PATH}:/root/.local/bin"

COPY pyproject.toml poetry.lock* ./

RUN poetry config virtualenvs.create false \
&& poetry install --no-interaction --no-ansi --no-root --only main

RUN pip install h5py || true

EXPOSE 8888

# Run JupyterLab when the container launches
CMD ["jupyter", "lab", "--ip=0.0.0.0", "--port=8888", "--no-browser", "--allow-root"]
Loading