Add api_version to botresponse
This commit is contained in:
parent
0d082f7b17
commit
b8cefd687e
@ -144,6 +144,7 @@ class OrderTypes(BaseModel):
|
|||||||
|
|
||||||
class ShowConfig(BaseModel):
|
class ShowConfig(BaseModel):
|
||||||
version: str
|
version: str
|
||||||
|
api_version: float
|
||||||
dry_run: bool
|
dry_run: bool
|
||||||
stake_currency: str
|
stake_currency: str
|
||||||
stake_amount: Union[float, str]
|
stake_amount: Union[float, str]
|
||||||
|
@ -26,6 +26,11 @@ from freqtrade.rpc.rpc import RPCException
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
# API version
|
||||||
|
# Pre-1.1, no version was provided
|
||||||
|
# Version increments should happen in "small" steps (1.1, 1.12, ...) unless big changes happen.
|
||||||
|
API_VERSION = 1.1
|
||||||
|
|
||||||
# Public API, requires no auth.
|
# Public API, requires no auth.
|
||||||
router_public = APIRouter()
|
router_public = APIRouter()
|
||||||
# Private API, protected by authentication
|
# Private API, protected by authentication
|
||||||
@ -117,7 +122,9 @@ def show_config(rpc: Optional[RPC] = Depends(get_rpc_optional), config=Depends(g
|
|||||||
state = ''
|
state = ''
|
||||||
if rpc:
|
if rpc:
|
||||||
state = rpc._freqtrade.state
|
state = rpc._freqtrade.state
|
||||||
return RPC._rpc_show_config(config, state)
|
resp = RPC._rpc_show_config(config, state)
|
||||||
|
resp['api_version'] = API_VERSION
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
@router.post('/forcebuy', response_model=ForceBuyResponse, tags=['trading'])
|
@router.post('/forcebuy', response_model=ForceBuyResponse, tags=['trading'])
|
||||||
|
@ -538,6 +538,8 @@ def test_api_show_config(botclient):
|
|||||||
assert 'ask_strategy' in rc.json()
|
assert 'ask_strategy' in rc.json()
|
||||||
assert 'unfilledtimeout' in rc.json()
|
assert 'unfilledtimeout' in rc.json()
|
||||||
assert 'version' in rc.json()
|
assert 'version' in rc.json()
|
||||||
|
assert 'api_version' in rc.json()
|
||||||
|
assert 1.1 <= rc.json()['api_version'] <= 1.2
|
||||||
|
|
||||||
|
|
||||||
def test_api_daily(botclient, mocker, ticker, fee, markets):
|
def test_api_daily(botclient, mocker, ticker, fee, markets):
|
||||||
|
Loading…
Reference in New Issue
Block a user