diff --git a/docs/rest-api.md b/docs/rest-api.md index 69a0f31f5..cf196559d 100644 --- a/docs/rest-api.md +++ b/docs/rest-api.md @@ -166,6 +166,7 @@ freqtrade-client --config rest_config.json [optional parameters] | `mix_tags [pair]` | Shows profit statistics for each combinations of enter tag + exit reasons for given pair (or all pairs if pair isn't given). Pair is optional. | `locks` | Displays currently locked pairs. | `delete_lock ` | Deletes (disables) the lock by id. +| `locks add , , [side], [reason]` | Locks a pair until "until". (Until will be rounded up to the nearest timeframe). | `profit` | Display a summary of your profit/loss from close trades and some stats about your performance. | `forceexit ` | Instantly exits the given trade (Ignoring `minimum_roi`). | `forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`). diff --git a/ft_client/freqtrade_client/ft_rest_client.py b/ft_client/freqtrade_client/ft_rest_client.py index de782ee65..1a10cd7d8 100755 --- a/ft_client/freqtrade_client/ft_rest_client.py +++ b/ft_client/freqtrade_client/ft_rest_client.py @@ -148,6 +148,25 @@ class FtRestClient: """ return self._delete(f"locks/{lock_id}") + def lock_add(self, pair: str, until: str, side: str = '*', reason: str = ''): + """Lock pair + + :param pair: Pair to lock + :param until: Lock until this date (format "2024-03-30 16:00:00Z") + :param side: Side to lock (long, short, *) + :param reason: Reason for the lock + :return: json object + """ + data = [ + { + "pair": pair, + "until": until, + "side": side, + "reason": reason + } + ] + return self._post("locks", data=data) + def daily(self, days=None): """Return the profits for each day, and amount of trades. diff --git a/ft_client/test_client/test_rest_client.py b/ft_client/test_client/test_rest_client.py index e7c2f32e6..13e32f1c5 100644 --- a/ft_client/test_client/test_rest_client.py +++ b/ft_client/test_client/test_rest_client.py @@ -61,6 +61,7 @@ def test_FtRestClient_call_invalid(caplog): ('exits', []), ('mix_tags', []), ('locks', []), + ('lock_add', ["XRP/USDT", '2024-01-01 20:00:00Z', '*', 'rand']), ('delete_lock', [2]), ('daily', []), ('daily', [15]),