Add locks_add to rest api client

This commit is contained in:
Matthias 2024-03-30 14:37:34 +01:00
parent f4074d2960
commit ad06f93501
3 changed files with 21 additions and 0 deletions

View File

@ -166,6 +166,7 @@ freqtrade-client --config rest_config.json <command> [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 <lock_id>` | Deletes (disables) the lock by id.
| `locks add <pair>, <until>, [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 <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
| `forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`).

View File

@ -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.

View File

@ -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]),