tbapi.api.plot_series

  1from __future__ import annotations
  2from typing import TYPE_CHECKING
  3from tbapi.common.decorators import tb_class, tb_interface
  4from tbapi.common.converters import to_python_datetime, to_net_datetime
  5from datetime import datetime
  6from Tickblaze.Scripts.Api import PlotSeries as _PlotSeries
  7from typing import Any, overload
  8from abc import ABC, abstractmethod
  9from tbapi.api.models.data_series import DataSeries
 10from tbapi.api.interfaces.iplot import IPlot
 11from tbapi.core.enums.plot_style import PlotStyle
 12from tbapi.core.enums.line_style import LineStyle
 13from Tickblaze.Core.Enums import PlotStyle as _PlotStyle
 14from Tickblaze.Core.Enums import LineStyle as _LineStyle
 15if TYPE_CHECKING:
 16    from tbapi.api.models.color import Color
 17    from tbapi.api.models.stroke import Stroke
 18    from tbapi.api.color_series import ColorSeries
 19    from tbapi.api.series import Series
 20    from tbapi.api.models.price_marker import PriceMarker
 21
 22@tb_class(_PlotSeries)
 23class PlotSeries(DataSeries, IPlot):
 24    """Represents a series of plot data, including properties for color, line style, thickness, and visibility."""
 25
 26    @overload
 27    @staticmethod
 28    def new() -> "PlotSeries":
 29        """Constructor overload with arguments: """
 30        ...
 31    @overload
 32    @staticmethod
 33    def new(color: Color) -> "PlotSeries":
 34        """Constructor overload with arguments: color"""
 35        ...
 36    @overload
 37    @staticmethod
 38    def new(color: Color, lineStyle: LineStyle = LineStyle.Solid, thickness: int = 1) -> "PlotSeries":
 39        """Constructor overload with arguments: color, lineStyle, thickness"""
 40        ...
 41    @overload
 42    @staticmethod
 43    def new(stroke: Stroke, plotStyle: PlotStyle = PlotStyle.Line) -> "PlotSeries":
 44        """Constructor overload with arguments: stroke, plotStyle"""
 45        ...
 46    @overload
 47    @staticmethod
 48    def new(color: Color, plotStyle: PlotStyle = PlotStyle.Line, thickness: int = 1) -> "PlotSeries":
 49        """Constructor overload with arguments: color, plotStyle, thickness"""
 50        ...
 51    @overload
 52    @staticmethod
 53    def new(name: str, color: Color, plotStyle: PlotStyle = PlotStyle.Line, lineStyle: LineStyle = LineStyle.Solid, thickness: int = 1, isVisible: bool = True) -> "PlotSeries":
 54        """Constructor overload with arguments: name, color, plotStyle, lineStyle, thickness, isVisible"""
 55        ...
 56    @overload
 57    @staticmethod
 58    def new(name: str, stroke: Stroke, plotStyle: PlotStyle = PlotStyle.Line) -> "PlotSeries":
 59        """Constructor overload with arguments: name, stroke, plotStyle"""
 60        ...
 61    @staticmethod
 62    def new(*args, **kwargs):
 63        """Generic factory method for PlotSeries. Use overloads for IDE type hints."""
 64        return PlotSeries(*args, **kwargs)
 65
 66    @property
 67    def name(self) -> str:
 68        """The name of the plot series."""
 69        val = self._value.Name
 70        return val
 71    @name.setter
 72    def name(self, val: str):
 73        tmp = self._value
 74        tmp.Name = val
 75        self._value = tmp
 76    @property
 77    def color(self) -> Color:
 78        """The color of the plot series."""
 79        from tbapi.api.models.color import Color
 80        val = self._value.Color
 81        return Color(_existing=val)
 82    @color.setter
 83    def color(self, val: Color):
 84        tmp = self._value
 85        tmp.Color = val._value
 86        self._value = tmp
 87    @property
 88    def plot_style(self) -> PlotStyle:
 89        """The style of the plot (line, bars, etc.)."""
 90        val = int(self._value.PlotStyle)
 91        return PlotStyle(val)
 92    @plot_style.setter
 93    def plot_style(self, val: PlotStyle):
 94        tmp = self._value
 95        tmp.PlotStyle = _PlotStyle(val.value if hasattr(val, "value") else int(val))
 96        self._value = tmp
 97    @property
 98    def line_style(self) -> LineStyle:
 99        """The line style for the plot series."""
100        val = int(self._value.LineStyle)
101        return LineStyle(val)
102    @line_style.setter
103    def line_style(self, val: LineStyle):
104        tmp = self._value
105        tmp.LineStyle = _LineStyle(val.value if hasattr(val, "value") else int(val))
106        self._value = tmp
107    @property
108    def thickness(self) -> int:
109        """The thickness of the plot series line."""
110        val = self._value.Thickness
111        return val
112    @thickness.setter
113    def thickness(self, val: int):
114        tmp = self._value
115        tmp.Thickness = val
116        self._value = tmp
117    @property
118    def stroke(self) -> Stroke:
119        """The stroke for the plot series"""
120        from tbapi.api.models.stroke import Stroke
121        val = self._value.Stroke
122        return Stroke(_existing=val)
123    @stroke.setter
124    def stroke(self, val: Stroke):
125        tmp = self._value
126        tmp.Stroke = val._value
127        self._value = tmp
128    @property
129    def is_visible(self) -> bool:
130        """Indicates whether the plot series is visible."""
131        val = self._value.IsVisible
132        return val
133    @is_visible.setter
134    def is_visible(self, val: bool):
135        tmp = self._value
136        tmp.IsVisible = val
137        self._value = tmp
138    @property
139    def colors(self) -> ColorSeries:
140        """The collection of plot colors."""
141        from tbapi.api.color_series import ColorSeries
142        val = self._value.Colors
143        return ColorSeries(_existing=val)
144    @property
145    def is_line_break(self) -> Series:
146        """A series representing line break points in the plot series."""
147        val = self._value.IsLineBreak
148        return val
149    @property
150    def price_marker(self) -> PriceMarker:
151        """The price marker of the plot series."""
152        from tbapi.api.models.price_marker import PriceMarker
153        val = self._value.PriceMarker
154        return PriceMarker(_existing=val)
155    @price_marker.setter
156    def price_marker(self, val: PriceMarker):
157        tmp = self._value
158        tmp.PriceMarker = val._value
159        self._value = tmp
160    @property
161    def is_editor_browsable(self) -> bool:
162        """Indicates whether the plot series should be visible in the indicator editor."""
163        val = self._value.IsEditorBrowsable
164        return val
165    @is_editor_browsable.setter
166    def is_editor_browsable(self, val: bool):
167        tmp = self._value
168        tmp.IsEditorBrowsable = val
169        self._value = tmp
170    @property
171    def is_color_editor_browsable(self) -> bool:
172        """Indicates whether the color of the plot series should be visible in the indicator editor."""
173        val = self._value.IsColorEditorBrowsable
174        return val
175    @is_color_editor_browsable.setter
176    def is_color_editor_browsable(self, val: bool):
177        tmp = self._value
178        tmp.IsColorEditorBrowsable = val
179        self._value = tmp
180
181    def clone(self) -> PlotSeries:
182        """Creates a copy of the current  instance.            A new instance of  with the same values."""
183        result = self._value.Clone()
184        from tbapi.api.plot_series import PlotSeries
185        return PlotSeries(_existing=result)
186  
187
188
189    def __getitem__(self, index: int) -> float:
190        result = self._value[index]
191        return result
192
193    def __setitem__(self, index: int, value: float):
194        tmp = value
195        self._value[index] = tmp
@tb_class(_PlotSeries)
class PlotSeries(tbapi.api.models.data_series.DataSeries, tbapi.api.interfaces.iplot.IPlot):
 30@tb_class(_PlotSeries)
 31class PlotSeries(DataSeries, IPlot):
 32    """Represents a series of plot data, including properties for color, line style, thickness, and visibility."""
 33
 34    @overload
 35    @staticmethod
 36    def new() -> "PlotSeries":
 37        """Constructor overload with arguments: """
 38        ...
 39    @overload
 40    @staticmethod
 41    def new(color: Color) -> "PlotSeries":
 42        """Constructor overload with arguments: color"""
 43        ...
 44    @overload
 45    @staticmethod
 46    def new(color: Color, lineStyle: LineStyle = LineStyle.Solid, thickness: int = 1) -> "PlotSeries":
 47        """Constructor overload with arguments: color, lineStyle, thickness"""
 48        ...
 49    @overload
 50    @staticmethod
 51    def new(stroke: Stroke, plotStyle: PlotStyle = PlotStyle.Line) -> "PlotSeries":
 52        """Constructor overload with arguments: stroke, plotStyle"""
 53        ...
 54    @overload
 55    @staticmethod
 56    def new(color: Color, plotStyle: PlotStyle = PlotStyle.Line, thickness: int = 1) -> "PlotSeries":
 57        """Constructor overload with arguments: color, plotStyle, thickness"""
 58        ...
 59    @overload
 60    @staticmethod
 61    def new(name: str, color: Color, plotStyle: PlotStyle = PlotStyle.Line, lineStyle: LineStyle = LineStyle.Solid, thickness: int = 1, isVisible: bool = True) -> "PlotSeries":
 62        """Constructor overload with arguments: name, color, plotStyle, lineStyle, thickness, isVisible"""
 63        ...
 64    @overload
 65    @staticmethod
 66    def new(name: str, stroke: Stroke, plotStyle: PlotStyle = PlotStyle.Line) -> "PlotSeries":
 67        """Constructor overload with arguments: name, stroke, plotStyle"""
 68        ...
 69    @staticmethod
 70    def new(*args, **kwargs):
 71        """Generic factory method for PlotSeries. Use overloads for IDE type hints."""
 72        return PlotSeries(*args, **kwargs)
 73
 74    @property
 75    def name(self) -> str:
 76        """The name of the plot series."""
 77        val = self._value.Name
 78        return val
 79    @name.setter
 80    def name(self, val: str):
 81        tmp = self._value
 82        tmp.Name = val
 83        self._value = tmp
 84    @property
 85    def color(self) -> Color:
 86        """The color of the plot series."""
 87        from tbapi.api.models.color import Color
 88        val = self._value.Color
 89        return Color(_existing=val)
 90    @color.setter
 91    def color(self, val: Color):
 92        tmp = self._value
 93        tmp.Color = val._value
 94        self._value = tmp
 95    @property
 96    def plot_style(self) -> PlotStyle:
 97        """The style of the plot (line, bars, etc.)."""
 98        val = int(self._value.PlotStyle)
 99        return PlotStyle(val)
100    @plot_style.setter
101    def plot_style(self, val: PlotStyle):
102        tmp = self._value
103        tmp.PlotStyle = _PlotStyle(val.value if hasattr(val, "value") else int(val))
104        self._value = tmp
105    @property
106    def line_style(self) -> LineStyle:
107        """The line style for the plot series."""
108        val = int(self._value.LineStyle)
109        return LineStyle(val)
110    @line_style.setter
111    def line_style(self, val: LineStyle):
112        tmp = self._value
113        tmp.LineStyle = _LineStyle(val.value if hasattr(val, "value") else int(val))
114        self._value = tmp
115    @property
116    def thickness(self) -> int:
117        """The thickness of the plot series line."""
118        val = self._value.Thickness
119        return val
120    @thickness.setter
121    def thickness(self, val: int):
122        tmp = self._value
123        tmp.Thickness = val
124        self._value = tmp
125    @property
126    def stroke(self) -> Stroke:
127        """The stroke for the plot series"""
128        from tbapi.api.models.stroke import Stroke
129        val = self._value.Stroke
130        return Stroke(_existing=val)
131    @stroke.setter
132    def stroke(self, val: Stroke):
133        tmp = self._value
134        tmp.Stroke = val._value
135        self._value = tmp
136    @property
137    def is_visible(self) -> bool:
138        """Indicates whether the plot series is visible."""
139        val = self._value.IsVisible
140        return val
141    @is_visible.setter
142    def is_visible(self, val: bool):
143        tmp = self._value
144        tmp.IsVisible = val
145        self._value = tmp
146    @property
147    def colors(self) -> ColorSeries:
148        """The collection of plot colors."""
149        from tbapi.api.color_series import ColorSeries
150        val = self._value.Colors
151        return ColorSeries(_existing=val)
152    @property
153    def is_line_break(self) -> Series:
154        """A series representing line break points in the plot series."""
155        val = self._value.IsLineBreak
156        return val
157    @property
158    def price_marker(self) -> PriceMarker:
159        """The price marker of the plot series."""
160        from tbapi.api.models.price_marker import PriceMarker
161        val = self._value.PriceMarker
162        return PriceMarker(_existing=val)
163    @price_marker.setter
164    def price_marker(self, val: PriceMarker):
165        tmp = self._value
166        tmp.PriceMarker = val._value
167        self._value = tmp
168    @property
169    def is_editor_browsable(self) -> bool:
170        """Indicates whether the plot series should be visible in the indicator editor."""
171        val = self._value.IsEditorBrowsable
172        return val
173    @is_editor_browsable.setter
174    def is_editor_browsable(self, val: bool):
175        tmp = self._value
176        tmp.IsEditorBrowsable = val
177        self._value = tmp
178    @property
179    def is_color_editor_browsable(self) -> bool:
180        """Indicates whether the color of the plot series should be visible in the indicator editor."""
181        val = self._value.IsColorEditorBrowsable
182        return val
183    @is_color_editor_browsable.setter
184    def is_color_editor_browsable(self, val: bool):
185        tmp = self._value
186        tmp.IsColorEditorBrowsable = val
187        self._value = tmp
188
189    def clone(self) -> PlotSeries:
190        """Creates a copy of the current  instance.            A new instance of  with the same values."""
191        result = self._value.Clone()
192        from tbapi.api.plot_series import PlotSeries
193        return PlotSeries(_existing=result)
194  
195
196
197    def __getitem__(self, index: int) -> float:
198        result = self._value[index]
199        return result
200
201    def __setitem__(self, index: int, value: float):
202        tmp = value
203        self._value[index] = tmp

Represents a series of plot data, including properties for color, line style, thickness, and visibility.

PlotSeries(*args, **kwargs)
162        def __init__(self, *args, **kwargs):
163            pass
@staticmethod
def new(*args, **kwargs):
69    @staticmethod
70    def new(*args, **kwargs):
71        """Generic factory method for PlotSeries. Use overloads for IDE type hints."""
72        return PlotSeries(*args, **kwargs)

Generic factory method for PlotSeries. Use overloads for IDE type hints.

name: str
74    @property
75    def name(self) -> str:
76        """The name of the plot series."""
77        val = self._value.Name
78        return val

The name of the plot series.

color: tbapi.api.models.color.Color
84    @property
85    def color(self) -> Color:
86        """The color of the plot series."""
87        from tbapi.api.models.color import Color
88        val = self._value.Color
89        return Color(_existing=val)

The color of the plot series.

plot_style: tbapi.core.enums.plot_style.PlotStyle
95    @property
96    def plot_style(self) -> PlotStyle:
97        """The style of the plot (line, bars, etc.)."""
98        val = int(self._value.PlotStyle)
99        return PlotStyle(val)

The style of the plot (line, bars, etc.).

line_style: tbapi.core.enums.line_style.LineStyle
105    @property
106    def line_style(self) -> LineStyle:
107        """The line style for the plot series."""
108        val = int(self._value.LineStyle)
109        return LineStyle(val)

The line style for the plot series.

thickness: int
115    @property
116    def thickness(self) -> int:
117        """The thickness of the plot series line."""
118        val = self._value.Thickness
119        return val

The thickness of the plot series line.

stroke: tbapi.api.models.stroke.Stroke
125    @property
126    def stroke(self) -> Stroke:
127        """The stroke for the plot series"""
128        from tbapi.api.models.stroke import Stroke
129        val = self._value.Stroke
130        return Stroke(_existing=val)

The stroke for the plot series

is_visible: bool
136    @property
137    def is_visible(self) -> bool:
138        """Indicates whether the plot series is visible."""
139        val = self._value.IsVisible
140        return val

Indicates whether the plot series is visible.

146    @property
147    def colors(self) -> ColorSeries:
148        """The collection of plot colors."""
149        from tbapi.api.color_series import ColorSeries
150        val = self._value.Colors
151        return ColorSeries(_existing=val)

The collection of plot colors.

is_line_break: tbapi.api.series.Series
152    @property
153    def is_line_break(self) -> Series:
154        """A series representing line break points in the plot series."""
155        val = self._value.IsLineBreak
156        return val

A series representing line break points in the plot series.

price_marker: tbapi.api.models.price_marker.PriceMarker
157    @property
158    def price_marker(self) -> PriceMarker:
159        """The price marker of the plot series."""
160        from tbapi.api.models.price_marker import PriceMarker
161        val = self._value.PriceMarker
162        return PriceMarker(_existing=val)

The price marker of the plot series.

is_editor_browsable: bool
168    @property
169    def is_editor_browsable(self) -> bool:
170        """Indicates whether the plot series should be visible in the indicator editor."""
171        val = self._value.IsEditorBrowsable
172        return val

Indicates whether the plot series should be visible in the indicator editor.

is_color_editor_browsable: bool
178    @property
179    def is_color_editor_browsable(self) -> bool:
180        """Indicates whether the color of the plot series should be visible in the indicator editor."""
181        val = self._value.IsColorEditorBrowsable
182        return val

Indicates whether the color of the plot series should be visible in the indicator editor.

def clone(self) -> PlotSeries:
189    def clone(self) -> PlotSeries:
190        """Creates a copy of the current  instance.            A new instance of  with the same values."""
191        result = self._value.Clone()
192        from tbapi.api.plot_series import PlotSeries
193        return PlotSeries(_existing=result)

Creates a copy of the current instance. A new instance of with the same values.