Skip to content

Commit

Permalink
Merge pull request #33 from fortesenselabs/feature/environments
Browse files Browse the repository at this point in the history
Reintegrate Nautilus Trader and Enhance TradeFlow Framework
  • Loading branch information
seekersoftec authored Sep 8, 2024
2 parents ed8ad6a + ae9b2d6 commit 2785a3c
Show file tree
Hide file tree
Showing 1,522 changed files with 761,867 additions and 2,096 deletions.
29 changes: 29 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[target.'cfg(all())']
rustflags = [
# https://rust-lang.github.io/rust-clippy/master/index.html#drop_non_drop
# Disable this lint as we explicitly drop even when `Drop` is not implemented
"-Aclippy::drop_non_drop",
]

[target.x86_64-pc-windows-msvc]
rustflags = [
"-C", "target-feature=+crt-static",
]

[target.x86_64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-arg=-undefined",
"-C", "link-arg=dynamic_lookup",
]

[target.x86_64-unknown-linux-musl]
linker = "rust-lld"
rustflags = [
"-C", "target-feature=-crt-static",
]
48 changes: 48 additions & 0 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
version: '3.5'

services:
postgres:
container_name: nautilus-database
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-pass}
POSTGRES_DATABASE: nautilus
PGDATA: /data/postgres
volumes:
- nautilus-database:/data/postgres
ports:
- "5432:5432"
networks:
- nautilus-network
restart: unless-stopped

pgadmin:
container_name: nautilus-pgadmin
image: dpage/pgadmin4
environment:
PGADMIN_DEFAULT_EMAIL: ${PGADMIN_DEFAULT_EMAIL:[email protected]}
PGADMIN_DEFAULT_PASSWORD: ${PGADMIN_DEFAULT_PASSWORD:-admin}
volumes:
- pgadmin:/root/.pgadmin
ports:
- "${PGADMIN_PORT:-5051}:80"
networks:
- nautilus-network
restart: unless-stopped

redis:
container_name: nautilus-redis
image: redis
ports:
- 6379:6379
restart: unless-stopped
networks:
- nautilus-network

networks:
nautilus-network:

volumes:
nautilus-database:
pgadmin:
7 changes: 7 additions & 0 deletions .docker/jupyterlab.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ARG GIT_TAG
FROM ghcr.io/nautechsystems/nautilus_trader:$GIT_TAG
COPY --from=ghcr.io/nautechsystems/nautilus_data:main /opt/pysetup/catalog /catalog
COPY docs/tutorials /opt/pysetup/tutorials
RUN pip install jupyterlab datafusion
ENV NAUTILUS_PATH="/"
CMD ["python", "-m", "jupyterlab", "--port=8888", "--no-browser", "--ip=0.0.0.0", "--allow-root", "-NotebookApp.token=''", "--NotebookApp.password=''", "tutorials"]
51 changes: 51 additions & 0 deletions .docker/nautilus_trader.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
FROM python:3.12-slim AS base
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \
PIP_NO_CACHE_DIR=off \
PIP_DISABLE_PIP_VERSION_CHECK=on \
PIP_DEFAULT_TIMEOUT=100 \
PYO3_PYTHON="/usr/local/bin/python3" \
POETRY_VERSION=1.8.3 \
POETRY_HOME="/opt/poetry" \
POETRY_VIRTUALENVS_CREATE=false \
POETRY_NO_INTERACTION=1 \
PYSETUP_PATH="/opt/pysetup" \
RUST_TOOLCHAIN="stable" \
BUILD_MODE="release" \
CC="clang"
ENV PATH="/root/.cargo/bin:$POETRY_HOME/bin:$PATH"
WORKDIR $PYSETUP_PATH

FROM base AS builder

# Install build deps
RUN apt-get update && \
apt-get install -y curl clang git libssl-dev make pkg-config && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install Rust
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y

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

# Install package requirements (split step and with --no-root to enable caching)
COPY poetry.lock pyproject.toml build.py ./
RUN poetry install --no-root --only main

# Build nautilus_trader
COPY nautilus_core ./nautilus_core
RUN (cd nautilus_core && cargo build --release --all-features)

COPY nautilus_trader ./nautilus_trader
COPY README.md ./
RUN poetry install --only main --all-extras
RUN poetry build -f wheel
RUN python -m pip install ./dist/*whl --force --no-deps
RUN find /usr/local/lib/python3.12/site-packages -name "*.pyc" -exec rm -f {} \;

# Final application image
FROM base AS application

COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
File renamed without changes.
211 changes: 210 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,213 @@ wenv
.vscode
poetry.lock

*environment_ids.json
*environment_ids.json


### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

.git/
**/.pack

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Python template
# 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/
share/python-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/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# 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/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# Nautilus
docs/
tests/
!docs/tutorials
9 changes: 9 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
*.tar.gz filter=lfs diff=lfs merge=lfs -text

# Set standard UNIX/Linux/MacOSX line endings.
* text=auto eol=lf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.ico binary
*.jpg binary
*.bz2 binary
Loading

0 comments on commit 2785a3c

Please sign in to comment.