mirror of
https://github.com/freqtrade/freqtrade.git
synced 2026-01-28 18:00:23 +00:00
feat: add is_trading_mode api Depends
This commit is contained in:
@@ -6,6 +6,7 @@ from fastapi import Depends, HTTPException
|
||||
|
||||
from freqtrade.constants import Config
|
||||
from freqtrade.enums import RunMode
|
||||
from freqtrade.enums.runmode import TRADE_MODES
|
||||
from freqtrade.persistence import Trade
|
||||
from freqtrade.persistence.models import _request_id_ctx_var
|
||||
from freqtrade.rpc.api_server.webserver_bgwork import ApiBG
|
||||
@@ -69,3 +70,9 @@ def is_webserver_mode(config=Depends(get_config)):
|
||||
if config["runmode"] != RunMode.WEBSERVER:
|
||||
raise HTTPException(status_code=503, detail="Bot is not in the correct state.")
|
||||
return None
|
||||
|
||||
|
||||
def is_trading_mode(config=Depends(get_config)):
|
||||
if config["runmode"] not in TRADE_MODES:
|
||||
raise HTTPException(status_code=503, detail="Bot is not in the correct state.")
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user