tbapi.api.models.symbol_info

 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.Models import SymbolInfo as _SymbolInfo
 7from typing import Any, overload
 8from abc import ABC, abstractmethod
 9from tbapi.core.enums.instrument_type import InstrumentType
10from tbapi.core.enums.exchange import Exchange
11from Tickblaze.Core.Enums import InstrumentType as _InstrumentType
12from Tickblaze.Core.Enums import Exchange as _Exchange
13if TYPE_CHECKING:
14    from tbapi.core.models.contract_settings import ContractSettings
15
16@tb_class(_SymbolInfo)
17class SymbolInfo():
18
19    @overload
20    @staticmethod
21    def new() -> "SymbolInfo":
22        """Constructor overload with arguments: """
23        ...
24    @staticmethod
25    def new(*args, **kwargs):
26        """Generic factory method for SymbolInfo. Use overloads for IDE type hints."""
27        return SymbolInfo(*args, **kwargs)
28
29    @property
30    def instrument_type(self) -> InstrumentType:
31        val = int(self._value.InstrumentType)
32        return InstrumentType(val)
33    @instrument_type.setter
34    def instrument_type(self, val: InstrumentType):
35        tmp = self._value
36        tmp.InstrumentType = _InstrumentType(val.value if hasattr(val, "value") else int(val))
37        self._value = tmp
38    @property
39    def symbol_code(self) -> str:
40        val = self._value.SymbolCode
41        return val
42    @symbol_code.setter
43    def symbol_code(self, val: str):
44        tmp = self._value
45        tmp.SymbolCode = val
46        self._value = tmp
47    @property
48    def exchange(self) -> Exchange:
49        val = int(self._value.Exchange)
50        return Exchange(val)
51    @exchange.setter
52    def exchange(self, val: Exchange):
53        tmp = self._value
54        tmp.Exchange = _Exchange(val.value if hasattr(val, "value") else int(val))
55        self._value = tmp
56    @property
57    def contract(self) -> ContractSettings:
58        from tbapi.core.models.contract_settings import ContractSettings
59        val = self._value.Contract
60        return ContractSettings(_existing=val)
61    @contract.setter
62    def contract(self, val: ContractSettings):
63        tmp = self._value
64        tmp.Contract = val._value
65        self._value = tmp
@tb_class(_SymbolInfo)
class SymbolInfo:
24@tb_class(_SymbolInfo)
25class SymbolInfo():
26
27    @overload
28    @staticmethod
29    def new() -> "SymbolInfo":
30        """Constructor overload with arguments: """
31        ...
32    @staticmethod
33    def new(*args, **kwargs):
34        """Generic factory method for SymbolInfo. Use overloads for IDE type hints."""
35        return SymbolInfo(*args, **kwargs)
36
37    @property
38    def instrument_type(self) -> InstrumentType:
39        val = int(self._value.InstrumentType)
40        return InstrumentType(val)
41    @instrument_type.setter
42    def instrument_type(self, val: InstrumentType):
43        tmp = self._value
44        tmp.InstrumentType = _InstrumentType(val.value if hasattr(val, "value") else int(val))
45        self._value = tmp
46    @property
47    def symbol_code(self) -> str:
48        val = self._value.SymbolCode
49        return val
50    @symbol_code.setter
51    def symbol_code(self, val: str):
52        tmp = self._value
53        tmp.SymbolCode = val
54        self._value = tmp
55    @property
56    def exchange(self) -> Exchange:
57        val = int(self._value.Exchange)
58        return Exchange(val)
59    @exchange.setter
60    def exchange(self, val: Exchange):
61        tmp = self._value
62        tmp.Exchange = _Exchange(val.value if hasattr(val, "value") else int(val))
63        self._value = tmp
64    @property
65    def contract(self) -> ContractSettings:
66        from tbapi.core.models.contract_settings import ContractSettings
67        val = self._value.Contract
68        return ContractSettings(_existing=val)
69    @contract.setter
70    def contract(self, val: ContractSettings):
71        tmp = self._value
72        tmp.Contract = val._value
73        self._value = tmp
SymbolInfo(*args, **kwargs)
162        def __init__(self, *args, **kwargs):
163            pass
@staticmethod
def new(*args, **kwargs):
32    @staticmethod
33    def new(*args, **kwargs):
34        """Generic factory method for SymbolInfo. Use overloads for IDE type hints."""
35        return SymbolInfo(*args, **kwargs)

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

37    @property
38    def instrument_type(self) -> InstrumentType:
39        val = int(self._value.InstrumentType)
40        return InstrumentType(val)
symbol_code: str
46    @property
47    def symbol_code(self) -> str:
48        val = self._value.SymbolCode
49        return val
exchange: tbapi.core.enums.exchange.Exchange
55    @property
56    def exchange(self) -> Exchange:
57        val = int(self._value.Exchange)
58        return Exchange(val)
64    @property
65    def contract(self) -> ContractSettings:
66        from tbapi.core.models.contract_settings import ContractSettings
67        val = self._value.Contract
68        return ContractSettings(_existing=val)