Add /profit long and /profit short commands#2
# Added `/profit_long` and `/profit_short` Commands Users can now use commands like: - `/profit_long [<n>]` - `/profit_short [<n>]` - `/profit [<n>]` --- ## Key Changes Implemented ### `freqtrade/rpc/telegram.py`: - The `_profit` command handler has been updated to robustly parse `long` or `short` as optional arguments. - **Translation:** The `_profit` command handler has been improved to reliably interpret `long` or `short` as optional parameters. - The determined direction is passed to the RPC layer. - **Translation:** The direction determined (either `long` or `short`) is passed to the RPC layer. - The `/help` command documentation is updated. - **Translation:** The documentation for the `/help` command has been updated accordingly. --- ### `freqtrade/rpc/rpc.py`: - The `_rpc_trade_statistics` method now accepts a direction parameter. - **Translation:** The `_rpc_trade_statistics` method has been updated to accept a `direction` parameter. - The method has been refactored into a main function and a `_process_trade_stats` helper function to reduce complexity and improve readability. - **Translation:** The method has been refactored into a main function and a helper function, `_process_trade_stats`, to reduce complexity and improve readability. - The database query filter is dynamically modified to include a condition on `Trade.is_short` when a direction is provided. - **Translation:** The database query filter dynamically adjusts to include a condition on `Trade.is_short` when a direction is specified. --- ### `tests/rpc/test_rpc_telegram.py`: - Existing tests for `_profit` have been updated to match the new message format. - **Translation:** Existing tests for the `_profit` function have been updated to match the new message format. - New test cases have been added to specifically validate the `long` and `short` filtering functionality. - **Translation:** New test cases have been added to specifically validate the filtering functionality for `long` and `short` trades. --- ## Testing - All local `pytest` tests pass successfully. - **Translation:** All local `pytest` tests have passed successfully. - All `ruff` linter checks pass. - **Translation:** All `ruff` code checks have passed. - As I do not have a full local deployment, I am relying on the CI pipeline for final validation. - **Translation:** Since I don't have a complete local deployment, I am relying on the CI pipeline for final validation. --- This time, only a little AI was used :) Except for the translation.
This commit is contained in:
@@ -146,6 +146,8 @@ Telegram is not mandatory. However, this is a great way to control your bot. Mor
|
||||
- `/stopentry`: Stop entering new trades.
|
||||
- `/status <trade_id>|[table]`: Lists all or specific open trades.
|
||||
- `/profit [<n>]`: Lists cumulative profit from all finished trades, over the last n days.
|
||||
- `/profit_long [<n>]`: Lists cumulative profit from all finished long trades, over the last n days.
|
||||
- `/profit_short [<n>]`: Lists cumulative profit from all finished short trades, over the last n days.
|
||||
- `/forceexit <trade_id>|all`: Instantly exits the given trade (Ignoring `minimum_roi`).
|
||||
- `/fx <trade_id>|all`: Alias to `/forceexit`
|
||||
- `/performance`: Show performance of each finished trade grouped by pair
|
||||
@@ -154,6 +156,7 @@ Telegram is not mandatory. However, this is a great way to control your bot. Mor
|
||||
- `/help`: Show help message.
|
||||
- `/version`: Show version.
|
||||
|
||||
|
||||
## Development branches
|
||||
|
||||
The project is currently setup in two main branches:
|
||||
|
||||
Reference in New Issue
Block a user