Enhance /show_config endpoint

This commit is contained in:
Matthias 2021-11-06 16:12:25 +01:00
parent fef7da03b2
commit 25fcab0794
4 changed files with 32 additions and 2 deletions

View File

@ -207,7 +207,10 @@ CONF_SCHEMA = {
'sell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
'forcesell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
'forcebuy': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
'emergencysell': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
'emergencysell': {
'type': 'string',
'enum': ORDERTYPE_POSSIBILITIES,
'default': 'market'},
'stoploss': {'type': 'string', 'enum': ORDERTYPE_POSSIBILITIES},
'stoploss_on_exchange': {'type': 'boolean'},
'stoploss_on_exchange_interval': {'type': 'number'},

View File

@ -123,7 +123,26 @@ class Daily(BaseModel):
stake_currency: str
class UnfilledTimeout(BaseModel):
buy: int
sell: int
unit: str
exit_timeout_count: Optional[int]
class OrderTypes(BaseModel):
buy: str
sell: str
emergencysell: Optional[str]
forcesell: Optional[str]
forcebuy: Optional[str]
stoploss: str
stoploss_on_exchange: bool
stoploss_on_exchange_interval: Optional[int]
class ShowConfig(BaseModel):
version: str
dry_run: bool
stake_currency: str
stake_amount: Union[float, str]
@ -136,6 +155,8 @@ class ShowConfig(BaseModel):
trailing_stop_positive: Optional[float]
trailing_stop_positive_offset: Optional[float]
trailing_only_offset_is_reached: Optional[bool]
unfilledtimeout: UnfilledTimeout
order_types: OrderTypes
use_custom_stoploss: Optional[bool]
timeframe: Optional[str]
timeframe_ms: int

View File

@ -13,6 +13,7 @@ from dateutil.relativedelta import relativedelta
from numpy import NAN, inf, int64, mean
from pandas import DataFrame
from freqtrade import __version__
from freqtrade.configuration.timerange import TimeRange
from freqtrade.constants import CANCEL_REASON, DATETIME_PRINT_FORMAT
from freqtrade.data.history import load_data
@ -104,6 +105,7 @@ class RPC:
information via rpc.
"""
val = {
'version': __version__,
'dry_run': config['dry_run'],
'stake_currency': config['stake_currency'],
'stake_currency_decimals': decimals_per_coin(config['stake_currency']),
@ -117,7 +119,9 @@ class RPC:
'trailing_stop_positive': config.get('trailing_stop_positive'),
'trailing_stop_positive_offset': config.get('trailing_stop_positive_offset'),
'trailing_only_offset_is_reached': config.get('trailing_only_offset_is_reached'),
'unfilledtimeout': config.get('unfilledtimeout'),
'use_custom_stoploss': config.get('use_custom_stoploss'),
'order_types': config.get('order_types'),
'bot_name': config.get('bot_name', 'freqtrade'),
'timeframe': config.get('timeframe'),
'timeframe_ms': timeframe_to_msecs(config['timeframe']

View File

@ -520,7 +520,7 @@ def test_api_locks(botclient):
assert rc.json()['lock_count'] == 0
def test_api_show_config(botclient, mocker):
def test_api_show_config(botclient):
ftbot, client = botclient
patch_get_signal(ftbot)
@ -536,6 +536,8 @@ def test_api_show_config(botclient, mocker):
assert not rc.json()['trailing_stop']
assert 'bid_strategy' in rc.json()
assert 'ask_strategy' in rc.json()
assert 'unfilledtimeout' in rc.json()
assert 'version' in rc.json()
def test_api_daily(botclient, mocker, ticker, fee, markets):