Core API

class pab.core.PAB(root: Path, keyfiles: Optional[list[pathlib.Path]] = None, envs: Optional[list[str]] = None)

Loads PAB project from a given path, including configs from all sources, strategies from the strategies module, and accounts.

class pab.core.Runner(pab: PAB)

Base class for PAB Runners.

Runners execute PAB strategies in different manners. All runners must implement run.

abstract run()

Main run method.

_abc_impl = <_abc._abc_data object>
class pab.core.TasksRunner(*args)

Loads and runs tasks from tasks.json.

ITERATION_SLEEP = 60
run()

Main run method.

process_tasks()
process_item(item: Task)
_sleep()
_abc_impl = <_abc._abc_data object>
class pab.core.StratParam(name: 'str', type: 'Callable | str', default: 'Any')
name: str
type: Union[Callable, str]
default: Any
class pab.core.SingleStrategyRunner(*args, strategy: str, params: list[str])

Runs a single strategy, one time, with custom parameters.

TYPES = {'float': <class 'float'>, 'int': <class 'int'>, 'str': <class 'str'>}
run()

Main run method.

_parse_params(strat_class: type[pab.strategy.BaseStrategy]) Namespace
_get_strat_parser(strat_class: type[pab.strategy.BaseStrategy]) ArgumentParser

Builds an ArgumentParser from the signature of the current strategy __init__ method.

_validate_and_get_param_type(param: StratParam) Callable
_get_strat_params(strat) set[pab.core.StratParam]

Recursively retrieve a list of all keyword parameters for a strategy constructor.

_get_base_params() list[str]

Returns the names of the base parameters of BaseStrategy.

_abc_impl = <_abc._abc_data object>