From 1be3d57b60a4f5feef41e7178b2f0a04d2f82307 Mon Sep 17 00:00:00 2001 From: Matthias Date: Mon, 21 Jan 2019 19:53:14 +0100 Subject: [PATCH 1/4] Improve developer docs --- CONTRIBUTING.md | 20 ++++---------------- docs/developer.md | 14 +++++++++++++- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c9a967834..3c511f44d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,6 +14,10 @@ Few pointers for contributions: If you are unsure, discuss the feature on our [Slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE) or in a [issue](https://github.com/freqtrade/freqtrade/issues) before a PR. +## Getting started + +Best start by reading the [documentation](https://www.freqtrade.io/) to get a feel for what is possible with the bot, or head straight to the [Developer-documentation](https://www.freqtrade.io/en/latest/developer/) (WIP) which should help you getting started. + ## Before sending the PR: ### 1. Run unit tests @@ -41,12 +45,6 @@ pytest freqtrade/tests/test_.py::test_ ### 2. Test if your code is PEP8 compliant -#### Install packages - -```bash -pip3.6 install flake8 coveralls -``` - #### Run Flake8 ```bash @@ -60,22 +58,12 @@ Guide for installing them is [here](http://flake8.pycqa.org/en/latest/user/using ### 3. Test if all type-hints are correct -#### Install packages - -``` bash -pip3.6 install mypy -``` - #### Run mypy ``` bash mypy freqtrade ``` -## Getting started - -Best start by reading the [documentation](https://github.com/freqtrade/freqtrade/blob/develop/docs/index.md) to get a feel for what is possible with the bot, or head straight to the [Developer-documentation](https://github.com/freqtrade/freqtrade/blob/develop/docs/developer.md) (WIP) which should help you getting started. - ## (Core)-Committer Guide ### Process: Pull Requests diff --git a/docs/developer.md b/docs/developer.md index 64f3b9a52..6fbcdc812 100644 --- a/docs/developer.md +++ b/docs/developer.md @@ -4,8 +4,20 @@ This page is intended for developers of FreqTrade, people who want to contribute All contributions, bug reports, bug fixes, documentation improvements, enhancements and ideas are welcome. We [track issues](https://github.com/freqtrade/freqtrade/issues) on [GitHub](https://github.com) and also have a dev channel in [slack](https://join.slack.com/t/highfrequencybot/shared_invite/enQtMjQ5NTM0OTYzMzY3LWMxYzE3M2MxNDdjMGM3ZTYwNzFjMGIwZGRjNTc3ZGU3MGE3NzdmZGMwNmU3NDM5ZTNmM2Y3NjRiNzk4NmM4OGE) where you can ask questions. +## Documentation -## Module +Documentation is available at [https://freqtrade.io](https://www.freqtrade.io/) and needs to be provided with every new feature PR. + +Special fields for the documentation (like Note boxes, ...) can be found [here](https://squidfunk.github.io/mkdocs-material/extensions/admonition/). + +## Developer setup + +To configure a development environment, use best use the `setup.sh` script and answer "y" when asked "Do you want to install dependencies for dev [y/N]? ". +Alternatively (if your system is not supported by the setup.sh script), follow the manual installation process and run `pip3 install -r requirements-dev.txt`. + +This will install all required tools for development, including `pytest`, `flake8`, `mypy`, and `coveralls`. + +## Modules ### Dynamic Pairlist From 7c71b9513cf8cbb9e75e277b01cd5455f3c464ed Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Tue, 22 Jan 2019 13:32:11 +0100 Subject: [PATCH 2/4] Update ccxt from 1.18.141 to 1.18.144 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 8e6720195..25e337306 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -ccxt==1.18.141 +ccxt==1.18.144 SQLAlchemy==1.2.16 python-telegram-bot==11.1.0 arrow==0.13.0 From c412cd9e5704d220035826524469db8aaf87e69d Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 22 Jan 2019 19:44:56 +0100 Subject: [PATCH 3/4] Add information about dataframe fix #1192 --- docs/bot-optimization.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/docs/bot-optimization.md b/docs/bot-optimization.md index 1cfae1bc4..1c622737f 100644 --- a/docs/bot-optimization.md +++ b/docs/bot-optimization.md @@ -216,12 +216,40 @@ This is the set of candles the bot should download and use for the analysis. Common values are `"1m"`, `"5m"`, `"15m"`, `"1h"`, however all values supported by your exchange should work. Please note that the same buy/sell signals may work with one interval, but not the other. +This setting is accessible within the strategy by using `self.ticker_interval`. ### Metadata dict The metadata-dict (available for `populate_buy_trend`, `populate_sell_trend`, `populate_indicators`) contains additional information. Currently this is `pair`, which can be accessed using `metadata['pair']` - and will return a pair in the format `XRP/BTC`. +The Metadata-dict should not be modified and does not persist information across multiple calls. +Instead, have a look at the section [Storing information](#Storing-information) + +### Storing information + +Storing information can be accomplished by crating a new dictionary within the strategy class. + +The name of the variable can be choosen at will, but should be prefixed with `cust_` to avoid naming collisions with predefined strategy variables. + +```python +class Awesomestrategy(IStrategy): + # Create custom dictionary + cust_info = {} + def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame: + # Check if the entry already exists + if "crosstime" in self.cust_info[metadata["pair"]: + self.cust_info[metadata["pair"]["crosstime"] += 1 + else: + self.cust_info[metadata["pair"]["crosstime"] = 1 +``` + +!!! Warning: + The data is not persisted after a bot-restart (or config-reload). Also, the amount of data should be kept smallish (no DataFrames and such), otherwise the bot will start to consume a lot of memory and eventually run out of memory and crash. + +!!! Note: + If the data is pair-specific, make sure to use pair as one of the keys in the dictionary. + ### Where is the default strategy? The default buy strategy is located in the file From 13e2f71d3008d9c6fa66bf9c53ddc53ab6cffd9e Mon Sep 17 00:00:00 2001 From: Matthias Date: Tue, 22 Jan 2019 20:01:12 +0100 Subject: [PATCH 4/4] Add flake8 plugins and implement small improvements --- freqtrade/freqtradebot.py | 2 +- freqtrade/optimize/backtesting.py | 2 +- requirements-dev.txt | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/freqtrade/freqtradebot.py b/freqtrade/freqtradebot.py index 2e09cf116..7d14c734c 100644 --- a/freqtrade/freqtradebot.py +++ b/freqtrade/freqtradebot.py @@ -34,7 +34,7 @@ class FreqtradeBot(object): This is from here the bot start its logic. """ - def __init__(self, config: Dict[str, Any])-> None: + def __init__(self, config: Dict[str, Any]) -> None: """ Init all variables and object the bot need to work :param config: configuration dict, you can use the Configuration.get_config() diff --git a/freqtrade/optimize/backtesting.py b/freqtrade/optimize/backtesting.py index 38bbe13d4..37ba2ad83 100644 --- a/freqtrade/optimize/backtesting.py +++ b/freqtrade/optimize/backtesting.py @@ -13,7 +13,7 @@ from typing import Any, Dict, List, NamedTuple, Optional from pandas import DataFrame from tabulate import tabulate -import freqtrade.optimize as optimize +from freqtrade import optimize from freqtrade import DependencyException, constants from freqtrade.arguments import Arguments from freqtrade.configuration import Configuration diff --git a/requirements-dev.txt b/requirements-dev.txt index f68fe8814..4f8504c8a 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,8 @@ -r requirements.txt flake8==3.6.0 +flake8-type-annotations==0.1.0 +flake8-tidy-imports==1.1.0 pytest==4.1.1 pytest-mock==1.10.0 pytest-asyncio==0.10.0