mirror of
https://github.com/freqtrade/freqtrade.git
synced 2025-12-14 11:51:19 +00:00
fic: Improve type safety for annotationType
This commit is contained in:
@@ -6,7 +6,6 @@ from typing_extensions import TypedDict
|
||||
|
||||
|
||||
class _BaseAnnotationType(TypedDict, total=False):
|
||||
type: Required[Literal["area", "line"]]
|
||||
start: str | datetime
|
||||
end: str | datetime
|
||||
y_start: float
|
||||
@@ -20,12 +19,12 @@ class AreaAnnotationType(_BaseAnnotationType, total=False):
|
||||
type: Literal["area"]
|
||||
|
||||
|
||||
class LinenAnnotationType(_BaseAnnotationType, total=False):
|
||||
class LineAnnotationType(_BaseAnnotationType, total=False):
|
||||
type: Literal["line"]
|
||||
width: int
|
||||
line_style: Literal["solid", "dashed", "dotted"]
|
||||
|
||||
|
||||
AnnotationType = AreaAnnotationType | LinenAnnotationType
|
||||
AnnotationType = AreaAnnotationType | LineAnnotationType
|
||||
|
||||
AnnotationTypeTA = TypeAdapter(AnnotationType)
|
||||
AnnotationTypeTA: TypeAdapter[AnnotationType] = TypeAdapter(AnnotationType)
|
||||
|
||||
Reference in New Issue
Block a user