mirror of
https://github.com/freqtrade/freqtrade.git
synced 2024-11-10 10:21:59 +00:00
Implement /delete in rest client
This commit is contained in:
parent
075c73b9e3
commit
8ed3b81c61
|
@ -106,26 +106,29 @@ python3 scripts/rest_client.py --config rest_config.json <command> [optional par
|
||||||
|
|
||||||
## Available commands
|
## Available commands
|
||||||
|
|
||||||
| Command | Default | Description |
|
| Command | Description |
|
||||||
|----------|---------|-------------|
|
|----------|-------------|
|
||||||
| `start` | | Starts the trader
|
| `ping` | Simple command testing the API Readiness - requires no authentication.
|
||||||
| `stop` | | Stops the trader
|
| `start` | Starts the trader
|
||||||
| `stopbuy` | | Stops the trader from opening new trades. Gracefully closes open trades according to their rules.
|
| `stop` | Stops the trader
|
||||||
| `reload_config` | | Reloads the configuration file
|
| `stopbuy` | Stops the trader from opening new trades. Gracefully closes open trades according to their rules.
|
||||||
| `show_config` | | Shows part of the current configuration with relevant settings to operation
|
| `reload_config` | Reloads the configuration file
|
||||||
| `status` | | Lists all open trades
|
| `trades` | List last trades.
|
||||||
| `count` | | Displays number of trades used and available
|
| `delete_trade <trade_id>` | Remove trade from the database. Tries to close open orders. Requires manual handling of this trade on the exchange.
|
||||||
| `profit` | | Display a summary of your profit/loss from close trades and some stats about your performance
|
| `show_config` | Shows part of the current configuration with relevant settings to operation
|
||||||
| `forcesell <trade_id>` | | Instantly sells the given trade (Ignoring `minimum_roi`).
|
| `status` | Lists all open trades
|
||||||
| `forcesell all` | | Instantly sells all open trades (Ignoring `minimum_roi`).
|
| `count` | Displays number of trades used and available
|
||||||
| `forcebuy <pair> [rate]` | | Instantly buys the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
| `profit` | Display a summary of your profit/loss from close trades and some stats about your performance
|
||||||
| `performance` | | Show performance of each finished trade grouped by pair
|
| `forcesell <trade_id>` | Instantly sells the given trade (Ignoring `minimum_roi`).
|
||||||
| `balance` | | Show account balance per currency
|
| `forcesell all` | Instantly sells all open trades (Ignoring `minimum_roi`).
|
||||||
| `daily <n>` | 7 | Shows profit or loss per day, over the last n days
|
| `forcebuy <pair> [rate]` | Instantly buys the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
||||||
| `whitelist` | | Show the current whitelist
|
| `performance` | Show performance of each finished trade grouped by pair
|
||||||
| `blacklist [pair]` | | Show the current blacklist, or adds a pair to the blacklist.
|
| `balance` | Show account balance per currency
|
||||||
| `edge` | | Show validated pairs by Edge if it is enabled.
|
| `daily <n>` | Shows profit or loss per day, over the last n days (n defaults to 7)
|
||||||
| `version` | | Show version
|
| `whitelist` | Show the current whitelist
|
||||||
|
| `blacklist [pair]` | Show the current blacklist, or adds a pair to the blacklist.
|
||||||
|
| `edge` | Show validated pairs by Edge if it is enabled.
|
||||||
|
| `version` | Show version
|
||||||
|
|
||||||
Possible commands can be listed from the rest-client script using the `help` command.
|
Possible commands can be listed from the rest-client script using the `help` command.
|
||||||
|
|
||||||
|
|
|
@ -57,6 +57,7 @@ official commands. You can ask at any moment for help with `/help`.
|
||||||
| `/status` | | Lists all open trades
|
| `/status` | | Lists all open trades
|
||||||
| `/status table` | | List all open trades in a table format. Pending buy orders are marked with an asterisk (*) Pending sell orders are marked with a double asterisk (**)
|
| `/status table` | | List all open trades in a table format. Pending buy orders are marked with an asterisk (*) Pending sell orders are marked with a double asterisk (**)
|
||||||
| `/trades [limit]` | | List all recently closed trades in a table format.
|
| `/trades [limit]` | | List all recently closed trades in a table format.
|
||||||
|
| `/delete <trade_id>` | | Delete a specific trade from the Database. Tries to close open orders. Requires manual handling of this trade on the exchange.
|
||||||
| `/count` | | Displays number of trades used and available
|
| `/count` | | Displays number of trades used and available
|
||||||
| `/profit` | | Display a summary of your profit/loss from close trades and some stats about your performance
|
| `/profit` | | Display a summary of your profit/loss from close trades and some stats about your performance
|
||||||
| `/forcesell <trade_id>` | | Instantly sells the given trade (Ignoring `minimum_roi`).
|
| `/forcesell <trade_id>` | | Instantly sells the given trade (Ignoring `minimum_roi`).
|
||||||
|
|
|
@ -548,7 +548,7 @@ class Telegram(RPC):
|
||||||
try:
|
try:
|
||||||
msg = self._rpc_delete(trade_id)
|
msg = self._rpc_delete(trade_id)
|
||||||
self._send_msg((
|
self._send_msg((
|
||||||
'Delete Result: `{result_msg}`'
|
'`{result_msg}`\n'
|
||||||
'Please make sure to take care of this asset on the exchange manually.'
|
'Please make sure to take care of this asset on the exchange manually.'
|
||||||
).format(**msg))
|
).format(**msg))
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,9 @@ class FtRestClient():
|
||||||
def _get(self, apipath, params: dict = None):
|
def _get(self, apipath, params: dict = None):
|
||||||
return self._call("GET", apipath, params=params)
|
return self._call("GET", apipath, params=params)
|
||||||
|
|
||||||
|
def _delete(self, apipath, params: dict = None):
|
||||||
|
return self._call("DELETE", apipath, params=params)
|
||||||
|
|
||||||
def _post(self, apipath, params: dict = None, data: dict = None):
|
def _post(self, apipath, params: dict = None, data: dict = None):
|
||||||
return self._call("POST", apipath, params=params, data=data)
|
return self._call("POST", apipath, params=params, data=data)
|
||||||
|
|
||||||
|
@ -164,6 +167,15 @@ class FtRestClient():
|
||||||
"""
|
"""
|
||||||
return self._get("trades", params={"limit": limit} if limit else 0)
|
return self._get("trades", params={"limit": limit} if limit else 0)
|
||||||
|
|
||||||
|
def delete_trade(self, trade_id):
|
||||||
|
"""Delete trade from the database.
|
||||||
|
Tries to close open orders. Requires manual handling of this asset on the exchange.
|
||||||
|
|
||||||
|
:param trade_id: Deletes the trade with this ID from the database.
|
||||||
|
:return: json object
|
||||||
|
"""
|
||||||
|
return self._delete("trades/{}".format(trade_id))
|
||||||
|
|
||||||
def whitelist(self):
|
def whitelist(self):
|
||||||
"""Show the current whitelist.
|
"""Show the current whitelist.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user