diff --git a/freqtrade/data/history/history_utils.py b/freqtrade/data/history/history_utils.py index 9a0686b7d..079ba1a97 100644 --- a/freqtrade/data/history/history_utils.py +++ b/freqtrade/data/history/history_utils.py @@ -328,7 +328,7 @@ def refresh_backtest_ohlcv_data( erase: bool = False, data_format: str | None = None, prepend: bool = False, - progress_tracker: Optional[ProgressLike] = None, + progress_tracker: ProgressLike | None = None, ) -> list[str]: """ Refresh stored ohlcv data for backtesting and hyperopt operations. @@ -495,7 +495,7 @@ def refresh_backtest_trades_data( new_pairs_days: int = 30, erase: bool = False, data_format: str = "feather", - progress_tracker: Optional[ProgressLike] = None, + progress_tracker: ProgressLike | None = None, ) -> list[str]: """ Refresh stored trades data for backtesting and hyperopt operations. @@ -597,7 +597,7 @@ def download_data( config: Config, exchange: Exchange, *, - progress_tracker: Optional[ProgressLike] = None, + progress_tracker: ProgressLike | None = None, ) -> None: """ Download data function. Used from both cli and API. diff --git a/freqtrade/rpc/api_server/api_schemas.py b/freqtrade/rpc/api_server/api_schemas.py index 98cc206be..d0bdb9fb6 100644 --- a/freqtrade/rpc/api_server/api_schemas.py +++ b/freqtrade/rpc/api_server/api_schemas.py @@ -490,9 +490,9 @@ class PairListsPayload(ExchangeModePayloadMixin, BaseModel): class DownloadDataPayload(ExchangeModePayloadMixin, BaseModel): pairs: list[str] - timeframes: Optional[list[str]] = DL_DATA_TIMEFRAMES - days: Optional[int] = None - timerange: Optional[str] = None + timeframes: list[str] | None = DL_DATA_TIMEFRAMES + days: int | None = None + timerange: str | None = None @model_validator(mode="before") def check_mutually_exclusive(cls, values): diff --git a/freqtrade/util/progress_tracker.py b/freqtrade/util/progress_tracker.py index 2e339c7fb..790b603c7 100644 --- a/freqtrade/util/progress_tracker.py +++ b/freqtrade/util/progress_tracker.py @@ -1,5 +1,5 @@ from contextlib import AbstractContextManager -from typing import Optional, Protocol +from typing import Protocol from rich.progress import ( BarColumn, @@ -20,7 +20,7 @@ class ProgressLike(Protocol, AbstractContextManager["ProgressLike"]): def update(self, task_id: TaskID, *, advance: float | None = None, **kwargs): ... -def retrieve_progress_tracker(pt: Optional[ProgressLike]) -> ProgressLike: +def retrieve_progress_tracker(pt: ProgressLike | None) -> ProgressLike: if pt is None: return get_progress_tracker() return pt