-
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
6fc9ede
commit da0d818
Showing
90 changed files
with
6,304 additions
and
6,046 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,3 @@ | ||
[flake8] | ||
max-line-length = 88 | ||
ignore=E203,W503,D100,D101,D102,D103,D104,D105,D106,D107 |
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,22 +1,38 @@ | ||
__pycache__ | ||
|
||
# coverage | ||
.coverage | ||
htmlcov/ | ||
|
||
# confidential | ||
*ig_credentials.yaml | ||
#### virtualenv | ||
venv/* | ||
.venv/* | ||
|
||
|
||
# dev files | ||
.venv | ||
#### IDE | ||
.idea | ||
data/* | ||
*data.sqlite* | ||
errors.log | ||
reports/* | ||
|
||
#### tmp files | ||
/test_* | ||
old/* | ||
|
||
#### build | ||
*egg-info/ | ||
dist/* | ||
build/* | ||
|
||
#### sample testing | ||
data/* | ||
reports/* | ||
errors.log | ||
samples/providers/database/migration.py | ||
|
||
#### doc | ||
/docs/_build | ||
site/ | ||
build/* | ||
_build/* | ||
|
||
### pytest | ||
htmlcov/* | ||
.coverage | ||
htmlcov/ | ||
|
||
# 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 |
---|---|---|
@@ -1,11 +1,16 @@ | ||
language: python | ||
python: | ||
- "3.6" # current default Python on Travis CI | ||
|
||
env: | ||
- PYVERSION=py36 | ||
- PYVERSION=py37 | ||
- PYVERSION=py38 | ||
|
||
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 mv docker-compose /usr/local/bin | ||
# command to install dependencies | ||
install: | ||
- pip install -r requirements.txt | ||
- pip install -r requirements-dev.txt | ||
# command to run tests | ||
script: | ||
- pytest tests/ | ||
- flake8 --max-line-length 120 estrade/ | ||
- 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
ARG image_name | ||
FROM python:$image_name | ||
|
||
RUN mkdir /estrade | ||
WORKDIR /estrade | ||
|
||
RUN pip install poetry |
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,48 +1,34 @@ | ||
SHELL := /bin/bash | ||
VENV_NAME?=.venv | ||
VENV_ACTIVATE=. $(VENV_NAME)/bin/activate | ||
PYTHON_PATH=/usr/bin/python3.6 | ||
PYTHON_EXE=python3 | ||
|
||
|
||
|
||
install: | ||
( \ | ||
rm -rf $(VENV_NAME)/; \ | ||
$(PYTHON_EXE) -m virtualenv $(VENV_NAME) -p $(PYTHON_PATH); \ | ||
$(VENV_ACTIVATE); \ | ||
echo "${VIRTUAL_ENV}"; \ | ||
pip list; \ | ||
pip install -r requirements.txt; \ | ||
pip list; \ | ||
deactivate; \ | ||
) | ||
|
||
install-dev: install | ||
( \ | ||
$(VENV_ACTIVATE); \ | ||
pip install -r requirements-dev.txt; \ | ||
pip list; \ | ||
deactivate; \ | ||
) | ||
|
||
test: | ||
( \ | ||
$(VENV_ACTIVATE); \ | ||
pytest tests/ -x --log-level=DEBUG; \ | ||
deactivate; \ | ||
) | ||
|
||
test-cov: | ||
( \ | ||
$(VENV_ACTIVATE); \ | ||
pytest --cov=estrade/ --cov-report html tests/ -x; \ | ||
deactivate; \ | ||
) | ||
PYVERSION ?= py36 | ||
|
||
DOCKER_RUN = docker-compose run --rm estrade-$(PYVERSION) | ||
|
||
shell: | ||
$(DOCKER_RUN) bash | ||
|
||
test: | ||
$(DOCKER_RUN) make test-local | ||
|
||
lint: | ||
( \ | ||
$(VENV_ACTIVATE); \ | ||
flake8 --max-line-length 120 estrade/ ; \ | ||
deactivate; \ | ||
) | ||
$(DOCKER_RUN) make lint-local | ||
|
||
docs: | ||
$(DOCKER_RUN) make docs-local | ||
|
||
ci: | ||
$(DOCKER_RUN) make ci-local | ||
|
||
|
||
init-local: | ||
poetry install | ||
|
||
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 | ||
|
||
docs-local: init-local | ||
poetry run mkdocs build --clean | ||
|
||
ci-local: test-local lint-local docs-local |
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,12 +1,37 @@ | ||
# Estrade | ||
|
||
[![Build Status](https://travis-ci.com/cimourdain/estrade.svg?branch=master)](https://travis-ci.com/cimourdain/estrade) | ||
[![Documentation Status](https://readthedocs.org/projects/estrade/badge/?version=latest)](https://estrade.readthedocs.io/en/latest/?badge=latest) | ||
[![pypi](https://badgen.net/pypi/v/estrade)](https://pypi.org/project/estrade/) | ||
[![black](https://badgen.net/badge/code%20style/black/000)](https://github.com/ambv/black) | ||
|
||
The purpose of this repository is to provide a framework to easily backtest trading strategies and use them live with a brooker API. | ||
# Estrade: Trading bot manager | ||
|
||
# Pre-requisites | ||
This program is only tested with Pyhton 3.6 | ||
Estrade is a python library that allows you to easily backtest and run stock trading strategies. | ||
|
||
Estrade focus on providing tools so you mainly focus on your strategy definition. | ||
|
||
> **WARNING**: Estrade is still in an alpha state of developpement and very unmature. Do not use it for other purposes than testing. | ||
## Features | ||
|
||
- Estrade provides a **market environnement**, so you do not have to worry about | ||
- Trades result calculation | ||
- Candle Graph building | ||
- Indicators calculation | ||
- Estrade allows you to define your strategies based on market events (new tick received, new candle created) | ||
- Estrade allows you to create your own data providers to generate ticks data and manage trades (open/close) | ||
- Estrade allows you to create your own indicators | ||
- Estrade allows you to create your own reporting | ||
|
||
|
||
## What Estrade does NOT provides | ||
|
||
- **Data**: You have to define your own data provider (live or static) | ||
- **Strategies**: Although some very basic (and useless) strategies are provided as examples in samples, Estrate does not provide any financially relevant strategy. | ||
|
||
## Documentation | ||
|
||
[Documentation](https://estrade.readthedocs.io/) | ||
|
||
# Usage | ||
See [wiki](https://github.com/cimourdain/estrade/wiki) | ||
|
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,26 @@ | ||
version: "2.1" | ||
|
||
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" |
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,26 @@ | ||
# Estrade | ||
|
||
# Estrade: Trading bot manager | ||
|
||
Estrade is a python library that allows you to easily backtest and run stock trading strategies. | ||
|
||
Estrade focus on providing tools so you mainly focus on your strategy definition. | ||
|
||
|
||
## Features | ||
|
||
- Estrade provides a **market environnement**, so you do not have to worry about | ||
- Trades result calculation | ||
- Candle Graph building | ||
- Indicators calculation | ||
- Estrade allows you to define your strategies based on market events (new tick received, new candle created) | ||
- Estrade allows you to create your own data providers to generate ticks data and manage trades (open/close) | ||
- Estrade allows you to create your own indicators | ||
- Estrade allows you to create your own reporting | ||
|
||
|
||
## What Estrade does NOT provides | ||
|
||
- **Data**: You have to define your own data provider (live or static) | ||
- **Strategies**: Although some very basic (and useless) strategies are provided as examples in samples, Estrate does not provide any financially relevant strategy. | ||
|
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 @@ | ||
# Install | ||
|
||
Install Estrade by running: | ||
|
||
```bash | ||
$ pip install estrade | ||
``` | ||
|
Oops, something went wrong.