From 066fb3ce00bf553299e769d52d78e37a5a8999ed Mon Sep 17 00:00:00 2001 From: Matthias Date: Wed, 26 Jan 2022 20:07:58 +0100 Subject: [PATCH] Update rest-client with forceenter --- docs/rest-api.md | 11 +++++++++++ docs/telegram-usage.md | 11 +++++++---- scripts/rest_client.py | 14 ++++++++++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/docs/rest-api.md b/docs/rest-api.md index 8c2599cbc..5a6b1b7a0 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -148,6 +148,7 @@ python3 scripts/rest_client.py --config rest_config.json [optional par | `forcesell ` | Instantly sells the given trade (Ignoring `minimum_roi`). | `forcesell all` | Instantly sells all open trades (Ignoring `minimum_roi`). | `forcebuy [rate]` | Instantly buys the given pair. Rate is optional. (`forcebuy_enable` must be set to True) +| `forceenter [rate]` | Instantly longs or shorts the given pair. Rate is optional. (`forcebuy_enable` must be set to True) | `performance` | Show performance of each finished trade grouped by pair. | `balance` | Show account balance per currency. | `daily ` | Shows profit or loss per day, over the last n days (n defaults to 7). @@ -215,6 +216,13 @@ forcebuy :param pair: Pair to buy (ETH/BTC) :param price: Optional - price to buy +forceenter + Force entering a trade + + :param pair: Pair to buy (ETH/BTC) + :param side: 'long' or 'short' + :param price: Optional - price to buy + forcesell Force-sell a trade. @@ -285,6 +293,9 @@ strategy :param strategy: Strategy class name +sysinfo + Provides system information (CPU, RAM usage) + trade Return specific trade diff --git a/docs/telegram-usage.md b/docs/telegram-usage.md index 54e6f50cb..ebdd062ee 100644 --- a/docs/telegram-usage.md +++ b/docs/telegram-usage.md @@ -173,7 +173,8 @@ official commands. You can ask at any moment for help with `/help`. | `/profit []` | Display a summary of your profit/loss from close trades and some stats about your performance, over the last n days (all trades by default) | `/forcesell ` | Instantly sells the given trade (Ignoring `minimum_roi`). | `/forcesell all` | Instantly sells all open trades (Ignoring `minimum_roi`). -| `/forcebuy [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True) +| `/forcelong [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True) +| `/forceshort [rate]` | Instantly shorts the given pair. Rate is optional and only applies to limit orders. This will only work on non-spot markets. (`forcebuy_enable` must be set to True) | `/performance` | Show performance of each finished trade grouped by pair | `/balance` | Show account balance per currency | `/daily ` | Shows profit or loss per day, over the last n days (n defaults to 7) @@ -275,11 +276,13 @@ Starting capital is either taken from the `available_capital` setting, or calcul > **BITTREX:** Selling BTC/LTC with limit `0.01650000 (profit: ~-4.07%, -0.00008168)` -### /forcebuy [rate] +### /forcelong [rate] | /forceshort [rate] -> **BITTREX:** Buying ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`) +`/forcebuy [rate]` is also supported for longs but should be considered deprecated. -Omitting the pair will open a query asking for the pair to buy (based on the current whitelist). +> **BITTREX:** Long ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`) + +Omitting the pair will open a query asking for the pair to trade (based on the current whitelist). ![Telegram force-buy screenshot](assets/telegram_forcebuy.png) diff --git a/scripts/rest_client.py b/scripts/rest_client.py index b1234d329..e23954dd4 100755 --- a/scripts/rest_client.py +++ b/scripts/rest_client.py @@ -261,6 +261,20 @@ class FtRestClient(): } return self._post("forcebuy", data=data) + def forceenter(self, pair, side, price=None): + """Force entering a trade + + :param pair: Pair to buy (ETH/BTC) + :param side: 'long' or 'short' + :param price: Optional - price to buy + :return: json object of the trade + """ + data = {"pair": pair, + "side": side, + "price": price, + } + return self._post("forceenter", data=data) + def forcesell(self, tradeid): """Force-sell a trade.