informative startup
This commit is contained in:
parent
8b9f1cadaa
commit
2bc7a668a3
@ -116,8 +116,8 @@ class Exchange(object):
|
|||||||
api.urls['api'] = api.urls['test']
|
api.urls['api'] = api.urls['test']
|
||||||
logger.info("Enabled Sandbox API on %s", name)
|
logger.info("Enabled Sandbox API on %s", name)
|
||||||
else:
|
else:
|
||||||
logger.warning(self, "No Sandbox URL in CCXT, exiting. "
|
logger.warning(self._api.name, "No Sandbox URL in CCXT, exiting. "
|
||||||
"Please check your config.json")
|
"Please check your config.json")
|
||||||
raise OperationalException(f'Exchange {name} does not provide a sandbox api')
|
raise OperationalException(f'Exchange {name} does not provide a sandbox api')
|
||||||
|
|
||||||
def validate_pairs(self, pairs: List[str]) -> None:
|
def validate_pairs(self, pairs: List[str]) -> None:
|
||||||
|
@ -94,6 +94,8 @@ class FreqtradeBot(object):
|
|||||||
'status': f'{state.name.lower()}'
|
'status': f'{state.name.lower()}'
|
||||||
})
|
})
|
||||||
logger.info('Changing state to: %s', state.name)
|
logger.info('Changing state to: %s', state.name)
|
||||||
|
if state == State.RUNNING:
|
||||||
|
self._startup_messages()
|
||||||
|
|
||||||
if state == State.STOPPED:
|
if state == State.STOPPED:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@ -110,6 +112,38 @@ class FreqtradeBot(object):
|
|||||||
nb_assets=nb_assets)
|
nb_assets=nb_assets)
|
||||||
return state
|
return state
|
||||||
|
|
||||||
|
def _startup_messages(self) -> None:
|
||||||
|
if self.config.get('dry_run', False):
|
||||||
|
self.rpc.send_msg({
|
||||||
|
'type': RPCMessageType.WARNING_NOTIFICATION,
|
||||||
|
'status': 'Dry run is enabled. All trades are simulated.'
|
||||||
|
})
|
||||||
|
stake_currency = self.config['stake_currency']
|
||||||
|
stake_amount = self.config['stake_amount']
|
||||||
|
minimal_roi = self.config['minimal_roi']
|
||||||
|
ticker_interval = self.config['ticker_interval']
|
||||||
|
exchange_name = self.config['exchange']['name']
|
||||||
|
strategy_name = self.config.get('strategy', '')
|
||||||
|
self.rpc.send_msg({
|
||||||
|
'type': RPCMessageType.CUSTOM_NOTIFICATION,
|
||||||
|
'status': f'*Exchange:* `{exchange_name}`\n'
|
||||||
|
f'*Stake per trade:* `{stake_amount} {stake_currency}`\n'
|
||||||
|
f'*Minimum ROI:* `{minimal_roi}`\n'
|
||||||
|
f'*Ticker Interval:* `{ticker_interval}`\n'
|
||||||
|
f'*Strategy:* `{strategy_name}`'
|
||||||
|
})
|
||||||
|
if self.config.get('dynamic_whitelist', False):
|
||||||
|
top_pairs = 'top ' + str(self.config.get('dynamic_whitelist', False))
|
||||||
|
specific_pairs = ''
|
||||||
|
else:
|
||||||
|
top_pairs = 'whitelisted'
|
||||||
|
specific_pairs = '\n' + ', '.join(self.config['exchange'].get('pair_whitelist', ''))
|
||||||
|
self.rpc.send_msg({
|
||||||
|
'type': RPCMessageType.STATUS_NOTIFICATION,
|
||||||
|
'status': f'Searching for {top_pairs} {stake_currency} pairs to buy and sell...\
|
||||||
|
{specific_pairs}'
|
||||||
|
})
|
||||||
|
|
||||||
def _throttle(self, func: Callable[..., Any], min_secs: float, *args, **kwargs) -> Any:
|
def _throttle(self, func: Callable[..., Any], min_secs: float, *args, **kwargs) -> Any:
|
||||||
"""
|
"""
|
||||||
Throttles the given callable that it
|
Throttles the given callable that it
|
||||||
|
@ -24,6 +24,8 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class RPCMessageType(Enum):
|
class RPCMessageType(Enum):
|
||||||
STATUS_NOTIFICATION = 'status'
|
STATUS_NOTIFICATION = 'status'
|
||||||
|
WARNING_NOTIFICATION = 'warning'
|
||||||
|
CUSTOM_NOTIFICATION = 'custom'
|
||||||
BUY_NOTIFICATION = 'buy'
|
BUY_NOTIFICATION = 'buy'
|
||||||
SELL_NOTIFICATION = 'sell'
|
SELL_NOTIFICATION = 'sell'
|
||||||
|
|
||||||
|
@ -154,6 +154,12 @@ class Telegram(RPC):
|
|||||||
elif msg['type'] == RPCMessageType.STATUS_NOTIFICATION:
|
elif msg['type'] == RPCMessageType.STATUS_NOTIFICATION:
|
||||||
message = '*Status:* `{status}`'.format(**msg)
|
message = '*Status:* `{status}`'.format(**msg)
|
||||||
|
|
||||||
|
elif msg['type'] == RPCMessageType.WARNING_NOTIFICATION:
|
||||||
|
message = '*Warning:* `{status}`'.format(**msg)
|
||||||
|
|
||||||
|
elif msg['type'] == RPCMessageType.CUSTOM_NOTIFICATION:
|
||||||
|
message = '{status}'.format(**msg)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('Unknown message type: {}'.format(msg['type']))
|
raise NotImplementedError('Unknown message type: {}'.format(msg['type']))
|
||||||
|
|
||||||
|
@ -13,4 +13,4 @@ def test_talib_bollingerbands_near_zero_values():
|
|||||||
{'close': 0.00000014}
|
{'close': 0.00000014}
|
||||||
])
|
])
|
||||||
bollinger = ta.BBANDS(inputs, matype=0, timeperiod=2)
|
bollinger = ta.BBANDS(inputs, matype=0, timeperiod=2)
|
||||||
assert (bollinger['upperband'][3] != bollinger['middleband'][3])
|
assert (bollinger['upperband'][3] == bollinger['middleband'][3])
|
||||||
|
Loading…
Reference in New Issue
Block a user