Skip to content

quantpylib.datapoller.utils

poller(_func=None, *, tag=None)

Decorator for instance level methods of quantpylib.datapoller.base.BasePoller objects. Let the object be given the variable name poller_obj, then decorated instance level methods have augmented default arguments **kwargs with following key-pairs:

Specs:

src (string): Data source we want to poll for. Defaults to `poller_obj.default_src`.

Parameters:

Name Type Description Default
_func function

The function to be decorated. Defaults to None.

None
tag str

A tag to identify the poller. Defaults to None.

None

Returns:

Type Description

The decorated instance level method.

ts_poller(_func=None, *, tag=None, assert_span=True, automap_span=True)

Decorator for instance level methods of quantpylib.datapoller.base.BasePoller objects. Let the object be given the variable name poller_obj, then decorated instance level methods have augmented default arguments **kwargs with following key-pairs:

Specs:

ticker (str): The identifier for the time-series of interest. Defaults to None.
start (datetime.datetime): The start time of the time-series being polled. Defaults to None.
end (datetime.datetime): The end time of the time-series being polled. Defaults to None.
periods (int): Number of periods of granularity_multiplier * granularity of time-series being polled. Defaults to None. 
granularity (str): Granularity of data being polled. Valid values are ['s','m','h','d','w','M','y']. Defaults to 'd'.
granularity_multiplier (int): Multiplier for the granularity. For instance, 4 for multiplier and 'h' for granularity implies '4h' candles/periods. Defaults to 1.
src (string): Data source we want to poll for. Defaults to `poller_obj.default_src`.

Parameters:

Name Type Description Default
_func function

The function to be decorated. Defaults to None.

None
tag str

A tag to identify the poller. Defaults to None.

None

Returns:

Name Type Description
method

The decorated instance level method.

Parameters:

Name Type Description Default
_func function

The function to be decorated. Defaults to None.

None
tag str

A tag to identify the poller. Defaults to None.

None
assert_span bool

Whether to assert the validity of time span arguments. If True, exactly two of start, end, and periods must be specified. Defaults to True.

True
automap_span bool

Whether to automatically map (start,end,periods,granularity,granularity_multiplier) into time span arguments. Defaults to True.

True

Returns:

Type Description

The decorated instance level method.