Skip to content

Commit

Permalink
feat(estrade): legacy v0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
cimourdain committed Sep 6, 2020
1 parent 6fc9ede commit da0d818
Show file tree
Hide file tree
Showing 90 changed files with 6,304 additions and 6,046 deletions.
3 changes: 3 additions & 0 deletions .flake8
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
44 changes: 30 additions & 14 deletions .gitignore
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/


21 changes: 13 additions & 8 deletions .travis.yml
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
7 changes: 7 additions & 0 deletions Dockerfile
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
78 changes: 32 additions & 46 deletions Makefile
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
35 changes: 30 additions & 5 deletions README.md
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)

26 changes: 26 additions & 0 deletions docker-compose.yml
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"
26 changes: 26 additions & 0 deletions docs/index.md
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.

8 changes: 8 additions & 0 deletions docs/install.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Install

Install Estrade by running:

```bash
$ pip install estrade
```

0 comments on commit da0d818

Please sign in to comment.