tbapi.api.bases.symbol_script

 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.Bases import SymbolScript as _SymbolScript
 7from typing import Any, overload
 8from abc import ABC, abstractmethod
 9from tbapi.api.bases.script import Script
10if TYPE_CHECKING:
11    from tbapi.api.models.bar_series import BarSeries
12    from tbapi.api.models.symbol import Symbol
13    from tbapi.api.models.symbol_info import SymbolInfo
14    from tbapi.api.models.bar_series_info import BarSeriesInfo
15
16@tb_interface(_SymbolScript)
17class SymbolScript(Script):
18    """Represents a base class for scripts that can interact with chart data, parameters, and initialization processes."""
19
20    @staticmethod
21    def new(*args, **kwargs):
22        """Generic factory method for SymbolScript. Use overloads for IDE type hints."""
23        return SymbolScript(*args, **kwargs)
24
25    @property
26    def portfolio_time_utc(self) -> datetime:
27        val = self._value.PortfolioTimeUtc
28        return to_python_datetime(val)
29    @portfolio_time_utc.setter
30    def portfolio_time_utc(self, val: datetime):
31        tmp = self._value
32        tmp.PortfolioTimeUtc = to_net_datetime(val)
33        self._value = tmp
34    @property
35    def is_dummy(self) -> bool:
36        val = self._value.IsDummy
37        return val
38    @property
39    def bars(self) -> BarSeries:
40        """The bar series associated with the script."""
41        from tbapi.api.models.bar_series import BarSeries
42        val = self._value.Bars
43        return BarSeries(_existing=val)
44    @bars.setter
45    def bars(self, val: BarSeries):
46        tmp = self._value
47        tmp.Bars = val._value
48        self._value = tmp
49    @property
50    def is_realtime(self) -> bool:
51        val = self._value.IsRealtime
52        return val
53    @is_realtime.setter
54    def is_realtime(self, val: bool):
55        tmp = self._value
56        tmp.IsRealtime = val
57        self._value = tmp
58
59    def get_bars(self, bar_series_info: BarSeriesInfo) -> BarSeries:
60        """Returns a bar series which will fill automatically and can be subscribed to for data updates"""
61        result = self._value.GetBars(bar_series_info._value)
62        from tbapi.api.models.bar_series import BarSeries
63        return BarSeries(_existing=result)
64  
@tb_interface(_SymbolScript)
class SymbolScript(tbapi.api.bases.script.Script):
24@tb_interface(_SymbolScript)
25class SymbolScript(Script):
26    """Represents a base class for scripts that can interact with chart data, parameters, and initialization processes."""
27
28    @staticmethod
29    def new(*args, **kwargs):
30        """Generic factory method for SymbolScript. Use overloads for IDE type hints."""
31        return SymbolScript(*args, **kwargs)
32
33    @property
34    def portfolio_time_utc(self) -> datetime:
35        val = self._value.PortfolioTimeUtc
36        return to_python_datetime(val)
37    @portfolio_time_utc.setter
38    def portfolio_time_utc(self, val: datetime):
39        tmp = self._value
40        tmp.PortfolioTimeUtc = to_net_datetime(val)
41        self._value = tmp
42    @property
43    def is_dummy(self) -> bool:
44        val = self._value.IsDummy
45        return val
46    @property
47    def bars(self) -> BarSeries:
48        """The bar series associated with the script."""
49        from tbapi.api.models.bar_series import BarSeries
50        val = self._value.Bars
51        return BarSeries(_existing=val)
52    @bars.setter
53    def bars(self, val: BarSeries):
54        tmp = self._value
55        tmp.Bars = val._value
56        self._value = tmp
57    @property
58    def is_realtime(self) -> bool:
59        val = self._value.IsRealtime
60        return val
61    @is_realtime.setter
62    def is_realtime(self, val: bool):
63        tmp = self._value
64        tmp.IsRealtime = val
65        self._value = tmp
66
67    def get_bars(self, bar_series_info: BarSeriesInfo) -> BarSeries:
68        """Returns a bar series which will fill automatically and can be subscribed to for data updates"""
69        result = self._value.GetBars(bar_series_info._value)
70        from tbapi.api.models.bar_series import BarSeries
71        return BarSeries(_existing=result)

Represents a base class for scripts that can interact with chart data, parameters, and initialization processes.

SymbolScript(*args, **kwargs)
199        def __init__(self, *args, **kwargs):
200            pass
@staticmethod
def new(*args, **kwargs):
28    @staticmethod
29    def new(*args, **kwargs):
30        """Generic factory method for SymbolScript. Use overloads for IDE type hints."""
31        return SymbolScript(*args, **kwargs)

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

portfolio_time_utc: datetime.datetime
33    @property
34    def portfolio_time_utc(self) -> datetime:
35        val = self._value.PortfolioTimeUtc
36        return to_python_datetime(val)
is_dummy: bool
42    @property
43    def is_dummy(self) -> bool:
44        val = self._value.IsDummy
45        return val
46    @property
47    def bars(self) -> BarSeries:
48        """The bar series associated with the script."""
49        from tbapi.api.models.bar_series import BarSeries
50        val = self._value.Bars
51        return BarSeries(_existing=val)

The bar series associated with the script.

is_realtime: bool
57    @property
58    def is_realtime(self) -> bool:
59        val = self._value.IsRealtime
60        return val
def get_bars( self, bar_series_info: tbapi.api.models.bar_series_info.BarSeriesInfo) -> tbapi.api.models.bar_series.BarSeries:
67    def get_bars(self, bar_series_info: BarSeriesInfo) -> BarSeries:
68        """Returns a bar series which will fill automatically and can be subscribed to for data updates"""
69        result = self._value.GetBars(bar_series_info._value)
70        from tbapi.api.models.bar_series import BarSeries
71        return BarSeries(_existing=result)

Returns a bar series which will fill automatically and can be subscribed to for data updates