add lines to show_config message

This commit is contained in:
Stefano Ariestasia 2022-01-20 10:03:26 +09:00
parent 2e537df358
commit 62ea1a445e
3 changed files with 20 additions and 2 deletions

View File

@ -379,7 +379,13 @@ class Backtesting:
# Check if we need to adjust our current positions
if self.strategy.position_adjustment_enable:
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
check_adjust_buy = True
if self.strategy.max_buy_position_adjustment > -1:
filled_buys = trade.select_filled_orders('buy')
count_of_buys = len(filled_buys)
check_adjust_buy = (count_of_buys <= self.strategy.max_buy_position_adjustment)
if check_adjust_buy:
trade = self._get_adjust_trade_entry_for_candle(trade, sell_row)
sell_candle_time = sell_row[DATE_IDX].to_pydatetime()
sell = self.strategy.should_sell(trade, sell_row[OPEN_IDX], # type: ignore

View File

@ -136,7 +136,10 @@ class RPC:
'ask_strategy': config.get('ask_strategy', {}),
'bid_strategy': config.get('bid_strategy', {}),
'state': str(botstate),
'runmode': config['runmode'].value
'runmode': config['runmode'].value,
'position_adjustment_enable': config.get('position_adjustment_enable', False),
'max_buy_position_adjustment': (config['max_buy_position_adjustment']
if config['max_buy_position_adjustment'] != float('inf') else -1)
}
return val

View File

@ -1347,6 +1347,14 @@ class Telegram(RPCHandler):
else:
sl_info = f"*Stoploss:* `{val['stoploss']}`\n"
if val['position_adjustment_enable']:
pa_info = (
f"*Position adjustment:* On\n"
f"*Max buy position adjustment:* `{val['max_buy_position_adjustment']}`\n"
)
else:
pa_info = f"*Position adjustment:* Off\n"
self._send_msg(
f"*Mode:* `{'Dry-run' if val['dry_run'] else 'Live'}`\n"
f"*Exchange:* `{val['exchange']}`\n"
@ -1356,6 +1364,7 @@ class Telegram(RPCHandler):
f"*Ask strategy:* ```\n{json.dumps(val['ask_strategy'])}```\n"
f"*Bid strategy:* ```\n{json.dumps(val['bid_strategy'])}```\n"
f"{sl_info}"
f"{pa_info}"
f"*Timeframe:* `{val['timeframe']}`\n"
f"*Strategy:* `{val['strategy']}`\n"
f"*Current state:* `{val['state']}`"