tbapi.core.models.contract_settings
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_class 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Core.Models import ContractSettings as _ContractSettings 7from typing import Any, overload 8from tbapi.core.enums.contract_type import ContractType 9from Tickblaze.Core.Enums import ContractType as _ContractType 10 11@tb_class(_ContractSettings) 12class ContractSettings(): 13 """Describes how futures data should be back adjusted and served""" 14 15 @overload 16 @staticmethod 17 def new() -> "ContractSettings": 18 """Constructor overload with arguments: """ 19 ... 20 @staticmethod 21 def new(*args, **kwargs): 22 """Generic factory method for ContractSettings. Use overloads for IDE type hints.""" 23 return ContractSettings(*args, **kwargs) 24 25 @property 26 def type(self) -> ContractType: 27 """The specific merge rule used to backfill data""" 28 val = int(self._value.Type) 29 return ContractType(val) 30 @type.setter 31 def type(self, val: ContractType): 32 tmp = self._value 33 tmp.Type = _ContractType(val.value if hasattr(val, "value") else int(val)) 34 self._value = tmp 35 @property 36 def year(self) -> int: 37 """The individual contracts year (Ignored unless is set to )""" 38 val = self._value.Year 39 return val 40 @year.setter 41 def year(self, val: int): 42 tmp = self._value 43 tmp.Year = val 44 self._value = tmp 45 @property 46 def month(self) -> int: 47 """The individual contracts month (Ignored unless is set to )""" 48 val = self._value.Month 49 return val 50 @month.setter 51 def month(self, val: int): 52 tmp = self._value 53 tmp.Month = val 54 self._value = tmp
@tb_class(_ContractSettings)
class
ContractSettings:
18@tb_class(_ContractSettings) 19class ContractSettings(): 20 """Describes how futures data should be back adjusted and served""" 21 22 @overload 23 @staticmethod 24 def new() -> "ContractSettings": 25 """Constructor overload with arguments: """ 26 ... 27 @staticmethod 28 def new(*args, **kwargs): 29 """Generic factory method for ContractSettings. Use overloads for IDE type hints.""" 30 return ContractSettings(*args, **kwargs) 31 32 @property 33 def type(self) -> ContractType: 34 """The specific merge rule used to backfill data""" 35 val = int(self._value.Type) 36 return ContractType(val) 37 @type.setter 38 def type(self, val: ContractType): 39 tmp = self._value 40 tmp.Type = _ContractType(val.value if hasattr(val, "value") else int(val)) 41 self._value = tmp 42 @property 43 def year(self) -> int: 44 """The individual contracts year (Ignored unless is set to )""" 45 val = self._value.Year 46 return val 47 @year.setter 48 def year(self, val: int): 49 tmp = self._value 50 tmp.Year = val 51 self._value = tmp 52 @property 53 def month(self) -> int: 54 """The individual contracts month (Ignored unless is set to )""" 55 val = self._value.Month 56 return val 57 @month.setter 58 def month(self, val: int): 59 tmp = self._value 60 tmp.Month = val 61 self._value = tmp
Describes how futures data should be back adjusted and served
@staticmethod
def
new(*args, **kwargs):
27 @staticmethod 28 def new(*args, **kwargs): 29 """Generic factory method for ContractSettings. Use overloads for IDE type hints.""" 30 return ContractSettings(*args, **kwargs)
Generic factory method for ContractSettings. Use overloads for IDE type hints.
32 @property 33 def type(self) -> ContractType: 34 """The specific merge rule used to backfill data""" 35 val = int(self._value.Type) 36 return ContractType(val)
The specific merge rule used to backfill data