Merge pull request #3589 from freqtrade/api/timeframe_ms

[minor] Send timeframe min and ms in show_config response
This commit is contained in:
hroff-1902 2020-07-13 23:24:30 +03:00 committed by GitHub
commit 43a1fe6d08
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,8 @@ import arrow
from numpy import NAN, mean from numpy import NAN, mean
from freqtrade.exceptions import ExchangeError, PricingError from freqtrade.exceptions import ExchangeError, PricingError
from freqtrade.exchange import timeframe_to_msecs, timeframe_to_minutes
from freqtrade.misc import shorten_date from freqtrade.misc import shorten_date
from freqtrade.persistence import Trade from freqtrade.persistence import Trade
from freqtrade.rpc.fiat_convert import CryptoToFiatConverter from freqtrade.rpc.fiat_convert import CryptoToFiatConverter
@ -103,6 +105,8 @@ class RPC:
'trailing_only_offset_is_reached': config.get('trailing_only_offset_is_reached'), 'trailing_only_offset_is_reached': config.get('trailing_only_offset_is_reached'),
'ticker_interval': config['timeframe'], # DEPRECATED 'ticker_interval': config['timeframe'], # DEPRECATED
'timeframe': config['timeframe'], 'timeframe': config['timeframe'],
'timeframe_ms': timeframe_to_msecs(config['timeframe']),
'timeframe_min': timeframe_to_minutes(config['timeframe']),
'exchange': config['exchange']['name'], 'exchange': config['exchange']['name'],
'strategy': config['strategy'], 'strategy': config['strategy'],
'forcebuy_enabled': config.get('forcebuy_enable', False), 'forcebuy_enabled': config.get('forcebuy_enable', False),

View File

@ -326,6 +326,8 @@ def test_api_show_config(botclient, mocker):
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['timeframe'] == '5m' assert rc.json['timeframe'] == '5m'
assert rc.json['timeframe_ms'] == 300000
assert rc.json['timeframe_min'] == 5
assert rc.json['state'] == 'running' assert rc.json['state'] == 'running'
assert not rc.json['trailing_stop'] assert not rc.json['trailing_stop']
assert 'bid_strategy' in rc.json assert 'bid_strategy' in rc.json