Scalability toolkit

Scalability toolkit#

sigtech.framework.infra.mu.__init__.calc_history(dobjects, query_all_fields: bool = False, timeout_secs: Optional[int] = None, fields: list[str] = None, data_point=None) Union[Any, Sequence[Any]]

Compute method for querying/caching building block object histories.

Example of usage for single building block object:

sig.calc_history(dobjects=sig.obj.get('FEDL01 INDEX'))

>>> 1954-07-01    1.13
>>> 1954-07-02    1.25
>>>               ...
>>> 2019-05-23    2.38
>>> 2019-05-24    2.38
>>> Name: (LastPrice, EOD, FEDL01 INDEX), Length: 16749, dtype: float64

Example of usage for sequence of building block objects:

sig.calc_history([sig.obj.get('FEDL01 INDEX'), sig.obj.get('EUR CASH')])

>>> 1954-07-01    1.13
>>> 1954-07-02    1.25
>>>               ...
>>> 2019-05-23    2.38
>>> 2019-05-24    2.38
>>> Name: (LastPrice, EOD, FEDL01 INDEX), Length: 16749, dtype: float64,
>>> 1954-07-01    1
>>> 1954-07-02    1
>>>               ...
>>> 2019-05-26    1
>>> 2019-05-27    1
>>> Freq: D, Name: (LastPrice, EOD, EUR CASH), Length: 23707, dtype: int64
Parameters:
  • dobjects – Single or sequence of building block objects.

  • query_all_fields – Use object history_fields if True, otherwise prime_history_field (default).

  • timeout_secs – Timeout in seconds, default is 60*len(dobjects).

  • fields – overrides query_all_fields, manually specify list of fields

  • data_point – DataPoint to query

Returns:

History or histories of the corresponding building block object(s).

sigtech.framework.infra.mu.__init__.calc_remote(object_ids, timeout_secs: Optional[int] = None) Union[Any, Sequence[Any]]

Compute method for @remote decorated functions.

Example of usage for single @remote function call:

from sigtech.framework.infra.mu import remote

@remote
def remote_sum(param_1: int, param_2: int):
    return param_1 + param_2

sig.calc_remote(object_ids=remote_sum(1, 2))

# 3

Example of usage for sequence of @remote function calls:

object_ids = [remote_sum(3, 3), remote_sum(3, 6)]
sig.calc_remote(object_ids=object_ids)

# [6, 9]
Parameters:
  • object_ids – Single or sequence of object identifiers.

  • timeout_secs – Timeout in seconds, default is 60*len(dobjects).

Returns:

Single or sequence of @remote decorated return values.

sigtech.framework.infra.mu.__init__.remote(func)

Distributed concurrent compute decorator. See calc_remote method for an example of usage.