diff --git a/README.md b/README.md index 6d57dcd89..a1feeab67 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,6 @@ git checkout develop For any other type of installation please refer to [Installation doc](https://www.freqtrade.io/en/latest/installation/). - ## Basic Usage ### Bot commands @@ -106,7 +105,7 @@ optional arguments: ### Telegram RPC commands -Telegram is not mandatory. However, this is a great way to control your bot. More details on our [documentation](https://www.freqtrade.io/en/latest/telegram-usage/) +Telegram is not mandatory. However, this is a great way to control your bot. More details and the full command list on our [documentation](https://www.freqtrade.io/en/latest/telegram-usage/) - `/start`: Starts the trader - `/stop`: Stops the trader @@ -129,11 +128,6 @@ The project is currently setup in two main branches: - `master` - This branch contains the latest stable release. The bot 'should' be stable on this branch, and is generally well tested. - `feat/*` - These are feature branches, which are being worked on heavily. Please don't use these unless you want to test a specific feature. -## A note on Binance - -For Binance, please add `"BNB/"` to your blacklist to avoid issues. -Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB order unsellable as the expected amount is not there anymore. - ## Support ### Help / Slack diff --git a/docs/advanced-setup.md b/docs/advanced-setup.md index e6334d2c1..97d52850c 100644 --- a/docs/advanced-setup.md +++ b/docs/advanced-setup.md @@ -8,6 +8,9 @@ If you do not know what things mentioned here mean, you probably do not need it. Copy the `freqtrade.service` file to your systemd user directory (usually `~/.config/systemd/user`) and update `WorkingDirectory` and `ExecStart` to match your setup. +!!! Note + Certain systems (like Raspbian) don't load service unit files from the user directory. In this case, copy `freqtrade.service` into `/etc/systemd/user/` (requires superuser permissions). + After that you can start the daemon with: ```bash diff --git a/docs/configuration.md b/docs/configuration.md index f4f6ed5ba..8a2b74ed5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -356,13 +356,6 @@ For example, to test the order type `FOK` with Kraken, and modify candle_limit t !!! Warning Please make sure to fully understand the impacts of these settings before modifying them. -#### Random notes for other exchanges - -* The Ocean (ccxt id: 'theocean') exchange uses Web3 functionality and requires web3 package to be installed: -```shell -$ pip3 install web3 -``` - ### What values can be used for fiat_display_currency? The `fiat_display_currency` configuration parameter sets the base currency to use for the @@ -523,12 +516,14 @@ you run it in production mode. "secret": "08a9dc6db3d7b53e1acebd9275677f4b0a04f1a5", ... } - ``` + !!! Note If you have an exchange API key yet, [see our tutorial](/pre-requisite). -## Using proxy with FreqTrade +You should also make sure to read the [Exchanges](exchanges.md) section of the documentation to be aware of potential configuration details specific to your exchange. + +### Using proxy with Freqtrade To use a proxy with freqtrade, add the kwarg `"aiohttp_trust_env"=true` to the `"ccxt_async_kwargs"` dict in the exchange section of the configuration. diff --git a/docs/data-download.md b/docs/data-download.md index f105e7a56..1f03b124a 100644 --- a/docs/data-download.md +++ b/docs/data-download.md @@ -78,10 +78,8 @@ freqtrade download-data --exchange binance --pairs XRP/ETH ETH/BTC --days 20 --d !!! Warning The historic trades are not available during Freqtrade dry-run and live trade modes because all exchanges tested provide this data with a delay of few 100 candles, so it's not suitable for real-time trading. -### Historic Kraken data - -The Kraken API does only provide 720 historic candles, which is sufficient for FreqTrade dry-run and live trade modes, but is a problem for backtesting. -To download data for the Kraken exchange, using `--dl-trades` is mandatory, otherwise the bot will download the same 720 candles over and over, and you'll not have enough backtest data. +!!! Note "Kraken user" + Kraken users should read [this](exchanges.md#historic-kraken-data) before starting to download data. ## Next step diff --git a/docs/exchanges.md b/docs/exchanges.md new file mode 100644 index 000000000..5bd283a69 --- /dev/null +++ b/docs/exchanges.md @@ -0,0 +1,63 @@ +# Exchange-specific Notes + +This page combines common gotchas and informations which are exchange-specific and most likely don't apply to other exchanges. + +## Binance + +!!! Tip "Stoploss on Exchange" + Binance is currently the only exchange supporting `stoploss_on_exchange`. It provides great advantages, so we recommend to benefit from it. + +### Blacklists + +For Binance, please add `"BNB/"` to your blacklist to avoid issues. +Accounts having BNB accounts use this to pay for fees - if your first trade happens to be on `BNB`, further trades will consume this position and make the initial BNB order unsellable as the expected amount is not there anymore. + +### Binance sites + +Binance has been split into 3, and users must use the correct ccxt exchange ID for their exchange, otherwise API keys are not recognized. + +* [binance.com](https://www.binance.com/) - International users. Use exchange id: `binance`. +* [binance.us](https://www.binance.us/) - US based users. Use exchange id: `binanceus`. +* [binance.je](https://www.binance.je/) - Binance Jersey, trading fiat currencies. Use exchange id: `binanceje`. + +## Kraken + +### Historic Kraken data + +The Kraken API does only provide 720 historic candles, which is sufficient for Freqtrade dry-run and live trade modes, but is a problem for backtesting. +To download data for the Kraken exchange, using `--dl-trades` is mandatory, otherwise the bot will download the same 720 candles over and over, and you'll not have enough backtest data. + +## Bittrex + +### Restricted markets + +Bittrex split its exchange into US and International versions. +The International version has more pairs available, however the API always returns all pairs, so there is currently no automated way to detect if you're affected by the restriction. + +If you have restricted pairs in your whitelist, you'll get a warning message in the log on Freqtrade startup for each restricted pair. + +The warning message will look similar to the following: + +``` output +[...] Message: bittrex {"success":false,"message":"RESTRICTED_MARKET","result":null,"explanation":null}" +``` + +If you're an "International" customer on the Bittrex exchange, then this warning will probably not impact you. +If you're a US customer, the bot will fail to create orders for these pairs, and you should remove them from your whitelist. + +You can get a list of restricted markets by using the following snippet: + +``` python +import ccxt +ct = ccxt.bittrex() +_ = ct.load_markets() +res = [ f"{x['MarketCurrency']}/{x['BaseCurrency']}" for x in ct.publicGetMarkets()['result'] if x['IsRestricted']] +print(res) +``` + +## Random notes for other exchanges + +* The Ocean (exchange id: `theocean`) exchange uses Web3 functionality and requires `web3` python package to be installed: +```shell +$ pip3 install web3 +``` diff --git a/docs/faq.md b/docs/faq.md index 7fdd54958..b9c662085 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -48,12 +48,8 @@ You can use the `/forcesell all` command from Telegram. ### I get the message "RESTRICTED_MARKET" Currently known to happen for US Bittrex users. -Bittrex split its exchange into US and International versions. -The International version has more pairs available, however the API always returns all pairs, so there is currently no automated way to detect if you're affected by the restriction. -If you have restricted pairs in your whitelist, you'll get a warning message in the log on FreqTrade startup for each restricted pair. -If you're an "International" Customer on the Bittrex exchange, then this warning will probably not impact you. -If you're a US customer, the bot will fail to create orders for these pairs, and you should remove them from your Whitelist. +Read [the Bittrex section about restricted markets](exchanges.md#restricted-markets) for more information. ### How do I search the bot logs for something? diff --git a/docs/installation.md b/docs/installation.md index ce35572c4..1330e0994 100644 --- a/docs/installation.md +++ b/docs/installation.md @@ -26,26 +26,32 @@ You will need to create API Keys (Usually you get `key` and `secret`) from the E ## Quick start -Freqtrade provides a Linux/MacOS script to install all dependencies and help you to configure the bot. - -!!! Note - Python3.6 or higher and the corresponding pip are assumed to be available. The install-script will warn and stop if that's not the case. - -```bash -git clone git@github.com:freqtrade/freqtrade.git -cd freqtrade -./setup.sh --install -``` - -!!! Note "Version considerations" - When cloning the repository the default working branch is name `develop`. This branch contains the last features (can be considered as relatively stable thanks to automated tests). The `master` branch contains the code of the last release (done once per month with a one week old snapshot of the `develop` branch to prevent packaging bugs so potentially more stable). +Freqtrade provides the Linux/MacOS Easy Installation script to install all dependencies and help you configure the bot. !!! Note Windows installation is explained [here](#windows). -## Easy Installation - Linux Script +The easiest way to install and run Freqtrade is to clone the bot GitHub repository and then run the Easy Installation script, if it's available for your platform. -If you are on Debian, Ubuntu or MacOS freqtrade provides a script to Install, Update, Configure, and Reset your bot. +!!! Note "Version considerations" + When cloning the repository the default working branch has the name `develop`. This branch contains all last features (can be considered as relatively stable, thanks to automated tests). The `master` branch contains the code of the last release (done usually once per month on an approximately one week old snapshot of the `develop` branch to prevent packaging bugs, so potentially it's more stable). + +!!! Note + Python3.6 or higher and the corresponding `pip` are assumed to be available. The install-script will warn you and stop if that's not the case. `git` is also needed to clone the Freqtrade repository. + +This can be achieved with the following commands: + +```bash +git clone git@github.com:freqtrade/freqtrade.git +cd freqtrade +git checkout master # Optional, see (1) +./setup.sh --install +``` +(1) This command switches the cloned repository to the use of the `master` branch. It's not needed if you wish to stay on the `develop` branch. You may later switch between branches at any time with the `git checkout master`/`git checkout develop` commands. + +## Easy Installation Script (Linux/MacOS) + +If you are on Debian, Ubuntu or MacOS Freqtrade provides the script to install, update, configure and reset the codebase of your bot. ```bash $ ./setup.sh @@ -58,25 +64,25 @@ usage: ** --install ** -This script will install everything you need to run the bot: +With this option, the script will install everything you need to run the bot: * Mandatory software as: `ta-lib` * Setup your virtualenv * Configure your `config.json` file -This script is a combination of `install script` `--reset`, `--config` +This option is a combination of installation tasks, `--reset` and `--config`. ** --update ** -Update parameter will pull the last version of your current branch and update your virtualenv. +This option will pull the last version of your current branch and update your virtualenv. Run the script with this option periodically to update your bot. ** --reset ** -Reset parameter will hard reset your branch (only if you are on `master` or `develop`) and recreate your virtualenv. +This option will hard reset your branch (only if you are on either `master` or `develop`) and recreate your virtualenv. ** --config ** -Config parameter is a `config.json` configurator. This script will ask you questions to setup your bot and create your `config.json`. +Use this option to configure the `config.json` configuration file. The script will interactively ask you questions to setup your bot and create your `config.json`. ------ diff --git a/docs/rest-api.md b/docs/rest-api.md index 4d5bc5730..d0e4c8247 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -22,7 +22,14 @@ Sample configuration: !!! Danger "Password selection" Please make sure to select a very strong, unique password to protect your bot from unauthorized access. -You can then access the API by going to `http://127.0.0.1:8080/api/v1/version` to check if the API is running correctly. +You can then access the API by going to `http://127.0.0.1:8080/api/v1/ping` in a browser to check if the API is running correctly. +This should return the response: + +``` output +{"status":"pong"} +``` + +All other endpoints return sensitive info and require authentication, so are not available through a web browser. To generate a secure password, either use a password manager, or use the below code snipped. diff --git a/freqtrade/rpc/api_server.py b/freqtrade/rpc/api_server.py index 67bbfdc78..5167823fd 100644 --- a/freqtrade/rpc/api_server.py +++ b/freqtrade/rpc/api_server.py @@ -169,6 +169,8 @@ class ApiServer(RPC): view_func=self._status, methods=['GET']) self.app.add_url_rule(f'{BASE_URI}/version', 'version', view_func=self._version, methods=['GET']) + self.app.add_url_rule(f'{BASE_URI}/ping', 'ping', + view_func=self._ping, methods=['GET']) # Combined actions and infos self.app.add_url_rule(f'{BASE_URI}/blacklist', 'blacklist', view_func=self._blacklist, @@ -224,6 +226,13 @@ class ApiServer(RPC): msg = self._rpc_stopbuy() return self.rest_dump(msg) + @rpc_catch_errors + def _ping(self): + """ + simple poing version + """ + return self.rest_dump({"status": "pong"}) + @require_login @rpc_catch_errors def _version(self): diff --git a/mkdocs.yml b/mkdocs.yml index 2c3f70191..43d6acc1d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -16,6 +16,7 @@ nav: - Hyperopt: hyperopt.md - Edge Positioning: edge.md - Utility Subcommands: utils.md + - Exchange-specific Notes: exchanges.md - FAQ: faq.md - Data Analysis: - Jupyter Notebooks: data-analysis.md diff --git a/requirements-common.txt b/requirements-common.txt index c11179fbb..33a5d0776 100644 --- a/requirements-common.txt +++ b/requirements-common.txt @@ -1,6 +1,6 @@ # requirements without requirements installable via conda # mainly used for Raspberry pi installs -ccxt==1.19.14 +ccxt==1.19.25 SQLAlchemy==1.3.10 python-telegram-bot==12.2.0 arrow==0.15.4 diff --git a/requirements-hyperopt.txt b/requirements-hyperopt.txt index f5dae7332..ff8de9cb2 100644 --- a/requirements-hyperopt.txt +++ b/requirements-hyperopt.txt @@ -2,7 +2,7 @@ -r requirements.txt # Required for hyperopt -scipy==1.3.1 +scipy==1.3.2 scikit-learn==0.21.3 scikit-optimize==0.5.2 filelock==3.0.12 diff --git a/requirements.txt b/requirements.txt index 331e3dc67..ebf27abd4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ # Load common requirements -r requirements-common.txt -numpy==1.17.3 +numpy==1.17.4 pandas==0.25.3 diff --git a/tests/rpc/test_rpc_apiserver.py b/tests/rpc/test_rpc_apiserver.py index aa5054314..94b57a09f 100644 --- a/tests/rpc/test_rpc_apiserver.py +++ b/tests/rpc/test_rpc_apiserver.py @@ -64,6 +64,10 @@ def test_api_not_found(botclient): def test_api_unauthorized(botclient): ftbot, client = botclient + rc = client.get(f"{BASE_URI}/ping") + assert_response(rc) + assert rc.json == {'status': 'pong'} + # Don't send user/pass information rc = client.get(f"{BASE_URI}/version") assert_response(rc, 401)