Merge branch 'develop' into feat/short
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
from datetime import date, datetime
|
||||
from enum import Enum
|
||||
from typing import Any, Dict, List, Optional, Union
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
from freqtrade.constants import DATETIME_PRINT_FORMAT
|
||||
from freqtrade.enums import OrderTypeValues
|
||||
|
||||
|
||||
class Ping(BaseModel):
|
||||
@@ -132,11 +132,6 @@ class UnfilledTimeout(BaseModel):
|
||||
exit_timeout_count: Optional[int]
|
||||
|
||||
|
||||
class OrderTypeValues(str, Enum):
|
||||
limit = 'limit'
|
||||
market = 'market'
|
||||
|
||||
|
||||
class OrderTypes(BaseModel):
|
||||
buy: OrderTypeValues
|
||||
sell: OrderTypeValues
|
||||
@@ -150,6 +145,7 @@ class OrderTypes(BaseModel):
|
||||
|
||||
class ShowConfig(BaseModel):
|
||||
version: str
|
||||
strategy_version: Optional[str]
|
||||
api_version: float
|
||||
dry_run: bool
|
||||
trading_mode: str
|
||||
|
@@ -122,9 +122,11 @@ def edge(rpc: RPC = Depends(get_rpc)):
|
||||
@router.get('/show_config', response_model=ShowConfig, tags=['info'])
|
||||
def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(get_config)):
|
||||
state = ''
|
||||
strategy_version = None
|
||||
if rpc:
|
||||
state = rpc._freqtrade.state
|
||||
resp = RPC._rpc_show_config(config, state)
|
||||
strategy_version = rpc._freqtrade.strategy.version()
|
||||
resp = RPC._rpc_show_config(config, state, strategy_version)
|
||||
resp['api_version'] = API_VERSION
|
||||
return resp
|
||||
|
||||
|
@@ -99,7 +99,8 @@ class RPC:
|
||||
self._fiat_converter = CryptoToFiatConverter()
|
||||
|
||||
@staticmethod
|
||||
def _rpc_show_config(config, botstate: Union[State, str]) -> Dict[str, Any]:
|
||||
def _rpc_show_config(config, botstate: Union[State, str],
|
||||
strategy_version: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""
|
||||
Return a dict of config options.
|
||||
Explicitly does NOT return the full config to avoid leakage of sensitive
|
||||
@@ -107,6 +108,7 @@ class RPC:
|
||||
"""
|
||||
val = {
|
||||
'version': __version__,
|
||||
'strategy_version': strategy_version,
|
||||
'dry_run': config['dry_run'],
|
||||
'trading_mode': config.get('trading_mode', 'spot'),
|
||||
'short_allowed': config.get('trading_mode', 'spot') != 'spot',
|
||||
|
@@ -1307,7 +1307,12 @@ class Telegram(RPCHandler):
|
||||
:param update: message update
|
||||
:return: None
|
||||
"""
|
||||
self._send_msg('*Version:* `{}`'.format(__version__))
|
||||
strategy_version = self._rpc._freqtrade.strategy.version()
|
||||
version_string = f'*Version:* `{__version__}`'
|
||||
if strategy_version is not None:
|
||||
version_string += f', *Strategy version: * `{strategy_version}`'
|
||||
|
||||
self._send_msg(version_string)
|
||||
|
||||
@authorized_only
|
||||
def _show_config(self, update: Update, context: CallbackContext) -> None:
|
||||
|
Reference in New Issue
Block a user