mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-17 13:21:15 +00:00
fix: formating
This commit is contained in:
@@ -638,6 +638,7 @@ class Health(BaseModel):
|
|||||||
bot_startup: datetime | None = None
|
bot_startup: datetime | None = None
|
||||||
bot_startup_ts: int | None = None
|
bot_startup_ts: int | None = None
|
||||||
|
|
||||||
|
|
||||||
class ListCustomData(BaseModel):
|
class ListCustomData(BaseModel):
|
||||||
trade_id: int
|
trade_id: int
|
||||||
custom_data: list[dict[str, Any]]
|
custom_data: list[dict[str, Any]]
|
||||||
|
|||||||
@@ -510,6 +510,7 @@ def sysinfo():
|
|||||||
def health(rpc: RPC = Depends(get_rpc)):
|
def health(rpc: RPC = Depends(get_rpc)):
|
||||||
return rpc.health()
|
return rpc.health()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/trades/open/custom-data", response_model=list[ListCustomData], tags=["info"])
|
@router.get("/trades/open/custom-data", response_model=list[ListCustomData], tags=["info"])
|
||||||
def list_open_trades_custom_data(rpc: RPC = Depends(get_rpc)):
|
def list_open_trades_custom_data(rpc: RPC = Depends(get_rpc)):
|
||||||
"""
|
"""
|
||||||
@@ -517,6 +518,7 @@ def list_open_trades_custom_data(rpc: RPC = Depends(get_rpc)):
|
|||||||
"""
|
"""
|
||||||
return rpc._rpc_list_custom_data()
|
return rpc._rpc_list_custom_data()
|
||||||
|
|
||||||
|
|
||||||
@router.get("/trades/{trade_id}/custom-data", response_model=list[ListCustomData], tags=["info"])
|
@router.get("/trades/{trade_id}/custom-data", response_model=list[ListCustomData], tags=["info"])
|
||||||
def list_custom_data(trade_id: int, rpc: RPC = Depends(get_rpc)):
|
def list_custom_data(trade_id: int, rpc: RPC = Depends(get_rpc)):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1117,12 +1117,13 @@ class RPC:
|
|||||||
}
|
}
|
||||||
|
|
||||||
def _rpc_list_custom_data(
|
def _rpc_list_custom_data(
|
||||||
self, trade_id: int | None = None, key: str | None = None) -> list[dict[str, Any]]:
|
self, trade_id: int | None = None, key: str | None = None
|
||||||
|
) -> list[dict[str, Any]]:
|
||||||
"""
|
"""
|
||||||
Fetch custom data for a specific trade, or all open trades if `trade_id` is not provided.
|
Fetch custom data for a specific trade, or all open trades if `trade_id` is not provided.
|
||||||
"""
|
"""
|
||||||
if trade_id is None:
|
if trade_id is None:
|
||||||
#get all open trades
|
# get all open trades
|
||||||
trades = Trade.get_open_trades()
|
trades = Trade.get_open_trades()
|
||||||
else:
|
else:
|
||||||
trades = Trade.get_trades(trade_filter=[Trade.id == trade_id]).all()
|
trades = Trade.get_trades(trade_filter=[Trade.id == trade_id]).all()
|
||||||
|
|||||||
Reference in New Issue
Block a user