Skip to main content

Variables

  • DATE_FORMAT: Default date format used in the systematica package.
  • SIGNAL_PARAMS: Signal parameters used in the systematica package. These parameters are used to define the trading signals and their behavior.
  • DATA_SELECTION_PARAMS: Data selection parameters used in the systematica package. These parameters are used to select the data for the trading signals.
  • LOADER_PARAMS: Loader parameters used in the systematica package. These parameters are used to load the data for the trading signals.
  • VBT_PORT_KWARGS: VectorBT portfolio keyword arguments used in the systematica package. These parameters are used to define the portfolio simulation and its behavior.
  • NON_TUNABLE_VBT_PORT_KWARGS: Non-tunable VectorBT portfolio keyword arguments used in the systematica package. These parameters are not tunable and are used to define the portfolio simulation and its behavior.
  • TUNABLE_VBT_PORT_KWARGS: Tunable VectorBT portfolio keyword arguments used in the systematica package. These parameters are tunable and are used to define the portfolio simulation and its behavior.
  • ALL_PARAMS: All parameters used in the systematica package. These parameters are used to define the trading signals, data selection, and portfolio simulation.
  • REGISTRED_SIGNAL_MODELS: Registered signal models used in the systematica package. These models are used to compute trading signals based on different strategies such as crossover, spread, and mixed strategies.
  • DEFAULT_PORTFOLIO_PARAMS: Default VectorBT portfolio parameters used in the systematica package. These parameters are used to define the portfolio simulation and its behavior. The default values are set to None or specific values as per the requirements of the systematica package.
  • SPLITTER_KWARGS_MAP: Dict[str, Callable[..., Dict[str, Any]]]: Mapping of splitters to their respective functions and required parameters. Each key corresponds to a splitter type, and the value is a function that generates the required keyword arguments for that splitter type.
  • SPLITTER_REQUIRED_PARAMS: Dict[str, set]: Required parameters for each splitter type. Each key corresponds to a splitter type, and the value is a set of required parameters for that splitter.
  • DEFAULT_NEPTUNE_INIT_RUN: Default Neptune predefined init_run fields and metadata. Please find more information about the init_run method in the Neptune Documentation.
  • DEFAULT_NEPTUNE_LOG_KWARGS: Default Neptune predefined log_kwargs fields and metadata.
  • DEFAULT_NEPTUNE_LOG_LIVE_STREAM_KWARGS: Default Neptune predefined log_kwargs fields and metadata in live_stream model.

set_bfc_theme

set_bfc_theme()
Set the Blockforce Capital theme for Plotly figures.
  1. Initialize the theme once for all figures.
  2. Apply the theme to specific figures.
  3. Use the theme with vectorbtpro.

default_splitter_kwargs

default_splitter_kwargs(
    splitter: str,
    **kwargs,
) ‑> Dict[str, Any]
Generate default keyword arguments for the specified splitter type. Parameters:
NameTypeDefaultDescription
splitterstr--The type of splitter.
kwargstp.Kwargs--Arbitrary keyword arguments, will be filtered based on the splitter type.
Raises:
TypeDescription
ValueErrorIf the splitter type is unsupported.
Returns:
TypeDescription
tp.KwargsA dictionary containing the necessary keyword arguments for the splitter.

default_create_study_kwargs

default_create_study_kwargs(
    seed: None | int,
) ‑> Dict[str, Any]
Generate default keyword arguments for optuna.create_study. Parameters:
NameTypeDefaultDescription
seedint--or None Random seed for reproducibility.
Returns:
TypeDescription
tp.KwargsDefault keyword arguments for creating an Optuna study.

default_optimize_kwargs

default_optimize_kwargs(
    n_trials: int,
    n_jobs: int,
    n_completed_trials: int,
    gc_after_trial: bool = False,
) ‑> Dict[str, Any]
Generate default keyword arguments for study.optimize. Parameters:
NameTypeDefaultDescription
n_trialsint--Number of trials to run.
n_jobsint--Number of parallel jobs (-1 to use all CPUs).
n_completed_trialsint--Number of completed trials before stopping.
gc_after_trialboolFalseFlag to determine whether to automatically run garbage collection after each trial. Set to True to run the garbage collection, False otherwise. It runs a full collection by internally calling gc.collect. If you see an increase in memory consumption over several trials, try setting this flag to True.
Returns:
TypeDescription
tp.KwargsA dictionary containing the default keyword arguments for Optuna study optimization.

NeptuneSelector

NeptuneSelector(
    run_id: str,
    trial_selector: str | int | ForwardRef('BaseTrialSelector'= None,
    column_stack: bool = False,
    group_by: bool = True,
)
Method generated by attrs for class NeptuneSelector.

Instance variables

  • model: str: The model name, which is the run ID of the Neptune run.
  • column_stack: bool: Compute vbt.PF.column_stack to combine portfolio when several trial numbers are passed. Default to False.
  • group_by: bool: Group strategy when column_stack is True. If False, compute individual backtests. Combined all strategy into a single run otherwise. Defaults to True.
  • run_id: str: The ID of the Neptune run to fetch.
  • trial_selector: str | int | BaseTrialSelector: Custom parameter selection. If None, retrieve best/params from neptune. if int, retrieve trial number. If BaseTrialSelector, retrieve params based on algorithm. Defaults to None.

FeatureConfig

FeatureConfig(
    model: Any,
    signal_model: str,
    long_entries: float,
    long_exits: float,
    short_entries: float,
    short_exits: float,
    select_symbols: str | int | List[str | int= None,
    loader_or_data: Callable = <function load_clean_data>,
    timeframe: str = None,
    start: str = '2018-01-01 UTC',
    end: str = None,
    s1: str = 'BTCUSDT',
    s2: str = 'ETHUSDT',
    suffix: str = 'h5',
    use_close: bool = True,
    freq: str = None,
    size: float | numpy.ndarray = 50,
    size_type: str | numpy.ndarray = 'valuepercent100',
    allow_partial: float | numpy.ndarray = None,
    fees: float | numpy.ndarray = None,
    fixed_fees: float | numpy.ndarray = None,
    slippage: float | numpy.ndarray = None,
    min_size: float | numpy.ndarray = None,
    max_size: float | numpy.ndarray = None,
    size_granularity: float | numpy.ndarray = None,
    sl_stop: float | numpy.ndarray = None,
    tsl_stop: float | numpy.ndarray = None,
    tp_stop: float | numpy.ndarray = None,
    accumulate: bool | str | numpy.ndarray = None,
    init_cash: float | numpy.ndarray = None,
    cash_sharing: bool = True,
    group_by: bool = True,
    call_seq: str | bool = 'auto',
    fill_pos_info: bool = False,
    log: bool | numpy.ndarray = None,
    portfolio_kwargs: Dict[str, Any] = _Nothing.NOTHING,
    model_params: Dict[str, Any] = _Nothing.NOTHING,
    idstr = None,
    study_name: str = None,
)
Configuration for a feature calculation. This class encapsulates the necessary configuration for computing a feature. It includes the feature’s name, a callable to compute the feature, a list of required data keys, and optional parameters for the computation. Method generated by attrs for class FeatureConfig.

Instance variables

  • model_name: str: Model name.
  • frequency: str: Frequency.
  • symbols: Dict[str, Any]: Function parameters.
  • loader_name: str: Loader name.
  • data_selection_params: Dict[str, Any]: Function parameters.
  • signal_params: Dict[str, Any]: Signal parameters.
  • tunable_params: Dict[str, Any]: Tunable parameters.
  • accumulate: bool | str | numpy.ndarray: Whether to accumulate orders. Defaults to None.
  • allow_partial: float | numpy.ndarray: Whether to allow partial fills. Defaults to None.
  • call_seq: str | bool: Call sequence. Defaults to auto.
  • cash_sharing: bool: Whether to share cash between assets. Defaults to True.
  • constant_params: Dict[str, Any]:
  • data: vectorbtpro.data.base.Data:
  • distributed_params: Dict[str, Any]:
  • end: str: The end date for the data in string format (e.g., YYYY-MM UTC). If None, use datetie.utcnow() to fetch the latest data possible. Default to None.
  • fees: float | numpy.ndarray: Fees per order. Defaults to None.
  • fill_pos_info: bool: Whether to fill position info. Defaults to False.
  • fixed_fees: float | numpy.ndarray: Fixed fees per order. Defaults to None.
  • freq: str: Frequency of the data. Used when cross_validate is True. Defaults to None.
  • group_by: bool: Whether to group by symbol. Defaults to True.
  • id: str: Custom searchable id.
  • init_cash: float | numpy.ndarray: Initial cash. Defaults to None.
  • loader_or_data: Callable: Default loader or data. If loader, it must accept timeframe as retriever. More information in data/loader. Defaults to load_clean_data.
  • loader_params: Dict[str, Any]:
  • log: bool | numpy.ndarray: Whether to log orders. Defaults to None.
  • long_entries: float: Long entry signals.
  • long_exits: float: Long exit signals.
  • max_size: float | numpy.ndarray: Maximum size of each order. Defaults to None.
  • metadata: Dict[str, Any]:
  • min_size: float | numpy.ndarray: Minimum size of each order. Defaults to None.
  • model: Any: Compute model, which defines the method to compute the feature.
  • model_params: Dict[str, Any]: A dictionary of optional keyword arguments needed to compute the model.
  • non_tunable_portfolio_params: Dict[str, Any]:
  • portfolio_kwargs: Dict[str, Any]: Additional keyword arguments for the portfolio simulation.
  • s1: str: First symbol.
  • s2: str: Second symbol.
  • select_symbols: str | int | List[str | int]: Symbol name (e.g., BTCUSDT or ETHUSDT) or column index (e.g., 0 or 1) to keep. If None, no filtering.
  • short_entries: float: Short entry signals.
  • short_exits: float: Short exit signals.
  • signal_model: str: Signal model used for generating signals.
  • size: float | numpy.ndarray: Size of each order. Defaults to 50.
  • size_granularity: float | numpy.ndarray: Granularity of size. Defaults to None.
  • size_type: str | numpy.ndarray: Type of size (default is “valuepercent100”).
  • sl_stop: float | numpy.ndarray: Stop-loss level. Defaults to None.
  • slippage: float | numpy.ndarray: Slippage per order. Defaults to None.
  • start: str: The start date for the data in string format (e.g., YYYY-MM UTC).
  • study_name: str: The name of the (optuna and tracker) study.
  • suffix: str: Extension (suffix) of the file to load. Defaults to h5.
  • timeframe: str: Timeframe of the file to be loaded.
  • tp_stop: float | numpy.ndarray: Take-profit level. Defaults to None.
  • tsl_stop: float | numpy.ndarray: Trailing stop-loss level. Defaults to None.
  • tunable_portfolio_params: Dict[str, Any]:
  • use_close: bool: Use close price if set to True. Otherwise, use open price.