chore: Add proper typing to jobContainer response

This commit is contained in:
Matthias
2024-11-17 12:40:24 +01:00
parent dea785f562
commit d8a2c59b04
2 changed files with 9 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ from pydantic import (
from freqtrade.constants import DL_DATA_TIMEFRAMES, IntOrInf
from freqtrade.enums import MarginMode, OrderTypeValues, SignalDirection, TradingMode
from freqtrade.ft_types import ValidExchangesType
from freqtrade.rpc.api_server.webserver_bgwork import ProgressTask
class ExchangeModePayloadMixin(BaseModel):
@@ -50,7 +51,7 @@ class BackgroundTaskStatus(BaseModel):
status: str
running: bool
progress: float | None = None
progress_tasks: dict[str, Any] | None = None
progress_tasks: dict[str, ProgressTask] | None = None
error: str | None = None

View File

@@ -4,12 +4,18 @@ from uuid import uuid4
from freqtrade.exchange.exchange import Exchange
class ProgressTask(TypedDict):
progress: float
total: float
description: str
class JobsContainer(TypedDict):
category: Literal["pairlist", "download_data"]
is_running: bool
status: str
progress: float | None
progress_tasks: NotRequired[dict[str, Any]]
progress_tasks: NotRequired[dict[str, ProgressTask]]
result: Any
error: str | None