Add READ_ONLY_API environment variable and enhance trading error handling
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import os
|
||||
|
||||
from fastapi import APIRouter
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
@@ -10,6 +12,7 @@ router = APIRouter()
|
||||
async def health():
|
||||
ib_connected = False
|
||||
account = None
|
||||
trading_mode = os.getenv("TRADING_MODE", "unknown").split("#", 1)[0].strip() or "unknown"
|
||||
try:
|
||||
ib_inst = dependencies.get_ib()
|
||||
ib_connected = ib_inst.isConnected()
|
||||
@@ -30,6 +33,7 @@ async def health():
|
||||
{
|
||||
"status": "ok" if (ib_connected and db_ok) else "degraded",
|
||||
"ib_connected": ib_connected,
|
||||
"trading_mode": trading_mode,
|
||||
"account": account,
|
||||
"db_ok": db_ok,
|
||||
"version": "3.0",
|
||||
|
||||
Reference in New Issue
Block a user