tbapi.api.interfaces.iexchange_calendar
1from __future__ import annotations 2from typing import TYPE_CHECKING 3from tbapi.common.decorators import tb_interface 4from tbapi.common.converters import to_python_datetime, to_net_datetime 5from datetime import datetime 6from Tickblaze.Scripts.Api.Interfaces import IExchangeCalendar as _IExchangeCalendar 7from typing import Any, overload 8from abc import ABC, abstractmethod 9if TYPE_CHECKING: 10 from tbapi.api.interfaces.iexchange_session import IExchangeSession 11 12@tb_interface(_IExchangeCalendar) 13class IExchangeCalendar(): 14 """Defines methods for handling exchange calendars, including date/time conversion and session status.""" 15 16 17 @abstractmethod 18 def exchange_date_time_to_utc_date_time(self, exchange_date_time: datetime) -> datetime: 19 """Converts a specified exchange date/time to a UTC date/time. The exchange date/time to convert. The specified exchange date/time converted to UTC date/time.""" 20 result = self._value.ExchangeDateTimeToUtcDateTime(to_net_datetime(exchange_date_time)) 21 return to_python_datetime(result) 22 23 @abstractmethod 24 def is_session_open(self, utc_date_time: datetime, is_intraday: bool) -> bool: 25 """Determines whether there is an open session at a specified date/time. The UTC date/time. Indicates whether the test is for intraday data. True if there is an open session, false otherwise.""" 26 result = self._value.IsSessionOpen(to_net_datetime(utc_date_time), is_intraday) 27 return result 28 29 @abstractmethod 30 def utc_date_time_to_exchange_date_time(self, utc_date_time: datetime) -> datetime: 31 """Converts a specified UTC date/time to an exchange date/time. The UTC date/time to convert. The specified UTC date/time converted to exchange date/time.""" 32 result = self._value.UtcDateTimeToExchangeDateTime(to_net_datetime(utc_date_time)) 33 return to_python_datetime(result) 34 35 @abstractmethod 36 def get_session(self, utc_date_time: datetime) -> IExchangeSession: 37 """Retrieves a session at a specific UTC date/time. The UTC date/time to convert. The session at the specified UTC date/time, or null if none exists.""" 38 result = self._value.GetSession(to_net_datetime(utc_date_time)) 39 from tbapi.api.interfaces.iexchange_session import IExchangeSession 40 return IExchangeSession(_existing=result) 41
18@tb_interface(_IExchangeCalendar) 19class IExchangeCalendar(): 20 """Defines methods for handling exchange calendars, including date/time conversion and session status.""" 21 22 23 @abstractmethod 24 def exchange_date_time_to_utc_date_time(self, exchange_date_time: datetime) -> datetime: 25 """Converts a specified exchange date/time to a UTC date/time. The exchange date/time to convert. The specified exchange date/time converted to UTC date/time.""" 26 result = self._value.ExchangeDateTimeToUtcDateTime(to_net_datetime(exchange_date_time)) 27 return to_python_datetime(result) 28 29 @abstractmethod 30 def is_session_open(self, utc_date_time: datetime, is_intraday: bool) -> bool: 31 """Determines whether there is an open session at a specified date/time. The UTC date/time. Indicates whether the test is for intraday data. True if there is an open session, false otherwise.""" 32 result = self._value.IsSessionOpen(to_net_datetime(utc_date_time), is_intraday) 33 return result 34 35 @abstractmethod 36 def utc_date_time_to_exchange_date_time(self, utc_date_time: datetime) -> datetime: 37 """Converts a specified UTC date/time to an exchange date/time. The UTC date/time to convert. The specified UTC date/time converted to exchange date/time.""" 38 result = self._value.UtcDateTimeToExchangeDateTime(to_net_datetime(utc_date_time)) 39 return to_python_datetime(result) 40 41 @abstractmethod 42 def get_session(self, utc_date_time: datetime) -> IExchangeSession: 43 """Retrieves a session at a specific UTC date/time. The UTC date/time to convert. The session at the specified UTC date/time, or null if none exists.""" 44 result = self._value.GetSession(to_net_datetime(utc_date_time)) 45 from tbapi.api.interfaces.iexchange_session import IExchangeSession 46 return IExchangeSession(_existing=result)
Defines methods for handling exchange calendars, including date/time conversion and session status.
23 @abstractmethod 24 def exchange_date_time_to_utc_date_time(self, exchange_date_time: datetime) -> datetime: 25 """Converts a specified exchange date/time to a UTC date/time. The exchange date/time to convert. The specified exchange date/time converted to UTC date/time.""" 26 result = self._value.ExchangeDateTimeToUtcDateTime(to_net_datetime(exchange_date_time)) 27 return to_python_datetime(result)
Converts a specified exchange date/time to a UTC date/time. The exchange date/time to convert. The specified exchange date/time converted to UTC date/time.
29 @abstractmethod 30 def is_session_open(self, utc_date_time: datetime, is_intraday: bool) -> bool: 31 """Determines whether there is an open session at a specified date/time. The UTC date/time. Indicates whether the test is for intraday data. True if there is an open session, false otherwise.""" 32 result = self._value.IsSessionOpen(to_net_datetime(utc_date_time), is_intraday) 33 return result
Determines whether there is an open session at a specified date/time. The UTC date/time. Indicates whether the test is for intraday data. True if there is an open session, false otherwise.
35 @abstractmethod 36 def utc_date_time_to_exchange_date_time(self, utc_date_time: datetime) -> datetime: 37 """Converts a specified UTC date/time to an exchange date/time. The UTC date/time to convert. The specified UTC date/time converted to exchange date/time.""" 38 result = self._value.UtcDateTimeToExchangeDateTime(to_net_datetime(utc_date_time)) 39 return to_python_datetime(result)
Converts a specified UTC date/time to an exchange date/time. The UTC date/time to convert. The specified UTC date/time converted to exchange date/time.
41 @abstractmethod 42 def get_session(self, utc_date_time: datetime) -> IExchangeSession: 43 """Retrieves a session at a specific UTC date/time. The UTC date/time to convert. The session at the specified UTC date/time, or null if none exists.""" 44 result = self._value.GetSession(to_net_datetime(utc_date_time)) 45 from tbapi.api.interfaces.iexchange_session import IExchangeSession 46 return IExchangeSession(_existing=result)
Retrieves a session at a specific UTC date/time. The UTC date/time to convert. The session at the specified UTC date/time, or null if none exists.