Merge pull request #3264 from freqtrade/api_improvements

Api improvements
This commit is contained in:
hroff-1902 2020-05-07 00:05:36 +03:00 committed by GitHub
commit 06313cdddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 1 deletions

View File

@ -94,6 +94,7 @@ class RPC:
'dry_run': config['dry_run'], 'dry_run': config['dry_run'],
'stake_currency': config['stake_currency'], 'stake_currency': config['stake_currency'],
'stake_amount': config['stake_amount'], 'stake_amount': config['stake_amount'],
'max_open_trades': config['max_open_trades'],
'minimal_roi': config['minimal_roi'].copy(), 'minimal_roi': config['minimal_roi'].copy(),
'stoploss': config['stoploss'], 'stoploss': config['stoploss'],
'trailing_stop': config['trailing_stop'], 'trailing_stop': config['trailing_stop'],
@ -103,6 +104,7 @@ class RPC:
'ticker_interval': config['ticker_interval'], 'ticker_interval': config['ticker_interval'],
'exchange': config['exchange']['name'], 'exchange': config['exchange']['name'],
'strategy': config['strategy'], 'strategy': config['strategy'],
'state': str(self._freqtrade.state)
} }
return val return val

View File

@ -621,10 +621,12 @@ class Telegram(RPC):
f"*Mode:* `{'Dry-run' if val['dry_run'] else 'Live'}`\n" f"*Mode:* `{'Dry-run' if val['dry_run'] else 'Live'}`\n"
f"*Exchange:* `{val['exchange']}`\n" f"*Exchange:* `{val['exchange']}`\n"
f"*Stake per trade:* `{val['stake_amount']} {val['stake_currency']}`\n" f"*Stake per trade:* `{val['stake_amount']} {val['stake_currency']}`\n"
f"*Max open Trades:* `{val['max_open_trades']}`\n"
f"*Minimum ROI:* `{val['minimal_roi']}`\n" f"*Minimum ROI:* `{val['minimal_roi']}`\n"
f"{sl_info}" f"{sl_info}"
f"*Ticker Interval:* `{val['ticker_interval']}`\n" f"*Ticker Interval:* `{val['ticker_interval']}`\n"
f"*Strategy:* `{val['strategy']}`" f"*Strategy:* `{val['strategy']}`\n"
f"*Current state:* `{val['state']}`"
) )
def _send_msg(self, msg: str, parse_mode: ParseMode = ParseMode.MARKDOWN) -> None: def _send_msg(self, msg: str, parse_mode: ParseMode = ParseMode.MARKDOWN) -> None:

View File

@ -14,6 +14,9 @@ class State(Enum):
STOPPED = 2 STOPPED = 2
RELOAD_CONF = 3 RELOAD_CONF = 3
def __str__(self):
return f"{self.name.lower()}"
class RunMode(Enum): class RunMode(Enum):
""" """

View File

@ -283,6 +283,7 @@ def test_api_show_config(botclient, mocker):
assert 'dry_run' in rc.json assert 'dry_run' in rc.json
assert rc.json['exchange'] == 'bittrex' assert rc.json['exchange'] == 'bittrex'
assert rc.json['ticker_interval'] == '5m' assert rc.json['ticker_interval'] == '5m'
assert rc.json['state'] == 'running'
assert not rc.json['trailing_stop'] assert not rc.json['trailing_stop']