renamed
This commit is contained in:
parent
5c01969969
commit
8442fb915f
@ -128,7 +128,7 @@ Telegram is not mandatory. However, this is a great way to control your bot. Mor
|
|||||||
- `/stopbuy`: Stop entering new trades.
|
- `/stopbuy`: Stop entering new trades.
|
||||||
- `/status <trade_id>|[table]`: Lists all or specific open 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 [<n>]`: Lists cumulative profit from all finished trades, over the last n days.
|
||||||
- `/forceexit <trade_id>|all`: Instantly exits the given trade (Ignoring `minimum_roi`).
|
- `/force_exit <trade_id>|all`: Instantly exits the given trade (Ignoring `minimum_roi`).
|
||||||
- `/performance`: Show performance of each finished trade grouped by pair
|
- `/performance`: Show performance of each finished trade grouped by pair
|
||||||
- `/balance`: Show account balance per currency.
|
- `/balance`: Show account balance per currency.
|
||||||
- `/daily <n>`: Shows profit or loss per day, over the last n days.
|
- `/daily <n>`: Shows profit or loss per day, over the last n days.
|
||||||
|
@ -54,9 +54,9 @@
|
|||||||
"order_types": {
|
"order_types": {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "market",
|
"emergency_exit": "market",
|
||||||
"forceexit": "market",
|
"force_exit": "market",
|
||||||
"forceentry": "market",
|
"force_entry": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
"stoploss_on_exchange": false,
|
"stoploss_on_exchange": false,
|
||||||
"stoploss_on_exchange_interval": 60,
|
"stoploss_on_exchange_interval": 60,
|
||||||
|
@ -366,7 +366,7 @@ This table can tell you which area needs some additional work (e.g. all or many
|
|||||||
|
|
||||||
### Left open trades table
|
### Left open trades table
|
||||||
|
|
||||||
The 3rd table contains all trades the bot had to `forceexit` at the end of the backtesting period to present you the full picture.
|
The 3rd table contains all trades the bot had to `force_exit` at the end of the backtesting period to present you the full picture.
|
||||||
This is necessary to simulate realistic behavior, since the backtest period has to end at some point, while realistically, you could leave the bot running forever.
|
This is necessary to simulate realistic behavior, since the backtest period has to end at some point, while realistically, you could leave the bot running forever.
|
||||||
These trades are also included in the first table, but are also shown separately in this table for clarity.
|
These trades are also included in the first table, but are also shown separately in this table for clarity.
|
||||||
|
|
||||||
|
@ -376,7 +376,7 @@ For example, if your strategy is using a 1h timeframe, and you only want to buy
|
|||||||
|
|
||||||
### Understand order_types
|
### Understand order_types
|
||||||
|
|
||||||
The `order_types` configuration parameter maps actions (`entry`, `exit`, `stoploss`, `emergencyexit`, `forceexit`, `forceentry`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds.
|
The `order_types` configuration parameter maps actions (`entry`, `exit`, `stoploss`, `emergency_exit`, `force_exit`, `force_entry`) to order-types (`market`, `limit`, ...) as well as configures stoploss to be on the exchange and defines stoploss on exchange update interval in seconds.
|
||||||
|
|
||||||
This allows to buy using limit orders, sell using
|
This allows to buy using limit orders, sell using
|
||||||
limit-orders, and create stoplosses using market orders. It also allows to set the
|
limit-orders, and create stoplosses using market orders. It also allows to set the
|
||||||
@ -387,7 +387,7 @@ the buy order is fulfilled.
|
|||||||
|
|
||||||
If this is configured, the following 4 values (`entry`, `exit`, `stoploss` and `stoploss_on_exchange`) need to be present, otherwise, the bot will fail to start.
|
If this is configured, the following 4 values (`entry`, `exit`, `stoploss` and `stoploss_on_exchange`) need to be present, otherwise, the bot will fail to start.
|
||||||
|
|
||||||
For information on (`emergencyexit`,`forceexit`, `forceentry`, `stoploss_on_exchange`,`stoploss_on_exchange_interval`,`stoploss_on_exchange_limit_ratio`) please see stop loss documentation [stop loss on exchange](stoploss.md)
|
For information on (`emergency_exit`,`force_exit`, `force_entry`, `stoploss_on_exchange`,`stoploss_on_exchange_interval`,`stoploss_on_exchange_limit_ratio`) please see stop loss documentation [stop loss on exchange](stoploss.md)
|
||||||
|
|
||||||
Syntax for Strategy:
|
Syntax for Strategy:
|
||||||
|
|
||||||
@ -395,9 +395,9 @@ Syntax for Strategy:
|
|||||||
order_types = {
|
order_types = {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "market",
|
"emergency_exit": "market",
|
||||||
"forceentry": "market",
|
"force_entry": "market",
|
||||||
"forceexit": "market",
|
"force_exit": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
"stoploss_on_exchange": False,
|
"stoploss_on_exchange": False,
|
||||||
"stoploss_on_exchange_interval": 60,
|
"stoploss_on_exchange_interval": 60,
|
||||||
@ -411,9 +411,9 @@ Configuration:
|
|||||||
"order_types": {
|
"order_types": {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "market",
|
"emergency_exit": "market",
|
||||||
"forceentry": "market",
|
"force_entry": "market",
|
||||||
"forceexit": "market",
|
"force_exit": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
"stoploss_on_exchange": false,
|
"stoploss_on_exchange": false,
|
||||||
"stoploss_on_exchange_interval": 60
|
"stoploss_on_exchange_interval": 60
|
||||||
@ -436,7 +436,7 @@ Configuration:
|
|||||||
If `stoploss_on_exchange` is enabled and the stoploss is cancelled manually on the exchange, then the bot will create a new stoploss order.
|
If `stoploss_on_exchange` is enabled and the stoploss is cancelled manually on the exchange, then the bot will create a new stoploss order.
|
||||||
|
|
||||||
!!! Warning "Warning: stoploss_on_exchange failures"
|
!!! Warning "Warning: stoploss_on_exchange failures"
|
||||||
If stoploss on exchange creation fails for some reason, then an "emergency exit" is initiated. By default, this will sell the asset using a market order. The order-type for the emergency-sell can be changed by setting the `emergencyexit` value in the `order_types` dictionary - however, this is not advised.
|
If stoploss on exchange creation fails for some reason, then an "emergency exit" is initiated. By default, this will sell the asset using a market order. The order-type for the emergency-sell can be changed by setting the `emergency_exit` value in the `order_types` dictionary - however, this is not advised.
|
||||||
|
|
||||||
### Understand order_time_in_force
|
### Understand order_time_in_force
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ You can use "current" market data by using the [dataprovider](strategy-customiza
|
|||||||
|
|
||||||
### Is there a setting to only SELL the coins being held and not perform anymore BUYS?
|
### Is there a setting to only SELL the coins being held and not perform anymore BUYS?
|
||||||
|
|
||||||
You can use the `/stopbuy` command in Telegram to prevent future buys, followed by `/forceexit all` (sell all open trades).
|
You can use the `/stopbuy` command in Telegram to prevent future buys, followed by `/force_exit all` (sell all open trades).
|
||||||
|
|
||||||
### I want to run multiple bots on the same machine
|
### I want to run multiple bots on the same machine
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ python3 scripts/rest_client.py --config rest_config.json <command> [optional par
|
|||||||
| `locks` | Displays currently locked pairs.
|
| `locks` | Displays currently locked pairs.
|
||||||
| `delete_lock <lock_id>` | Deletes (disables) the lock by id.
|
| `delete_lock <lock_id>` | Deletes (disables) the lock by id.
|
||||||
| `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.
|
||||||
| `forceexit <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
|
| `force_exit <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
|
||||||
| `forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
|
| `force_exit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
|
||||||
| `forceenter <pair> [rate]` | Instantly enters the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
| `forceenter <pair> [rate]` | Instantly enters the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
||||||
| `forceenter <pair> <side> [rate]` | Instantly longs or shorts the given pair. Rate is optional. (`forcebuy_enable` must be set to True)
|
| `forceenter <pair> <side> [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.
|
| `performance` | Show performance of each finished trade grouped by pair.
|
||||||
|
@ -52,11 +52,11 @@ SELECT * FROM trades;
|
|||||||
## Fix trade still open after a manual exit on the exchange
|
## Fix trade still open after a manual exit on the exchange
|
||||||
|
|
||||||
!!! Warning
|
!!! Warning
|
||||||
Manually selling a pair on the exchange will not be detected by the bot and it will try to sell anyway. Whenever possible, forceexit <tradeid> should be used to accomplish the same thing.
|
Manually selling a pair on the exchange will not be detected by the bot and it will try to sell anyway. Whenever possible, force_exit <tradeid> should be used to accomplish the same thing.
|
||||||
It is strongly advised to backup your database file before making any manual changes.
|
It is strongly advised to backup your database file before making any manual changes.
|
||||||
|
|
||||||
!!! Note
|
!!! Note
|
||||||
This should not be necessary after /forceexit, as forceexit orders are closed automatically by the bot on the next iteration.
|
This should not be necessary after /force_exit, as force_exit orders are closed automatically by the bot on the next iteration.
|
||||||
|
|
||||||
```sql
|
```sql
|
||||||
UPDATE trades
|
UPDATE trades
|
||||||
|
@ -17,7 +17,7 @@ Those stoploss modes can be *on exchange* or *off exchange*.
|
|||||||
These modes can be configured with these values:
|
These modes can be configured with these values:
|
||||||
|
|
||||||
``` python
|
``` python
|
||||||
'emergencyexit': 'market',
|
'emergency_exit': 'market',
|
||||||
'stoploss_on_exchange': False
|
'stoploss_on_exchange': False
|
||||||
'stoploss_on_exchange_interval': 60,
|
'stoploss_on_exchange_interval': 60,
|
||||||
'stoploss_on_exchange_limit_ratio': 0.99
|
'stoploss_on_exchange_limit_ratio': 0.99
|
||||||
@ -52,17 +52,17 @@ The bot cannot do these every 5 seconds (at each iteration), otherwise it would
|
|||||||
So this parameter will tell the bot how often it should update the stoploss order. The default value is 60 (1 minute).
|
So this parameter will tell the bot how often it should update the stoploss order. The default value is 60 (1 minute).
|
||||||
This same logic will reapply a stoploss order on the exchange should you cancel it accidentally.
|
This same logic will reapply a stoploss order on the exchange should you cancel it accidentally.
|
||||||
|
|
||||||
### forceexit
|
### force_exit
|
||||||
|
|
||||||
`forceexit` is an optional value, which defaults to the same value as `exit` and is used when sending a `/forceexit` command from Telegram or from the Rest API.
|
`force_exit` is an optional value, which defaults to the same value as `exit` and is used when sending a `/force_exit` command from Telegram or from the Rest API.
|
||||||
|
|
||||||
### forceentry
|
### force_entry
|
||||||
|
|
||||||
`forceentry` is an optional value, which defaults to the same value as `entry` and is used when sending a `/forceentry` command from Telegram or from the Rest API.
|
`force_entry` is an optional value, which defaults to the same value as `entry` and is used when sending a `/force_entry` command from Telegram or from the Rest API.
|
||||||
|
|
||||||
### emergencyexit
|
### emergency_exit
|
||||||
|
|
||||||
`emergencyexit` is an optional value, which defaults to `market` and is used when creating stop loss on exchange orders fails.
|
`emergency_exit` is an optional value, which defaults to `market` and is used when creating stop loss on exchange orders fails.
|
||||||
The below is the default which is used if not changed in strategy or configuration file.
|
The below is the default which is used if not changed in strategy or configuration file.
|
||||||
|
|
||||||
Example from strategy file:
|
Example from strategy file:
|
||||||
@ -71,7 +71,7 @@ Example from strategy file:
|
|||||||
order_types = {
|
order_types = {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "market",
|
"emergency_exit": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
"stoploss_on_exchange": True,
|
"stoploss_on_exchange": True,
|
||||||
"stoploss_on_exchange_interval": 60,
|
"stoploss_on_exchange_interval": 60,
|
||||||
|
@ -351,9 +351,9 @@ After:
|
|||||||
order_types = {
|
order_types = {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "market",
|
"emergency_exit": "market",
|
||||||
"forceexit": "market",
|
"force_exit": "market",
|
||||||
"forceentry": "market",
|
"force_entry": "market",
|
||||||
"stoploss": "market",
|
"stoploss": "market",
|
||||||
"stoploss_on_exchange": false,
|
"stoploss_on_exchange": false,
|
||||||
"stoploss_on_exchange_interval": 60
|
"stoploss_on_exchange_interval": 60
|
||||||
|
@ -171,8 +171,8 @@ official commands. You can ask at any moment for help with `/help`.
|
|||||||
| `/locks` | Show currently locked pairs.
|
| `/locks` | Show currently locked pairs.
|
||||||
| `/unlock <pair or lock_id>` | Remove the lock for this pair (or for this lock id).
|
| `/unlock <pair or lock_id>` | Remove the lock for this pair (or for this lock id).
|
||||||
| `/profit [<n>]` | 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)
|
| `/profit [<n>]` | 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)
|
||||||
| `/forceexit <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
|
| `/force_exit <trade_id>` | Instantly exits the given trade (Ignoring `minimum_roi`).
|
||||||
| `/forceexit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
|
| `/force_exit all` | Instantly exits all open trades (Ignoring `minimum_roi`).
|
||||||
| `/forcelong <pair> [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True)
|
| `/forcelong <pair> [rate]` | Instantly buys the given pair. Rate is optional and only applies to limit orders. (`forcebuy_enable` must be set to True)
|
||||||
| `/forceshort <pair> [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)
|
| `/forceshort <pair> [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
|
| `/performance` | Show performance of each finished trade grouped by pair
|
||||||
@ -285,7 +285,7 @@ Starting capital is either taken from the `available_capital` setting, or calcul
|
|||||||
> **BINANCE:** Long ETH/BTC with limit `0.03400000` (`1.000000 ETH`, `225.290 USD`)
|
> **BINANCE:** 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).
|
Omitting the pair will open a query asking for the pair to trade (based on the current whitelist).
|
||||||
Trades crated through `/forceentry` will have the buy-tag of `forceentry`.
|
Trades crated through `/force_entry` will have the buy-tag of `force_entry`.
|
||||||
|
|
||||||
![Telegram force-buy screenshot](assets/telegram_forcebuy.png)
|
![Telegram force-buy screenshot](assets/telegram_forcebuy.png)
|
||||||
|
|
||||||
|
@ -94,8 +94,8 @@ def _validate_unlimited_amount(conf: Dict[str, Any]) -> None:
|
|||||||
:raise: OperationalException if config validation failed
|
:raise: OperationalException if config validation failed
|
||||||
"""
|
"""
|
||||||
if (not conf.get('edge', {}).get('enabled')
|
if (not conf.get('edge', {}).get('enabled')
|
||||||
and conf.get('max_open_trades') == float('inf')
|
and conf.get('max_open_trades') == float('inf')
|
||||||
and conf.get('stake_amount') == constants.UNLIMITED_STAKE_AMOUNT):
|
and conf.get('stake_amount') == constants.UNLIMITED_STAKE_AMOUNT):
|
||||||
raise OperationalException("`max_open_trades` and `stake_amount` cannot both be unlimited.")
|
raise OperationalException("`max_open_trades` and `stake_amount` cannot both be unlimited.")
|
||||||
|
|
||||||
|
|
||||||
@ -255,9 +255,9 @@ def _validate_order_types(conf: Dict[str, Any]) -> None:
|
|||||||
for o, n in [
|
for o, n in [
|
||||||
('buy', 'entry'),
|
('buy', 'entry'),
|
||||||
('sell', 'exit'),
|
('sell', 'exit'),
|
||||||
('emergencysell', 'emergencyexit'),
|
('emergencysell', 'emergency_exit'),
|
||||||
('forcesell', 'forceexit'),
|
('forcesell', 'force_exit'),
|
||||||
('forcebuy', 'forceentry'),
|
('forcebuy', 'force_entry'),
|
||||||
]:
|
]:
|
||||||
|
|
||||||
process_deprecated_setting(conf, 'order_types', o, 'order_types', n)
|
process_deprecated_setting(conf, 'order_types', o, 'order_types', n)
|
||||||
|
@ -216,9 +216,9 @@ CONF_SCHEMA = {
|
|||||||
'properties': {
|
'properties': {
|
||||||
'entry': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
'entry': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||||
'exit': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
'exit': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||||
'forceexit': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
'force_exit': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||||
'forceentry': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
'force_entry': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
|
||||||
'emergencyexit': {
|
'emergency_exit': {
|
||||||
'type': 'string',
|
'type': 'string',
|
||||||
'enum': ORDERTYPE_POSSIBILITIES,
|
'enum': ORDERTYPE_POSSIBILITIES,
|
||||||
'default': 'market'},
|
'default': 'market'},
|
||||||
|
@ -191,7 +191,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
# Check and handle any timed out open orders
|
# Check and handle any timed out open orders
|
||||||
self.check_handle_timedout()
|
self.check_handle_timedout()
|
||||||
|
|
||||||
# Protect from collisions with forceexit.
|
# Protect from collisions with force_exit.
|
||||||
# Without this, freqtrade my try to recreate stoploss_on_exchange orders
|
# Without this, freqtrade my try to recreate stoploss_on_exchange orders
|
||||||
# while exiting is in process, since telegram messages arrive in an different thread.
|
# while exiting is in process, since telegram messages arrive in an different thread.
|
||||||
with self._exit_lock:
|
with self._exit_lock:
|
||||||
@ -1379,7 +1379,7 @@ class FreqtradeBot(LoggingMixin):
|
|||||||
order_type = ordertype or self.strategy.order_types[exit_type]
|
order_type = ordertype or self.strategy.order_types[exit_type]
|
||||||
if exit_check.exit_type == ExitType.EMERGENCY_EXIT:
|
if exit_check.exit_type == ExitType.EMERGENCY_EXIT:
|
||||||
# Emergency sells (default to market!)
|
# Emergency sells (default to market!)
|
||||||
order_type = self.strategy.order_types.get("emergencyexit", "market")
|
order_type = self.strategy.order_types.get("emergency_exit", "market")
|
||||||
|
|
||||||
amount = self._safe_exit_amount(trade.pair, trade.amount)
|
amount = self._safe_exit_amount(trade.pair, trade.amount)
|
||||||
time_in_force = self.strategy.order_time_in_force['exit']
|
time_in_force = self.strategy.order_time_in_force['exit']
|
||||||
|
@ -140,9 +140,9 @@ class UnfilledTimeout(BaseModel):
|
|||||||
class OrderTypes(BaseModel):
|
class OrderTypes(BaseModel):
|
||||||
entry: OrderTypeValues
|
entry: OrderTypeValues
|
||||||
exit: OrderTypeValues
|
exit: OrderTypeValues
|
||||||
emergencyexit: Optional[OrderTypeValues]
|
emergency_exit: Optional[OrderTypeValues]
|
||||||
forceexit: Optional[OrderTypeValues]
|
force_exit: Optional[OrderTypeValues]
|
||||||
forceentry: Optional[OrderTypeValues]
|
force_entry: Optional[OrderTypeValues]
|
||||||
stoploss: OrderTypeValues
|
stoploss: OrderTypeValues
|
||||||
stoploss_on_exchange: bool
|
stoploss_on_exchange: bool
|
||||||
stoploss_on_exchange_interval: Optional[int]
|
stoploss_on_exchange_interval: Optional[int]
|
||||||
@ -316,7 +316,7 @@ class ForceEnterPayload(BaseModel):
|
|||||||
entry_tag: Optional[str]
|
entry_tag: Optional[str]
|
||||||
|
|
||||||
|
|
||||||
class ForceExitPayload(BaseModel):
|
class Force_exitPayload(BaseModel):
|
||||||
tradeid: str
|
tradeid: str
|
||||||
ordertype: Optional[OrderTypeValues]
|
ordertype: Optional[OrderTypeValues]
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ from freqtrade.rpc import RPC
|
|||||||
from freqtrade.rpc.api_server.api_schemas import (AvailablePairs, Balances, BlacklistPayload,
|
from freqtrade.rpc.api_server.api_schemas import (AvailablePairs, Balances, BlacklistPayload,
|
||||||
BlacklistResponse, Count, Daily,
|
BlacklistResponse, Count, Daily,
|
||||||
DeleteLockRequest, DeleteTrade, ForceEnterPayload,
|
DeleteLockRequest, DeleteTrade, ForceEnterPayload,
|
||||||
ForceEnterResponse, ForceExitPayload, Health,
|
ForceEnterResponse, Force_exitPayload, Health,
|
||||||
Locks, Logs, OpenTradeSchema, PairHistory,
|
Locks, Logs, OpenTradeSchema, PairHistory,
|
||||||
PerformanceEntry, Ping, PlotConfig, Profit,
|
PerformanceEntry, Ping, PlotConfig, Profit,
|
||||||
ResultMsg, ShowConfig, Stats, StatusMsg,
|
ResultMsg, ShowConfig, Stats, StatusMsg,
|
||||||
@ -135,13 +135,13 @@ def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(g
|
|||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
# /forcebuy is deprecated with short addition. use ForceEntry instead
|
# /forcebuy is deprecated with short addition. use Force_entry instead
|
||||||
@router.post('/forceenter', response_model=ForceEnterResponse, tags=['trading'])
|
@router.post('/forceenter', response_model=ForceEnterResponse, tags=['trading'])
|
||||||
@router.post('/forcebuy', response_model=ForceEnterResponse, tags=['trading'])
|
@router.post('/forcebuy', response_model=ForceEnterResponse, tags=['trading'])
|
||||||
def forceentry(payload: ForceEnterPayload, rpc: RPC = Depends(get_rpc)):
|
def force_entry(payload: ForceEnterPayload, rpc: RPC = Depends(get_rpc)):
|
||||||
ordertype = payload.ordertype.value if payload.ordertype else None
|
ordertype = payload.ordertype.value if payload.ordertype else None
|
||||||
stake_amount = payload.stakeamount if payload.stakeamount else None
|
stake_amount = payload.stakeamount if payload.stakeamount else None
|
||||||
entry_tag = payload.entry_tag if payload.entry_tag else 'forceentry'
|
entry_tag = payload.entry_tag if payload.entry_tag else 'force_entry'
|
||||||
|
|
||||||
trade = rpc._rpc_force_entry(payload.pair, payload.price, order_side=payload.side,
|
trade = rpc._rpc_force_entry(payload.pair, payload.price, order_side=payload.side,
|
||||||
order_type=ordertype, stake_amount=stake_amount,
|
order_type=ordertype, stake_amount=stake_amount,
|
||||||
@ -154,11 +154,11 @@ def forceentry(payload: ForceEnterPayload, rpc: RPC = Depends(get_rpc)):
|
|||||||
{"status": f"Error entering {payload.side} trade for pair {payload.pair}."})
|
{"status": f"Error entering {payload.side} trade for pair {payload.pair}."})
|
||||||
|
|
||||||
|
|
||||||
@router.post('/forceexit', response_model=ResultMsg, tags=['trading'])
|
@router.post('/force_exit', response_model=ResultMsg, tags=['trading'])
|
||||||
@router.post('/forcesell', response_model=ResultMsg, tags=['trading'])
|
@router.post('/forcesell', response_model=ResultMsg, tags=['trading'])
|
||||||
def forcesell(payload: ForceExitPayload, rpc: RPC = Depends(get_rpc)):
|
def forcesell(payload: Force_exitPayload, rpc: RPC = Depends(get_rpc)):
|
||||||
ordertype = payload.ordertype.value if payload.ordertype else None
|
ordertype = payload.ordertype.value if payload.ordertype else None
|
||||||
return rpc._rpc_forceexit(payload.tradeid, ordertype)
|
return rpc._rpc_force_exit(payload.tradeid, ordertype)
|
||||||
|
|
||||||
|
|
||||||
@router.get('/blacklist', response_model=BlacklistResponse, tags=['info', 'pairlist'])
|
@router.get('/blacklist', response_model=BlacklistResponse, tags=['info', 'pairlist'])
|
||||||
|
@ -684,7 +684,7 @@ class RPC:
|
|||||||
|
|
||||||
return {'status': 'No more buy will occur from now. Run /reload_config to reset.'}
|
return {'status': 'No more buy will occur from now. Run /reload_config to reset.'}
|
||||||
|
|
||||||
def _rpc_forceexit(self, trade_id: str, ordertype: Optional[str] = None) -> Dict[str, str]:
|
def _rpc_force_exit(self, trade_id: str, ordertype: Optional[str] = None) -> Dict[str, str]:
|
||||||
"""
|
"""
|
||||||
Handler for forcesell <id>.
|
Handler for forcesell <id>.
|
||||||
Sells the given trade at current price
|
Sells the given trade at current price
|
||||||
@ -709,7 +709,7 @@ class RPC:
|
|||||||
trade.pair, side='exit', is_short=trade.is_short, refresh=True)
|
trade.pair, side='exit', is_short=trade.is_short, refresh=True)
|
||||||
exit_check = ExitCheckTuple(exit_type=ExitType.FORCE_EXIT)
|
exit_check = ExitCheckTuple(exit_type=ExitType.FORCE_EXIT)
|
||||||
order_type = ordertype or self._freqtrade.strategy.order_types.get(
|
order_type = ordertype or self._freqtrade.strategy.order_types.get(
|
||||||
"forceexit", self._freqtrade.strategy.order_types["exit"])
|
"force_exit", self._freqtrade.strategy.order_types["exit"])
|
||||||
|
|
||||||
self._freqtrade.execute_trade_exit(
|
self._freqtrade.execute_trade_exit(
|
||||||
trade, current_rate, exit_check, ordertype=order_type)
|
trade, current_rate, exit_check, ordertype=order_type)
|
||||||
@ -732,7 +732,7 @@ class RPC:
|
|||||||
trade_filter=[Trade.id == trade_id, Trade.is_open.is_(True), ]
|
trade_filter=[Trade.id == trade_id, Trade.is_open.is_(True), ]
|
||||||
).first()
|
).first()
|
||||||
if not trade:
|
if not trade:
|
||||||
logger.warning('forceexit: Invalid argument received')
|
logger.warning('force_exit: Invalid argument received')
|
||||||
raise RPCException('invalid argument')
|
raise RPCException('invalid argument')
|
||||||
|
|
||||||
_exec_forcesell(trade)
|
_exec_forcesell(trade)
|
||||||
@ -744,14 +744,14 @@ class RPC:
|
|||||||
order_type: Optional[str] = None,
|
order_type: Optional[str] = None,
|
||||||
order_side: SignalDirection = SignalDirection.LONG,
|
order_side: SignalDirection = SignalDirection.LONG,
|
||||||
stake_amount: Optional[float] = None,
|
stake_amount: Optional[float] = None,
|
||||||
enter_tag: Optional[str] = 'forceentry') -> Optional[Trade]:
|
enter_tag: Optional[str] = 'force_entry') -> Optional[Trade]:
|
||||||
"""
|
"""
|
||||||
Handler for forcebuy <asset> <price>
|
Handler for forcebuy <asset> <price>
|
||||||
Buys a pair trade at the given or current price
|
Buys a pair trade at the given or current price
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if not self._freqtrade.config.get('forcebuy_enable', False):
|
if not self._freqtrade.config.get('forcebuy_enable', False):
|
||||||
raise RPCException('Forceentry not enabled.')
|
raise RPCException('Force_entry not enabled.')
|
||||||
|
|
||||||
if self._freqtrade.state != State.RUNNING:
|
if self._freqtrade.state != State.RUNNING:
|
||||||
raise RPCException('trader is not running')
|
raise RPCException('trader is not running')
|
||||||
@ -781,7 +781,7 @@ class RPC:
|
|||||||
# execute buy
|
# execute buy
|
||||||
if not order_type:
|
if not order_type:
|
||||||
order_type = self._freqtrade.strategy.order_types.get(
|
order_type = self._freqtrade.strategy.order_types.get(
|
||||||
'forceentry', self._freqtrade.strategy.order_types['entry'])
|
'force_entry', self._freqtrade.strategy.order_types['entry'])
|
||||||
if self._freqtrade.execute_entry(pair, stake_amount, price,
|
if self._freqtrade.execute_entry(pair, stake_amount, price,
|
||||||
ordertype=order_type, trade=trade,
|
ordertype=order_type, trade=trade,
|
||||||
is_short=is_short,
|
is_short=is_short,
|
||||||
|
@ -153,7 +153,7 @@ class Telegram(RPCHandler):
|
|||||||
CommandHandler('balance', self._balance),
|
CommandHandler('balance', self._balance),
|
||||||
CommandHandler('start', self._start),
|
CommandHandler('start', self._start),
|
||||||
CommandHandler('stop', self._stop),
|
CommandHandler('stop', self._stop),
|
||||||
CommandHandler(['forcesell', 'forceexit'], self._forceexit),
|
CommandHandler(['forcesell', 'force_exit'], self._force_exit),
|
||||||
CommandHandler(['forcebuy', 'forcelong'], partial(
|
CommandHandler(['forcebuy', 'forcelong'], partial(
|
||||||
self._forceenter, order_side=SignalDirection.LONG)),
|
self._forceenter, order_side=SignalDirection.LONG)),
|
||||||
CommandHandler('forceshort', partial(
|
CommandHandler('forceshort', partial(
|
||||||
@ -926,7 +926,7 @@ class Telegram(RPCHandler):
|
|||||||
self._send_msg('Status: `{status}`'.format(**msg))
|
self._send_msg('Status: `{status}`'.format(**msg))
|
||||||
|
|
||||||
@authorized_only
|
@authorized_only
|
||||||
def _forceexit(self, update: Update, context: CallbackContext) -> None:
|
def _force_exit(self, update: Update, context: CallbackContext) -> None:
|
||||||
"""
|
"""
|
||||||
Handler for /forcesell <id>.
|
Handler for /forcesell <id>.
|
||||||
Sells the given trade at current price
|
Sells the given trade at current price
|
||||||
@ -940,8 +940,8 @@ class Telegram(RPCHandler):
|
|||||||
self._send_msg("You must specify a trade-id or 'all'.")
|
self._send_msg("You must specify a trade-id or 'all'.")
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
msg = self._rpc._rpc_forceexit(trade_id)
|
msg = self._rpc._rpc_force_exit(trade_id)
|
||||||
self._send_msg('Forceexit Result: `{result}`'.format(**msg))
|
self._send_msg('Force_exit Result: `{result}`'.format(**msg))
|
||||||
|
|
||||||
except RPCException as e:
|
except RPCException as e:
|
||||||
self._send_msg(str(e))
|
self._send_msg(str(e))
|
||||||
@ -1373,7 +1373,7 @@ class Telegram(RPCHandler):
|
|||||||
"*/start:* `Starts the trader`\n"
|
"*/start:* `Starts the trader`\n"
|
||||||
"*/stop:* Stops the trader\n"
|
"*/stop:* Stops the trader\n"
|
||||||
"*/stopbuy:* `Stops buying, but handles open trades gracefully` \n"
|
"*/stopbuy:* `Stops buying, but handles open trades gracefully` \n"
|
||||||
"*/forceexit <trade_id>|all:* `Instantly exits the given trade or all trades, "
|
"*/force_exit <trade_id>|all:* `Instantly exits the given trade or all trades, "
|
||||||
"regardless of profit`\n"
|
"regardless of profit`\n"
|
||||||
f"{forceenter_text if self._config.get('forcebuy_enable', False) else ''}"
|
f"{forceenter_text if self._config.get('forcebuy_enable', False) else ''}"
|
||||||
"*/delete <trade_id>:* `Instantly delete the given trade in the database`\n"
|
"*/delete <trade_id>:* `Instantly delete the given trade in the database`\n"
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
"order_types": {
|
"order_types": {
|
||||||
"entry": "limit",
|
"entry": "limit",
|
||||||
"exit": "limit",
|
"exit": "limit",
|
||||||
"emergencyexit": "limit",
|
"emergency_exit": "limit",
|
||||||
"stoploss": "limit",
|
"stoploss": "limit",
|
||||||
"stoploss_on_exchange": false
|
"stoploss_on_exchange": false
|
||||||
},
|
},
|
||||||
|
@ -1077,13 +1077,13 @@ def test_api_whitelist(botclient):
|
|||||||
'forcebuy',
|
'forcebuy',
|
||||||
'forceenter',
|
'forceenter',
|
||||||
])
|
])
|
||||||
def test_api_forceentry(botclient, mocker, fee, endpoint):
|
def test_api_force_entry(botclient, mocker, fee, endpoint):
|
||||||
ftbot, client = botclient
|
ftbot, client = botclient
|
||||||
|
|
||||||
rc = client_post(client, f"{BASE_URI}/{endpoint}",
|
rc = client_post(client, f"{BASE_URI}/{endpoint}",
|
||||||
data='{"pair": "ETH/BTC"}')
|
data='{"pair": "ETH/BTC"}')
|
||||||
assert_response(rc, 502)
|
assert_response(rc, 502)
|
||||||
assert rc.json() == {"error": f"Error querying /api/v1/{endpoint}: Forceentry not enabled."}
|
assert rc.json() == {"error": f"Error querying /api/v1/{endpoint}: Force_entry not enabled."}
|
||||||
|
|
||||||
# enable forcebuy
|
# enable forcebuy
|
||||||
ftbot.config['forcebuy_enable'] = True
|
ftbot.config['forcebuy_enable'] = True
|
||||||
|
@ -95,7 +95,7 @@ def test_telegram_init(default_conf, mocker, caplog) -> None:
|
|||||||
|
|
||||||
message_str = ("rpc.telegram is listening for following commands: [['status'], ['profit'], "
|
message_str = ("rpc.telegram is listening for following commands: [['status'], ['profit'], "
|
||||||
"['balance'], ['start'], ['stop'], "
|
"['balance'], ['start'], ['stop'], "
|
||||||
"['forcesell', 'forceexit'], ['forcebuy', 'forcelong'], ['forceshort'], "
|
"['forcesell', 'force_exit'], ['forcebuy', 'forcelong'], ['forceshort'], "
|
||||||
"['trades'], ['delete'], ['performance'], "
|
"['trades'], ['delete'], ['performance'], "
|
||||||
"['buys', 'entries'], ['sells', 'exits'], ['mix_tags'], "
|
"['buys', 'entries'], ['sells', 'exits'], ['mix_tags'], "
|
||||||
"['stats'], ['daily'], ['weekly'], ['monthly'], "
|
"['stats'], ['daily'], ['weekly'], ['monthly'], "
|
||||||
@ -1035,7 +1035,7 @@ def test_telegram_forcesell_handle(default_conf, update, ticker, fee,
|
|||||||
# /forcesell 1
|
# /forcesell 1
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = ["1"]
|
context.args = ["1"]
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
|
|
||||||
assert msg_mock.call_count == 4
|
assert msg_mock.call_count == 4
|
||||||
last_msg = msg_mock.call_args_list[-2][0][0]
|
last_msg = msg_mock.call_args_list[-2][0][0]
|
||||||
@ -1103,7 +1103,7 @@ def test_telegram_forcesell_down_handle(default_conf, update, ticker, fee,
|
|||||||
# /forcesell 1
|
# /forcesell 1
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = ["1"]
|
context.args = ["1"]
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
|
|
||||||
assert msg_mock.call_count == 4
|
assert msg_mock.call_count == 4
|
||||||
|
|
||||||
@ -1162,7 +1162,7 @@ def test_forcesell_all_handle(default_conf, update, ticker, fee, mocker) -> None
|
|||||||
# /forcesell all
|
# /forcesell all
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = ["all"]
|
context.args = ["all"]
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
|
|
||||||
# Called for each trade 2 times
|
# Called for each trade 2 times
|
||||||
assert msg_mock.call_count == 8
|
assert msg_mock.call_count == 8
|
||||||
@ -1207,7 +1207,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
# /forcesell 1
|
# /forcesell 1
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = ["1"]
|
context.args = ["1"]
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert 'not running' in msg_mock.call_args_list[0][0][0]
|
assert 'not running' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
@ -1216,7 +1216,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
freqtradebot.state = State.RUNNING
|
freqtradebot.state = State.RUNNING
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = []
|
context.args = []
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert "You must specify a trade-id or 'all'." in msg_mock.call_args_list[0][0][0]
|
assert "You must specify a trade-id or 'all'." in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
@ -1226,7 +1226,7 @@ def test_forcesell_handle_invalid(default_conf, update, mocker) -> None:
|
|||||||
# /forcesell 123456
|
# /forcesell 123456
|
||||||
context = MagicMock()
|
context = MagicMock()
|
||||||
context.args = ["123456"]
|
context.args = ["123456"]
|
||||||
telegram._forceexit(update=update, context=context)
|
telegram._force_exit(update=update, context=context)
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert 'invalid argument' in msg_mock.call_args_list[0][0][0]
|
assert 'invalid argument' in msg_mock.call_args_list[0][0][0]
|
||||||
|
|
||||||
@ -1274,7 +1274,7 @@ def test_forceenter_handle_exception(default_conf, update, mocker) -> None:
|
|||||||
telegram._forceenter(update=update, context=MagicMock(), order_side=SignalDirection.LONG)
|
telegram._forceenter(update=update, context=MagicMock(), order_side=SignalDirection.LONG)
|
||||||
|
|
||||||
assert msg_mock.call_count == 1
|
assert msg_mock.call_count == 1
|
||||||
assert msg_mock.call_args_list[0][0][0] == 'Forceentry not enabled.'
|
assert msg_mock.call_args_list[0][0][0] == 'Force_entry not enabled.'
|
||||||
|
|
||||||
|
|
||||||
def test_forceenter_no_pair(default_conf, update, mocker) -> None:
|
def test_forceenter_no_pair(default_conf, update, mocker) -> None:
|
||||||
|
@ -977,7 +977,7 @@ def test__validate_order_types(default_conf, caplog) -> None:
|
|||||||
assert log_has_re(r"DEPRECATED: Using 'buy' and 'sell' for order_types is.*", caplog)
|
assert log_has_re(r"DEPRECATED: Using 'buy' and 'sell' for order_types is.*", caplog)
|
||||||
assert conf['order_types']['entry'] == 'limit'
|
assert conf['order_types']['entry'] == 'limit'
|
||||||
assert conf['order_types']['exit'] == 'market'
|
assert conf['order_types']['exit'] == 'market'
|
||||||
assert conf['order_types']['forceentry'] == 'limit'
|
assert conf['order_types']['force_entry'] == 'limit'
|
||||||
assert 'buy' not in conf['order_types']
|
assert 'buy' not in conf['order_types']
|
||||||
assert 'sell' not in conf['order_types']
|
assert 'sell' not in conf['order_types']
|
||||||
assert 'forcebuy' not in conf['order_types']
|
assert 'forcebuy' not in conf['order_types']
|
||||||
|
Loading…
Reference in New Issue
Block a user