Skip to content

Features#

lit.sdk.data.features #

This module provides functions for loading and retrieving features.

__doc__ = '\nThis module provides functions for loading and retrieving features.\n' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__file__ = '/opt/lit-platform/lit-lib/src/lit/sdk/data/features.cpython-312-x86_64-linux-gnu.so' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__name__ = 'lit.sdk.data.features' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__package__ = 'lit.sdk.data' module #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__test__ = {'load_features (line 18)': 'Gets a list of feature functions.\n\n Args:\n team (str): The name of the team which owns the features.\n features (list[str]): The names of the features to load.\n\n Returns:\n (list[Feature]): A list of loaded feature functions.\n\n Examples:\n >>> load_features("contoso", ["ohlcv_100hour", "ohlcv_100min"])\n [<function feature at 0x7f3ed7193850>, <function feature at 0x7f3ed7193850>]\n '} module #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

LitDataError #

Bases: lit.sdk.errors.LitError

A custom exception class for Lit data errors.

__annotations__ = {} class #

dict() -> new empty dictionary dict(mapping) -> new dictionary initialized from a mapping object's (key, value) pairs dict(iterable) -> new dictionary initialized as if via: d = {} for k, v in iterable: d[k] = v dict(**kwargs) -> new dictionary initialized with the name=value pairs in the keyword argument list. For example: dict(one=1, two=2)

__doc__ = 'A custom exception class for Lit data errors.' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__module__ = 'lit.sdk.errors' class #

str(object='') -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.str() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to 'strict'.

__init__(*args, code=None) method descriptor #

Initializes a new instance of LitDataError.

Parameters:

Name Type Description Default
*args object

Variable number of arguments to pass to the base class constructor.

required
code int | None

The error code. Defaults to None.

None

add_feature(team, name, script_name, parameters={}, group=None) method descriptor #

Gets the saved feature script.

Parameters:

Name Type Description Default
team str

The name of the team which owns the features.

required
name str

The name of the new feature.

required
script_name str

The name of the feature script.

required
parameters dict

The input parameters for the feature.

{}

Returns:

Type Description
Callable

A feature.

lit_error_handler(error_type=LitError) method descriptor #

A decorator function that catches and re-raises exceptions with a custom error type.

Parameters:

Name Type Description Default
error_type Type[LitError]

The type of exception to raise. Defaults to LitError.

LitError

Returns:

Type Description
Callable

A wrapper function that catches exceptions and raises the specified error type.

Examples:

>>> @lit_error_handler()
... def raises_error():
...     assert False
...
>>> raises_error()
Traceback (most recent call last):
File "/opt/lit/src/lit/sdk/errors.py", line 130, in wrapper
File "<stdin>", line 3, in raises_error
AssertionError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/opt/lit/src/lit/sdk/errors.py", line 132, in wrapper
lit.sdk.errors.LitError: An error occurred in function 'raises_error'