-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
da0d818
commit 393f040
Showing
152 changed files
with
8,999 additions
and
5,487 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,8 @@ | ||
[report] | ||
fail_under = 90.0 | ||
|
||
[run] | ||
source = estrade | ||
|
||
[html] | ||
directory = htmlcov |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
__pycache__ | ||
.vim | ||
|
||
#### virtualenv | ||
venv/* | ||
|
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 |
---|---|---|
@@ -1,16 +1,28 @@ | ||
language: python | ||
|
||
env: | ||
- PYVERSION=py36 | ||
- PYVERSION=py37 | ||
- PYVERSION=py38 | ||
global: | ||
- DOCKER_COMPOSE_VERSION=1.25.5 | ||
jobs: | ||
- PYVERSION=3.6.10 | ||
- PYVERSION=3.7.8 | ||
- PYVERSION=3.8.3 | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o ./docker-compose | ||
- chmod +x ./docker-compose | ||
- sudo rm /usr/local/bin/docker-compose | ||
- curl -L https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose | ||
- chmod +x docker-compose | ||
- sudo mv docker-compose /usr/local/bin | ||
# command to install dependencies | ||
# before_install: | ||
# - curl -L "https://github.com/docker/compose/releases/download/1.25.3/docker-compose-$(uname -s)-$(uname -m)" -o ./docker-compose | ||
# - chmod +x ./docker-compose | ||
# - sudo mv docker-compose /usr/local/bin | ||
|
||
install: | ||
- make init | ||
|
||
script: | ||
- make ci |
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 |
---|---|---|
@@ -1,7 +1,93 @@ | ||
ARG image_name | ||
FROM python:$image_name | ||
################################################## | ||
# | ||
# Base image | ||
# | ||
################################################## | ||
ARG IMAGE_NAME | ||
FROM python:${IMAGE_NAME} as base | ||
|
||
RUN mkdir /estrade | ||
WORKDIR /estrade | ||
ARG POETRY_VERSION | ||
ARG USER_NAME | ||
|
||
RUN pip install poetry | ||
################################################## | ||
# ENVIRONMENT VARIABLES | ||
################################################## | ||
# python | ||
ENV PYTHONUNBUFFERED=1 \ | ||
# prevents python creating .pyc files | ||
PYTHONDONTWRITEBYTECODE=1 \ | ||
\ | ||
# pip | ||
PIP_NO_CACHE_DIR=off \ | ||
PIP_DISABLE_PIP_VERSION_CHECK=on \ | ||
PIP_DEFAULT_TIMEOUT=100 | ||
|
||
# poetry | ||
ENV POETRY_VERSION=${POETRY_VERSION} \ | ||
POETRY_HOME="/home/${USER_NAME}/.local/" \ | ||
POETRY_NO_INTERACTION=1 | ||
|
||
ENV PROJECT_DIRECTORY=/home/${USER_NAME}/app | ||
|
||
################################################## | ||
# UPDATE SYSTEM | ||
################################################## | ||
RUN apt-get update \ | ||
&& apt-get install --no-install-recommends -y \ | ||
# deps for installing poetry | ||
curl \ | ||
# deps for building python deps | ||
build-essential \ | ||
# git for coveralls | ||
git | ||
|
||
################################################## | ||
# CREATE USER (based on system user uid/gid) | ||
################################################## | ||
# create user | ||
ARG USER_UID | ||
ARG USER_GID | ||
|
||
# Create group if not found in /etc/group | ||
RUN if ! $(awk -F':' '{print $3}' /etc/group |grep -q ${USER_GID}) ; then groupadd -g ${USER_GID} appgroup; fi | ||
# create user | ||
RUN useradd -rm -g ${USER_GID} -G sudo -u ${USER_UID} ${USER_NAME} | ||
|
||
USER ${USER_NAME} | ||
WORKDIR ${PROJECT_DIRECTORY} | ||
|
||
|
||
################################################## | ||
# INSTALL & CONFIGURE POETRY | ||
################################################## | ||
# install poetry - respects $POETRY_VERSION & $POETRY_HOME | ||
RUN curl -sSL https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py | python | ||
|
||
|
||
ENV VENV_PATH="/home/${USER_NAME}/.poetry_cache/virtualenvs" | ||
ENV PATH="${POETRY_HOME}bin:${VENV_PATH}/bin:$PATH" | ||
|
||
# configure poetry | ||
RUN poetry config cache-dir "/home/${USER_NAME}/.poetry_cache/" | ||
RUN poetry config virtualenvs.create true | ||
RUN poetry config virtualenvs.in-project false | ||
RUN poetry config virtualenvs.path "{cache-dir}/virtualenvs" | ||
|
||
|
||
|
||
################################################## | ||
# INSTALL PROJECT DEPENDENCIES (no dev) | ||
################################################## | ||
COPY poetry.lock pyproject.toml ./ | ||
RUN poetry install --no-dev | ||
|
||
|
||
################################################### | ||
## | ||
## Developement image (used for dev/testing) | ||
## | ||
################################################### | ||
FROM base as development | ||
|
||
# install dev dependencies | ||
RUN poetry install |
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 |
---|---|---|
@@ -1,34 +1,77 @@ | ||
PYVERSION ?= py36 | ||
PROJECT_NAME = estrade | ||
PYVERSION ?= 3.6.10 | ||
POETRY_VERSION ?= 1.0.9 | ||
|
||
DOCKER_CONTAINER_NAME = $(APP_NAME)-$(PYVERSION) | ||
DOCKER_CMD_ENV_VARS = PROJECT_NAME=$(PROJECT_NAME) PYVERSION=$(PYVERSION) | ||
DOCKER_RUN = $(DOCKER_CMD_ENV_VARS) docker-compose run --rm development | ||
DOCKER_RUN_TESTS_COVERALLS = $(DOCKER_CMD_ENV_VARS) COVERALLS_REPO_TOKEN=$(COVERALLS_REPO_TOKEN) docker-compose run --rm development | ||
|
||
BLACK_FOLDERS = $(PROJECT_NAME) tests | ||
ISORT_FOLDERS = $(PROJECT_NAME) tests | ||
FLAKE8_FOLDERS = $(PROJECT_NAME) tests | ||
MYPY_FOLDERS = $(PROJECT_NAME) | ||
RADON_FOLDERS = $(PROJECT_NAME) | ||
|
||
PYTEST_OPTIONS = -x -vvv --cov=$(PROJECT_NAME) | ||
|
||
DOCKER_RUN = docker-compose run --rm estrade-$(PYVERSION) | ||
|
||
shell: | ||
$(DOCKER_RUN) bash | ||
|
||
init: | ||
docker build --pull \ | ||
--rm \ | ||
-f Dockerfile \ | ||
-t "$(PROJECT_NAME)/dev:$(PYVERSION)" \ | ||
--target development \ | ||
--build-arg IMAGE_NAME="$(PYVERSION)-slim" \ | ||
--build-arg POETRY_VERSION=$(POETRY_VERSION) \ | ||
--build-arg PROJECT_NAME=$(PROJECT_NAME) \ | ||
--build-arg USER_NAME=$(PROJECT_NAME) \ | ||
--build-arg USER_UID=$(shell id -u $$USER) \ | ||
--build-arg USER_GID=$(shell id -g $$USER) \ | ||
. | ||
|
||
# create container and intsall lib | ||
$(DOCKER_CMD_ENV_VARS) docker-compose run development | ||
|
||
test-integration: | ||
$(DOCKER_RUN) bash -c "poetry run pytest tests/integration/ tests/doc/ $(PYTEST_OPTIONS)" | ||
|
||
test-unit: | ||
$(DOCKER_RUN) bash -c "poetry run pytest tests/unit/ $(PYTEST_OPTIONS)" | ||
|
||
test: | ||
$(DOCKER_RUN) make test-local | ||
$(DOCKER_RUN) bash -c "poetry run pytest tests/ $(PYTEST_OPTIONS)" | ||
|
||
lint: | ||
$(DOCKER_RUN) make lint-local | ||
test-report: | ||
$(DOCKER_RUN) bash -c "poetry run pytest tests/unit/ $(PYTEST_OPTIONS) --cov-report html" | ||
|
||
docs: | ||
$(DOCKER_RUN) make docs-local | ||
format: | ||
$(DOCKER_RUN) bash -c "poetry run black $(BLACK_FOLDERS)" | ||
$(DOCKER_RUN) bash -c "poetry run isort -rc $(ISORT_FOLDERS)" | ||
$(DOCKER_RUN) bash -c "poetry run radon cc -a -nb $(RADON_FOLDERS)" | ||
|
||
ci: | ||
$(DOCKER_RUN) make ci-local | ||
style: | ||
$(DOCKER_RUN) bash -c "poetry run black $(BLACK_FOLDERS) --check --diff" | ||
$(DOCKER_RUN) bash -c "poetry run flake8 $(FLAKE8_FOLDERS)" | ||
$(DOCKER_RUN) bash -c "poetry run isort --check-only -rc $(ISORT_FOLDERS)" | ||
$(DOCKER_RUN) bash -c "poetry run mypy $(MYPY_FOLDERS)" | ||
$(DOCKER_RUN) bash -c "poetry run xenon --max-absolute B --max-modules A --max-average A $(RADON_FOLDERS)" | ||
|
||
docs: | ||
$(DOCKER_RUN) bash -c "poetry run mkdocs build --clean" | ||
|
||
init-local: | ||
poetry install | ||
docs-serve: | ||
$(DOCKER_RUN) bash -c "poetry run mkdocs serve" | ||
|
||
test-local: init-local | ||
poetry run pytest --cov=estrade/ tests/ -x | ||
|
||
lint-local: init-local | ||
poetry run flake8 estrade | ||
poetry run black estrade -S --check --diff | ||
ci: style test docs | ||
|
||
docs-local: init-local | ||
poetry run mkdocs build --clean | ||
clean: | ||
bash scripts/docker stop_running_containers estrade* | ||
bash scripts/docker remove_containers estrade* | ||
bash scripts/docker clean_images estrade* | ||
|
||
ci-local: test-local lint-local docs-local | ||
.PHONY: ci clean docs docs-serve format init shell style test-unit test-integration test-unit test test-report |
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
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 |
---|---|---|
@@ -1,26 +1,16 @@ | ||
version: "2.1" | ||
version: "2.3" | ||
|
||
services: | ||
estrade: | ||
build: | ||
context: . | ||
volumes: | ||
- ${PWD}:/estrade | ||
estrade-py36: | ||
extends: | ||
service: estrade | ||
build: | ||
args: | ||
image_name: "3.6.10-stretch" | ||
estrade-py37: | ||
extends: | ||
service: estrade | ||
build: | ||
args: | ||
image_name: "3.7.6-stretch" | ||
estrade-py38: | ||
extends: | ||
service: estrade | ||
build: | ||
args: | ||
image_name: "3.8.2-buster" | ||
development: | ||
# FIXME use the PROJECT_DIRECTORY env var | ||
environment: | ||
- PYTHONPATH=/home/${PROJECT_NAME}/app/ | ||
image: ${PROJECT_NAME}/dev:${PYVERSION} | ||
user: ${PROJECT_NAME} | ||
working_dir: /home/${PROJECT_NAME}/app/ | ||
container_name: ${PROJECT_NAME}-dev-${PYVERSION} | ||
command: bash -c "poetry install" | ||
ports: | ||
- "8000:8000" | ||
volumes: | ||
- ${PWD}/:/home/${PROJECT_NAME}/app/ |
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,35 @@ | ||
# Priority 1 | ||
|
||
## Functional | ||
|
||
- [ ] SMA | ||
- [ ] Pivots | ||
- [ ] TradeProvider Update Trade ? | ||
- [ ] Reporting | ||
- [ ] TimeFrameMixin | ||
- [ ] Unit/UnitQuantity consistency | ||
|
||
|
||
## Documentation | ||
|
||
- [ ] BaseIndicator + Epic Docstrings | ||
- [ ] Tutorial full example | ||
- [ ] Samples | ||
- [ ] CONTRIBUTING page | ||
- [ ] doc path for clickable links in readthedocs | ||
|
||
## Refacto | ||
|
||
- [ ] Abstract | ||
- [ ] Tick Handler Mixin | ||
|
||
## CI | ||
- [ ] Pre-commit to set branch name in README | ||
|
||
|
||
# Priority 2 | ||
|
||
- [ ] Basic Indicators SME, RSI etc. | ||
- [ ] Lag simulation | ||
- [ ] Multiple Tick Providers ? Rename to DataProvider? | ||
- [ ] Stop/Limit |
Oops, something went wrong.