forked from yhilpisch/py4at
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yves
committed
Nov 8, 2020
0 parents
commit 51eeb1d
Showing
39 changed files
with
2,332 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
# Specifics | ||
dx/ | ||
*.swp | ||
_build/ | ||
*.cfg | ||
.DS_Store | ||
source/ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
All the contents as well as the codes, Jupyter Notebooks and other materials in this Github repository and on the Quant Platform (http://py4at.pqp.io) related to Python for Algorithmic Trading (book, course, class, program) by Dr. Yves J. Hilpisch (The Python Quants GmbH) are copyrighted and only intended for personal use. | ||
|
||
Any kind of sharing, distribution, duplication, etc. without written permission by the The Python Quants GmbH is prohibited. | ||
|
||
The contents, Python codes, Jupyter Notebooks and other materials come without warranties or representations, to the extent permitted by applicable law. | ||
|
||
Notice that the code provided might be work in progress and that substantial additions, changes, updates, etc. can take place in the future. It is advised to regularly check for updates. | ||
|
||
None of the material represents any kind of recommendation or investment advice. The material is only meant as a technical illustration. Leveraged and unleveraged trading of financial instruments, and contracts for difference (CFDs) in particular, involves a number of risks. Make sure to understand and manage these risks. | ||
|
||
(c) Dr. Yves J. Hilpisch | The Python Quants GmbH | November 2020 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Python for Algorithmic Trading | ||
|
||
## About this Repository | ||
|
||
This repository provides Python code and Jupyter Notebooks accompanying the **Python for Algorithmic Trading** book published by [O'Reilly](https://www.oreilly.com/library/view/python-for-algorithmic/9781492053347/). | ||
|
||
<img src="http://hilpisch.com/pyalgo_cover_color.png" width="500"> | ||
|
||
You can **register for free** on our [Quant Platform](http://py4at.pqp.io) to make easy use of the Python codes in the cloud. | ||
|
||
## Copyright & Disclaimer | ||
|
||
© Dr. Yves J. Hilpisch | The Python Quants GmbH | November 2020 | ||
|
||
All code and Jupyter Notebooks come without representations or warranties, to the extent permitted by applicable law. They are intended for personal use only and do not represent any investment advice or recommendation of any form. | ||
|
||
<img src="http://hilpisch.com/tpq_logo.png" width="250"> | ||
|
||
http://tpq.io | [email protected] | http://twitter.com/dyjh | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# | ||
# Building a Docker Image with | ||
# the Latest Ubuntu Version and | ||
# Basic Python Install | ||
# | ||
# Python for Algorithmic Trading | ||
# (c) Dr. Yves J. Hilpisch | ||
# The Python Quants GmbH | ||
# | ||
|
||
# latest Ubuntu version | ||
FROM ubuntu:latest | ||
|
||
# information about maintainer | ||
MAINTAINER yves | ||
|
||
# add the bash script | ||
ADD install.sh / | ||
# change rights for the script | ||
RUN chmod u+x /install.sh | ||
# run the bash script | ||
RUN /install.sh | ||
# prepend the new path | ||
ENV PATH /root/miniconda3/bin:$PATH | ||
|
||
# execute IPython when container is run | ||
CMD ["ipython"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
# | ||
# Script to Install | ||
# Linux System Tools and | ||
# Basic Python Components | ||
# | ||
# Python for Algorithmic Trading | ||
# (c) Dr. Yves J. Hilpisch | ||
# The Python Quants GmbH | ||
# | ||
# GENERAL LINUX | ||
apt-get update # updates the package index cache | ||
apt-get upgrade -y # updates packages | ||
# installs system tools | ||
apt-get install -y bzip2 gcc git # system tools | ||
apt-get install -y htop screen vim wget # system tools | ||
apt-get upgrade -y bash # upgrades bash if necessary | ||
apt-get clean # cleans up the package index cache | ||
|
||
# INSTALL MINICONDA | ||
# downloads Miniconda | ||
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O Miniconda.sh | ||
bash Miniconda.sh -b # installs it | ||
rm -rf Miniconda.sh # removes the installer | ||
export PATH="/root/miniconda3/bin:$PATH" # prepends the new path | ||
|
||
# INSTALL PYTHON LIBRARIES | ||
conda install -y pandas # installs pandas | ||
conda install -y ipython # installs IPython shell | ||
|
||
# CUSTOMIZATION | ||
cd /root/ | ||
wget http://hilpisch.com/.vimrc # Vim configuration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#!/bin/bash | ||
# | ||
# Script to Install | ||
# Linux System Tools and Basic Python Components | ||
# as well as to | ||
# Start Jupyter Lab Server | ||
# | ||
# Python for Algorithmic Trading | ||
# (c) Dr. Yves J. Hilpisch | ||
# The Python Quants GmbH | ||
# | ||
# GENERAL LINUX | ||
apt-get update # updates the package index cache | ||
apt-get upgrade -y # updates packages | ||
# install system tools | ||
apt-get install -y gcc git htop # system tools | ||
apt-get install -y screen htop vim wget # system tools | ||
apt-get upgrade -y bash # upgrades bash if necessary | ||
apt-get clean # cleans up the package index cache | ||
|
||
# INSTALLING MINICONDA | ||
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh \ | ||
-O Miniconda.sh | ||
bash Miniconda.sh -b # installs Miniconda | ||
rm -rf Miniconda.sh # removes the installer | ||
# prepends the new path for current session | ||
export PATH="/root/miniconda3/bin:$PATH" | ||
# prepends the new path in the shell configuration | ||
cat >> ~/.profile <<EOF | ||
export PATH="/root/miniconda3/bin:$PATH" | ||
EOF | ||
|
||
# INSTALLING PYTHON LIBRARIES | ||
conda install -y jupyter # interactive data analytics in the browser | ||
conda install -y jupyterlab # Jupyter Lab environment | ||
conda install -y numpy # numerical computing package | ||
conda install -y pytables # wrapper for HDF5 binary storage | ||
conda install -y pandas # data analysis package | ||
conda install -y matplotlib # standard plotting library | ||
conda install -y seaborn # statistical plotting library | ||
conda install -y quandl # wrapper for Quandl data API | ||
conda install -y scikit-learn # machine learning library | ||
conda install -y openpyxl # package for Excel interaction | ||
conda install -y xlrd xlwt # packages for Excel interaction | ||
conda install -y pyyaml # package to manage yaml files | ||
|
||
pip install --upgrade pip # upgrading the package manager | ||
pip install q # logging and debugging | ||
pip install plotly # interactive D3.js plots | ||
pip install cufflinks # combining plotly with pandas | ||
pip install tensorflow # deep learning library | ||
pip install keras # deep learning library | ||
pip install eikon # Python wrapper for the Refinitiv Eikon Data API | ||
# Python wrapper for Oanda API | ||
pip install git+git://github.com/yhilpisch/tpqoa | ||
|
||
# COPYING FILES AND CREATING DIRECTORIES | ||
mkdir /root/.jupyter | ||
mkdir /root/.jupyter/custom | ||
wget http://hilpisch.com/custom.css | ||
mv custom.css /root/.jupyter/custom | ||
mv /root/jupyter_notebook_config.py /root/.jupyter/ | ||
mv /root/mycert.pem /root/.jupyter | ||
mv /root/mykey.key /root/.jupyter | ||
mkdir /root/notebook | ||
cd /root/notebook | ||
|
||
# STARTING JUPYTER LAB | ||
jupyter lab & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# Jupyter Notebook Configuration File | ||
# | ||
# Python for Algorithmic Trading | ||
# (c) Dr. Yves J. Hilpisch | ||
# The Python Quants GmbH | ||
# | ||
# SSL ENCRYPTION | ||
# replace the following file names (and files used) by your choice/files | ||
c.NotebookApp.certfile = u'/root/.jupyter/mycert.pem' | ||
c.NotebookApp.keyfile = u'/root/.jupyter/mykey.key' | ||
|
||
# IP ADDRESS AND PORT | ||
# set ip to '*' to bind on all IP addresses of the cloud instance | ||
c.NotebookApp.ip = '0.0.0.0' | ||
# it is a good idea to set a known, fixed default port for server access | ||
c.NotebookApp.port = 8888 | ||
|
||
# PASSWORD PROTECTION | ||
# here: 'jupyter' as password | ||
# replace the hash code with the one for your password | ||
c.NotebookApp.password = \ | ||
'sha1:da3a3dfc0445:052235bb76e56450b38d27e41a85a136c3bf9cd7' | ||
|
||
# NO BROWSER OPTION | ||
# prevent Jupyter from trying to open a browser | ||
c.NotebookApp.open_browser = False | ||
|
||
# ROOT ACCESS | ||
# allow Jupyter to run from root user | ||
c.NotebookApp.allow_root = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-----BEGIN CERTIFICATE----- | ||
MIIEGTCCAwGgAwIBAgIUTdmnTAvz2b8AtxseduLQ9WSRuXcwDQYJKoZIhvcNAQEL | ||
BQAwgZsxCzAJBgNVBAYTAkRFMREwDwYDVQQIDAhTYWFybGFuZDEUMBIGA1UEBwwL | ||
Vm9lbGtsaW5nZW4xETAPBgNVBAoMCFRQUSBHbWJIMRwwGgYDVQQLDBNBbGdvcml0 | ||
aG1pYyBUcmFkaW5nMRQwEgYDVQQDDAtKdXB5dGVyIExhYjEcMBoGCSqGSIb3DQEJ | ||
ARYNcHlhbGdvQHRwcS5pbzAeFw0yMDA1MDUwOTUyNDhaFw0yMTA1MDUwOTUyNDha | ||
MIGbMQswCQYDVQQGEwJERTERMA8GA1UECAwIU2FhcmxhbmQxFDASBgNVBAcMC1Zv | ||
ZWxrbGluZ2VuMREwDwYDVQQKDAhUUFEgR21iSDEcM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This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDYYMFFpJwjlJq5 | ||
gzQLcXdXEVX+wkyS/Zyx3MvkLPpd/D3VrGWoS6wBuJEw1uQCuetsYU9T/ri8em+K | ||
i/QpK87ibpaJnabUAAwk3kvb8Pra6mvYi8qjjS1KGgyvhqBK/MT3h3qEMw3uBw7T | ||
LbwQ1HR/oHBrbNSEKGCOetuQdR/+wt0acriZ4Xc43Ue5LPXeck2BrjzUh5LXs6m/ | ||
xEJBHeeQUEA6sfmEhVS9pf+ZNwpkoFhdCDMUnfmxiUkYEYRp7DAixLxm4Pu8nG5u | ||
R6OOlGX7GenQvywrfxa2SFJhZzs+53iPtiVs5aNWGKHyBRKicbB/+PSX1NzfSTNU | ||
eGvHpylzAgMBAAECggEAB0RQmV8q40MFYz+VyuCXqnPpmHG8Ep+z2IFa06HzEp77 | ||
EKcGjv1jnHcvYR2GcNT/pBcsi9ydJa9S+aszmwJeo1olch+6T5pkzgQtNgjE0/9V | ||
eeNP/egq4jc3v9lcnsgYcVu6cKAqUpkoFU2O6F3KP9MKk4EHLh0RCRf1McfNOEgR | ||
RrS+Or/rQFC3z1ZaPL5M72jN3V9sYmEkgAjVzkpuD6ffZpcXKMaPQ2XhHdE82fFJ | ||
bfOidsj7qbNil520d31QHsMCasp9vn1k8LpUS0ZVTyEW0JuK3akjaLmatlCWlyex | ||
FNPTUJ4JYliOmXgDqUTslLMEU19QeB5NOpSs7GvS0QKBgQDxEsm2FLP+fHSzGMuc | ||
UijzBNkAVXXajmP7XyKtunHPcw/MGd/BGeYKhxKO5r23K2J1aLbcqHxv7imnROij | ||
4+k67JiIa8z1dJJWG9nqdURmfEbw/7jjB6DwPTbVFiY0xRVR6bkJc2wN3h1eOm/p | ||
kmrRkovTMDN8G4L2fbs1e/PK2wKBgQDlxoYfxfIJZjnPH9aGMz8KCMj95o1i7+xd | ||
ox824ZmPUqVnoQ4IgxSG0OdbVM100QLfq3/uCvWjChW9n3uuQS5jHdlAro5wApX3 | ||
ghWsWcrBGVrUVIfNA0zeuZ6GBtQNmcYG85QuLw2ltSr1UhaZYsWjTcdEt890moK8 | ||
rZODoZFDSQKBgQCdayJShsReepCN3rQeeLwKrPCyuhuCQxbgr2fqv+PPjhgTtBWb | ||
d7jyyO8CZ4Qc1vStLFq0TkUrpf6HHoU3d/z1oEeeVZ557cwc9IThCABJV//PIX1u | ||
qq2aEq76iEMclFFusstEc51slMzimhA4GocsIKCzoDcOZLypDsMvkqhInwKBgQCi | ||
MWl5witgkSVbXHj8j+3+skbWWskQvpUVX9Dn14Wi0s7pAJm8TnLN22aEZK8Gt4cU | ||
xaVvLZNIvBSunoYace5Bjs9NRipLTLf5V3zfBR8HAVPJL8YQZDT9vv70Upua4iIT | ||
xBqkIxi6ENE7C+/h5APoiz2O90TcZTjF4KyRLRox6QKBgQDbHFYfSQRNNmYyIh/u | ||
uB/ssUEmaM0voP1fKc4TE3BjwukSzA7FG6dqhB97BfioknMkiZU6mu8xyIMJJoNG | ||
4tUJuLS9Tr9f+eu+Jj/OyiZke1ZlW0Fj7xQmLqgxmuIcPq2Y6+XIQOJeBdWGc2iY | ||
XFlO08E8kmLb6Anx0Iy9yoYb3g== | ||
-----END PRIVATE KEY----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/bash | ||
# | ||
# Setting up a DigitalOcean Droplet | ||
# with Basic Python Stack | ||
# and Jupyter Notebook | ||
# | ||
# Python for Algorithmic Trading | ||
# (c) Dr Yves J Hilpisch | ||
# The Python Quants GmbH | ||
# | ||
|
||
# IP ADDRESS FROM PARAMETER | ||
MASTER_IP=$1 | ||
|
||
# COPYING THE FILES | ||
scp install.sh root@${MASTER_IP}: | ||
scp mycert.pem mykey.key jupyter_notebook_config.py root@${MASTER_IP}: | ||
|
||
# EXECUTING THE INSTALLATION SCRIPT | ||
ssh root@${MASTER_IP} bash /root/install.sh |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.