algo_engine.exchange_profile

Exchange profiles provide trading calendars, session times, and holiday schedules. Both CN (A-share) and global exchange profiles are supported.

Exchange Profile

class algo_engine.exchange_profile.ExchangeProfile
__init__(*args, **kwargs)
activate(self)
bound_instance
break_adjusted(self, double elapsed_seconds)
close_call_auction
deactivate(self)
is_auction_session(self, timestamp)
is_market_session(self, timestamp)
is_trading_day(self, date market_date)
nearest_trading_date(self, date market_date, str method='previous')
open_call_auction
profile_id
range_break
resolve_auction_phase(self, session_time)
resolve_session_phase(self, session_time)
resolve_session_type(self, session_date)
session_breaks
session_end
session_end_ts
session_length_seconds
session_start
session_start_ts
time_to_seconds(self, time t, bool break_adjusted=True)
time_zone
timestamp_to_datetime(self, double unix_ts)
timestamp_to_seconds(self, double t, bool break_adjusted=True)
trade_calendar(self, start_date, end_date)
trade_calendar_cache
trading_days_after(self, date market_date, Py_ssize_t days)
trading_days_before(self, date market_date, Py_ssize_t days)
trading_days_between(self, date start_date, date end_date)
trading_time_between(self, start_time, end_time)
tz_offset_seconds

Global Dispatcher

algo_engine.exchange_profile.PROFILE = <ExchangeProfile>(UTC_NONSTOP_DEFAULT)

ExchangeProfile()

Default Profile (Global)

algo_engine.exchange_profile.PROFILE_DEFAULT = <ExchangeProfile>(UTC_NONSTOP_DEFAULT)

ExchangeProfile()

CN Profile (A-Share)

algo_engine.exchange_profile.PROFILE_CN = <ExchangeProfile>(CN_STOCK)

ExchangeProfile()

Session Types

class algo_engine.exchange_profile.SessionDate(uint16_t year, uint8_t month, uint8_t day)
__init__(*args, **kwargs)
add_days(self, Py_ssize_t days)
addr
day
static days_in_month(uint16_t year, uint8_t month)
fork(self) SessionDate
classmethod from_ordinal(cls, uint32_t ordinal)
classmethod from_pydate(cls, date dt)
classmethod from_unix(cls, double unix_ts)
classmethod fromisocalendar(cls, int year, int week, int weekday)
classmethod fromisoformat(cls, str date_str)
static is_leap_year(uint16_t year)
is_valid(self)
is_weekend(self)
month
override(self, date dt)
session_type
timestamp(self)
to_ordinal(self)
to_pydate(self)
classmethod today(cls)
classmethod unix_to_ordinal(cls, double unix_ts)
year
class algo_engine.exchange_profile.SessionTime
elapsed_seconds
classmethod from_pytime(cls, time t)
classmethod from_timestamp(cls, double unix_ts)
classmethod from_ts(cls, double ts)
classmethod fromisoformat(cls, str time_str)
hour
isoformat(self, *args, **kwargs)
microsecond
minute
nanosecond
second
session_phase
to_pytime(self)
ts
class algo_engine.exchange_profile.SessionPhase(*values)
UNKNOWN = 0
PREOPEN = 64
OPEN_AUCTION = 128
CONTINUOUS = 208
BREAK = 16
SUSPENDED = 32
CLOSE_AUCTION = 192
CLOSED = 48