chore: rename Annotation type

This commit is contained in:
Matthias
2024-12-28 15:41:10 +01:00
parent 8cdae5f56e
commit 4c3e477667
5 changed files with 12 additions and 10 deletions
+1 -1
View File
@@ -5,5 +5,5 @@ from freqtrade.ft_types.backtest_result_type import (
BacktestResultType, BacktestResultType,
get_BacktestResultType_default, get_BacktestResultType_default,
) )
from freqtrade.ft_types.plot_annotation_type import MarkArea from freqtrade.ft_types.plot_annotation_type import AnnotationType
from freqtrade.ft_types.valid_exchanges_type import ValidExchangesType from freqtrade.ft_types.valid_exchanges_type import ValidExchangesType
+3 -1
View File
@@ -1,9 +1,11 @@
from datetime import datetime from datetime import datetime
from typing import Literal
from typing_extensions import NotRequired, TypedDict from typing_extensions import NotRequired, TypedDict
class MarkArea(TypedDict): class AnnotationType(TypedDict):
type: Literal["area"] = "area"
start: NotRequired[str | datetime] start: NotRequired[str | datetime]
end: NotRequired[str | datetime] end: NotRequired[str | datetime]
y_start: NotRequired[float] y_start: NotRequired[float]
+2 -2
View File
@@ -5,7 +5,7 @@ from pydantic import AwareDatetime, BaseModel, RootModel, SerializeAsAny, model_
from freqtrade.constants import DL_DATA_TIMEFRAMES, IntOrInf from freqtrade.constants import DL_DATA_TIMEFRAMES, IntOrInf
from freqtrade.enums import MarginMode, OrderTypeValues, SignalDirection, TradingMode from freqtrade.enums import MarginMode, OrderTypeValues, SignalDirection, TradingMode
from freqtrade.ft_types import MarkArea, ValidExchangesType from freqtrade.ft_types import AnnotationType, ValidExchangesType
from freqtrade.rpc.api_server.webserver_bgwork import ProgressTask from freqtrade.rpc.api_server.webserver_bgwork import ProgressTask
@@ -537,7 +537,7 @@ class PairHistory(BaseModel):
columns: list[str] columns: list[str]
all_columns: list[str] = [] all_columns: list[str] = []
data: SerializeAsAny[list[Any]] data: SerializeAsAny[list[Any]]
mark_areas: list[MarkArea] | None = None mark_areas: list[AnnotationType] | None = None
length: int length: int
buy_signals: int buy_signals: int
sell_signals: int sell_signals: int
+2 -2
View File
@@ -6,7 +6,7 @@ from freqtrade.exchange import (
timeframe_to_prev_date, timeframe_to_prev_date,
timeframe_to_seconds, timeframe_to_seconds,
) )
from freqtrade.ft_types import MarkArea from freqtrade.ft_types import AnnotationType
from freqtrade.persistence import Order, PairLocks, Trade from freqtrade.persistence import Order, PairLocks, Trade
from freqtrade.strategy.informative_decorator import informative from freqtrade.strategy.informative_decorator import informative
from freqtrade.strategy.interface import IStrategy from freqtrade.strategy.interface import IStrategy
@@ -45,5 +45,5 @@ __all__ = [
"merge_informative_pair", "merge_informative_pair",
"stoploss_from_absolute", "stoploss_from_absolute",
"stoploss_from_open", "stoploss_from_open",
"MarkArea", "AnnotationType",
] ]
+4 -4
View File
@@ -26,7 +26,7 @@ from freqtrade.enums import (
) )
from freqtrade.exceptions import OperationalException, StrategyError from freqtrade.exceptions import OperationalException, StrategyError
from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds from freqtrade.exchange import timeframe_to_minutes, timeframe_to_next_date, timeframe_to_seconds
from freqtrade.ft_types import MarkArea from freqtrade.ft_types import AnnotationType
from freqtrade.misc import remove_entry_exit_signals from freqtrade.misc import remove_entry_exit_signals
from freqtrade.persistence import Order, PairLocks, Trade from freqtrade.persistence import Order, PairLocks, Trade
from freqtrade.strategy.hyper import HyperStrategyMixin from freqtrade.strategy.hyper import HyperStrategyMixin
@@ -737,7 +737,7 @@ class IStrategy(ABC, HyperStrategyMixin):
def plot_annotations( def plot_annotations(
self, pair: str, start_date: datetime, end_date: datetime, dataframe: DataFrame, **kwargs self, pair: str, start_date: datetime, end_date: datetime, dataframe: DataFrame, **kwargs
) -> list[MarkArea]: ) -> list[AnnotationType]:
""" """
Retrieve area annotations for a chart. Retrieve area annotations for a chart.
Must be returned as array, with label, start, end, y_start, y_end and color. Must be returned as array, with label, start, end, y_start, y_end and color.
@@ -748,7 +748,7 @@ class IStrategy(ABC, HyperStrategyMixin):
:param end_date: End date of the chart data being requested :param end_date: End date of the chart data being requested
:param dataframe: DataFrame with the analyzed data for the chart :param dataframe: DataFrame with the analyzed data for the chart
:param **kwargs: Ensure to keep this here so updates to this won't break your strategy. :param **kwargs: Ensure to keep this here so updates to this won't break your strategy.
:return: List of MarkArea objects :return: List of AnnotationType objects
""" """
return [] return []
@@ -1688,7 +1688,7 @@ class IStrategy(ABC, HyperStrategyMixin):
df = df.rename({"sell": "exit_long"}, axis="columns") df = df.rename({"sell": "exit_long"}, axis="columns")
return df return df
def ft_plot_annotations(self, pair: str, dataframe: DataFrame) -> list[MarkArea]: def ft_plot_annotations(self, pair: str, dataframe: DataFrame) -> list[AnnotationType]:
""" """
Internal wrapper around plot_dataframe Internal wrapper around plot_dataframe
""" """