Skip to content

preparing module

Classes for preparing portfolio simulations.


base_arg_config ReadonlyConfig

Argument config for BasePFPreparer.

ReadonlyConfig(
    data=dict(),
    open=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    high=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    low=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    close=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    bm_close=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    cash_earnings=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    init_cash=dict(
        map_enum_kwargs=dict(
            enum=InitCashModeT(
                Auto=-1,
                AutoAlign=-2
            ),
            look_for_type=<class 'str'>
        )
    ),
    init_position=dict(),
    init_price=dict(),
    cash_deposits=dict(),
    group_by=dict(),
    cash_sharing=dict(),
    freq=dict(),
    sim_start=dict(),
    sim_end=dict(),
    call_seq=dict(
        map_enum_kwargs=dict(
            enum=CallSeqTypeT(
                Default=0,
                Reversed=1,
                Random=2,
                Auto=3
            ),
            look_for_type=<class 'str'>
        )
    ),
    attach_call_seq=dict(),
    keep_inout_flex=dict(),
    in_outputs=dict(
        has_default=False
    )
)

fdof_arg_config ReadonlyConfig

Argument config for FDOFPreparer.

ReadonlyConfig(
    val_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=ValPriceTypeT(
                Latest=-np.inf,
                Price=np.inf
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    flexible=dict()
)

fo_arg_config ReadonlyConfig

Argument config for FOPreparer.

ReadonlyConfig(
    cash_dividends=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    val_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=ValPriceTypeT(
                Latest=-np.inf,
                Price=np.inf
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    from_ago=dict(
        broadcast=True,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    ffill_val_price=dict(),
    update_value=dict(),
    save_state=dict(),
    save_value=dict(),
    save_returns=dict(),
    max_order_records=dict(),
    max_log_records=dict()
)

fof_arg_config ReadonlyConfig

Argument config for FOFPreparer.

ReadonlyConfig(
    segment_mask=dict(),
    call_pre_segment=dict(),
    call_post_segment=dict(),
    pre_sim_func_nb=dict(),
    pre_sim_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_sim_func_nb=dict(),
    post_sim_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    pre_group_func_nb=dict(),
    pre_group_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_group_func_nb=dict(),
    post_group_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    pre_row_func_nb=dict(),
    pre_row_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_row_func_nb=dict(),
    post_row_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    pre_segment_func_nb=dict(),
    pre_segment_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_segment_func_nb=dict(),
    post_segment_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    order_func_nb=dict(),
    order_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    flex_order_func_nb=dict(),
    flex_order_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_order_func_nb=dict(),
    post_order_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    ffill_val_price=dict(),
    update_value=dict(),
    fill_pos_info=dict(),
    track_value=dict(),
    row_wise=dict(),
    max_order_records=dict(),
    max_log_records=dict()
)

fs_arg_config ReadonlyConfig

Argument config for FSPreparer.

ReadonlyConfig(
    size=dict(
        fill_default=True
    ),
    cash_dividends=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    entries=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    exits=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    long_entries=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    long_exits=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    short_entries=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    short_exits=dict(
        has_default=False,
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    adjust_func_nb=dict(),
    adjust_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    signal_func_nb=dict(),
    signal_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_signal_func_nb=dict(),
    post_signal_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    post_segment_func_nb=dict(),
    post_segment_args=dict(
        type=<class 'tuple'>,
        substitute_templates=True
    ),
    order_mode=dict(),
    val_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=ValPriceTypeT(
                Latest=-np.inf,
                Price=np.inf
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    accumulate=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=AccumulationModeT(
                Disabled=0,
                Both=1,
                AddOnly=2,
                RemoveOnly=3
            ),
            ignore_type=(
                <class 'int'>,
                <class 'bool'>
            )
        ),
        subdtype=(
            <class 'numpy.integer'>,
            <class 'numpy.bool_'>
        ),
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    upon_long_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=ConflictModeT(
                Ignore=0,
                Entry=1,
                Exit=2,
                Adjacent=3,
                Opposite=4
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    upon_short_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=ConflictModeT(
                Ignore=0,
                Entry=1,
                Exit=2,
                Adjacent=3,
                Opposite=4
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    upon_dir_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=DirectionConflictModeT(
                Ignore=0,
                Long=1,
                Short=2,
                Adjacent=3,
                Opposite=4
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    upon_opposite_entry=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=OppositeEntryModeT(
                Ignore=0,
                Close=1,
                CloseReduce=2,
                Reverse=3,
                ReverseReduce=4
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=4
            )
        )
    ),
    order_type=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=OrderTypeT(
                Market=0,
                Limit=1
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    limit_delta=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    limit_tif=dict(
        broadcast=True,
        is_td=True,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    limit_expiry=dict(
        broadcast=True,
        is_dt=True,
        last_before=False,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    limit_reverse=dict(
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    limit_order_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=LimitOrderPriceT(
                Limit=-1,
                HardLimit=-2,
                Close=-3
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    upon_adj_limit_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PendingConflictModeT(
                KeepIgnore=0,
                KeepExecute=1,
                CancelIgnore=2,
                CancelExecute=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    upon_opp_limit_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PendingConflictModeT(
                KeepIgnore=0,
                KeepExecute=1,
                CancelIgnore=2,
                CancelExecute=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=3
            )
        )
    ),
    use_stops=dict(),
    stop_ladder=dict(
        map_enum_kwargs=dict(
            enum=StopLadderModeT(
                Disabled=0,
                Uniform=1,
                Weighted=2,
                AdaptUniform=3,
                AdaptWeighted=4,
                Dynamic=5
            ),
            look_for_type=<class 'str'>
        )
    ),
    sl_stop=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    tsl_stop=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    tsl_th=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    tp_stop=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    td_stop=dict(
        broadcast=True,
        is_td=True,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    dt_stop=dict(
        broadcast=True,
        is_dt=True,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    stop_entry_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=StopEntryPriceT(
                ValPrice=-1,
                Open=-2,
                Price=-3,
                FillPrice=-4,
                Close=-5
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-5
            )
        )
    ),
    stop_exit_price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=StopExitPriceT(
                Stop=-1,
                HardStop=-2,
                Close=-3
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=-1
            )
        )
    ),
    stop_exit_type=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=StopExitTypeT(
                Close=0,
                CloseReduce=1,
                Reverse=2,
                ReverseReduce=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    stop_order_type=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=OrderTypeT(
                Market=0,
                Limit=1
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    stop_limit_delta=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    upon_stop_update=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=StopUpdateModeT(
                Keep=0,
                Override=1,
                OverrideNaN=2
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1
            )
        )
    ),
    upon_adj_stop_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PendingConflictModeT(
                KeepIgnore=0,
                KeepExecute=1,
                CancelIgnore=2,
                CancelExecute=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1
            )
        )
    ),
    upon_opp_stop_conflict=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PendingConflictModeT(
                KeepIgnore=0,
                KeepExecute=1,
                CancelIgnore=2,
                CancelExecute=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1
            )
        )
    ),
    delta_format=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=DeltaFormatT(
                Absolute=0,
                Percent=1,
                Percent100=2,
                Target=3
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1
            )
        )
    ),
    time_delta_format=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=TimeDeltaFormatT(
                Rows=0,
                Index=1
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1
            )
        )
    ),
    from_ago=dict(
        broadcast=True,
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    ffill_val_price=dict(),
    update_value=dict(),
    fill_pos_info=dict(),
    save_state=dict(),
    save_value=dict(),
    save_returns=dict(),
    max_order_records=dict(),
    max_log_records=dict(),
    records=dict(
        rename_fields=dict(
            entry='entries',
            exit='exits',
            long_entry='long_entries',
            long_exit='long_exits',
            short_entry='short_entries',
            short_exit='short_exits'
        )
    )
)

order_arg_config ReadonlyConfig

Argument config for order-related information.

ReadonlyConfig(
    size=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        ),
        fill_default=False
    ),
    price=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PriceTypeT(
                Open=-np.inf,
                Close=np.inf,
                NextOpen=-1,
                NextClose=-2,
                NextValidOpen=-3,
                NextValidClose=-4
            ),
            ignore_type=(
                <class 'int'>,
                <class 'float'>
            )
        ),
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.inf
            )
        )
    ),
    size_type=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=SizeTypeT(
                Amount=0,
                Value=1,
                Percent=2,
                Percent100=3,
                ValuePercent=4,
                ValuePercent100=5,
                TargetAmount=6,
                TargetValue=7,
                TargetPercent=8,
                TargetPercent100=9
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    direction=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=DirectionT(
                LongOnly=0,
                ShortOnly=1,
                Both=2
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=2
            )
        )
    ),
    fees=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    fixed_fees=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    slippage=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    min_size=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    max_size=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    size_granularity=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=np.nan
            )
        )
    ),
    leverage=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=1.0
            )
        )
    ),
    leverage_mode=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=LeverageModeT(
                Lazy=0,
                Eager=1
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    reject_prob=dict(
        broadcast=True,
        subdtype=<class 'numpy.number'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0.0
            )
        )
    ),
    price_area_vio_mode=dict(
        broadcast=True,
        map_enum_kwargs=dict(
            enum=PriceAreaVioModeT(
                Ignore=0,
                Cap=1,
                Error=2
            )
        ),
        subdtype=<class 'numpy.integer'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=0
            )
        )
    ),
    allow_partial=dict(
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=True
            )
        )
    ),
    raise_reject=dict(
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    ),
    log=dict(
        broadcast=True,
        subdtype=<class 'numpy.bool_'>,
        broadcast_kwargs=dict(
            reindex_kwargs=dict(
                fill_value=False
            )
        )
    )
)

valid_price_from_ago_1d_nb function

valid_price_from_ago_1d_nb(
    price
)

Parse from_ago from a valid price.


BasePFPreparer class

BasePFPreparer(
    arg_config=None,
    **kwargs
)

Base class for preparing portfolio simulations.

Superclasses

Inherited members

Subclasses


align_pc_arr method

BasePFPreparer.align_pc_arr(
    arr,
    group_lens=None,
    check_dtype=None,
    cast_to_dtype=None,
    reduce_func=None,
    arg_name=None
)

Align a per-column array.


attach_call_seq method

Argument attach_call_seq.


auto_call_seq method

Whether automatic call sequence is enabled.


auto_sim_end method

Get automatic sim_end


auto_sim_start method

Get automatic sim_start


bm_close method

Argument bm_close.


call_seq method

Argument call_seq.


cash_deposits method

Argument cash_deposits.


cash_earnings method

Argument cash_earnings.


cash_sharing method

Argument cash_sharing.


close method

Argument close.


cs_group_lens method

Cash sharing aware group lengths.


data method

Argument data.


group_by method

Argument group_by.


group_lens method

Group lengths.


high method

Argument high.


in_outputs method

Argument in_outputs.


init_cash method

Argument init_cash.


init_cash_mode method

Initial cash mode.


init_position method

Argument init_position.


init_price method

Argument init_price.


keep_inout_flex method

Argument keep_inout_flex.


low method

Argument low.


open method

Argument open.


parse_data class method

BasePFPreparer.parse_data(
    data,
    all_ohlc=False
)

Parse an instance with OHLC features.


pf_args method

Arguments to be passed to the portfolio.


result method

Result as an instance of PFPrepResult.


sim_end method

Argument sim_end.


sim_group_lens method

Simulation group lengths.


sim_start method

Argument sim_start.


FDOFPreparer class

FDOFPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_def_order_func().

Superclasses

Inherited members


allow_partial method

Argument allow_partial.


direction method

Argument direction.


fees method

Argument fees.


fixed_fees method

Argument fixed_fees.


leverage method

Argument leverage.


leverage_mode method

Argument leverage_mode.


log method

Argument log.


max_size method

Argument max_size.


min_size method

Argument min_size.


price method

Argument price.


price_area_vio_mode method

Argument price_area_vio_mode.


raise_reject method

Argument raise_reject.


reject_prob method

Argument reject_prob.


size method

Argument size.


size_granularity method

Argument size_granularity.


size_type method

Argument size_type.


slippage method

Argument slippage.


val_price method

Argument val_price.


FOFPreparer class

FOFPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_order_func().

Superclasses

Inherited members

Subclasses


call_post_segment method

Argument call_post_segment.


call_pre_segment method

Argument call_pre_segment.


ffill_val_price method

Argument ffill_val_price.


fill_pos_info method

Argument fill_pos_info.


flex_order_args method

Argument flex_order_args.


flex_order_func_nb method

Argument flex_order_func_nb.


flexible method

Whether the flexible mode is enabled.


max_log_records method

Argument max_log_records.


max_order_records method

Argument max_order_records.


order_args method

Argument order_args.


order_func_nb method

Argument order_func_nb.


post_group_args method

Argument post_group_args.


post_group_func_nb method

Argument post_group_func_nb.


post_order_args method

Argument post_order_args.


post_order_func_nb method

Argument post_order_func_nb.


post_row_args method

Argument post_row_args.


post_row_func_nb method

Argument post_row_func_nb.


post_segment_args method

Argument post_segment_args.


post_segment_func_nb method

Argument post_segment_func_nb.


post_sim_args method

Argument post_sim_args.


post_sim_func_nb method

Argument post_sim_func_nb.


pre_group_args method

Argument pre_group_args.


pre_group_func_nb method

Argument pre_group_func_nb.


pre_row_args method

Argument pre_row_args.


pre_row_func_nb method

Argument pre_row_func_nb.


pre_segment_args method

Argument pre_segment_args.


pre_segment_func_nb method

Argument pre_segment_func_nb.


pre_sim_args method

Argument pre_sim_args.


pre_sim_func_nb method

Argument pre_sim_func_nb.


row_wise method

Argument row_wise.


segment_mask method

Argument segment_mask.


track_value method

Argument track_value.


update_value method

Argument update_value.


FOPreparer class

FOPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_orders().

Superclasses

Inherited members


allow_partial method

Argument allow_partial.


cash_dividends method

Argument cash_dividends.


direction method

Argument direction.


fees method

Argument fees.


ffill_val_price method

Argument ffill_val_price.


fixed_fees method

Argument fixed_fees.


from_ago method

Argument from_ago.


leverage method

Argument leverage.


leverage_mode method

Argument leverage_mode.


log method

Argument log.


max_log_records method

Argument max_log_records.


max_order_records method

Argument max_order_records.


max_size method

Argument max_size.


min_size method

Argument min_size.


price method

Argument price.


price_and_from_ago method

Arguments price and from_ago after broadcasting.


price_area_vio_mode method

Argument price_area_vio_mode.


raise_reject method

Argument raise_reject.


reject_prob method

Argument reject_prob.


save_returns method

Argument save_returns.


save_state method

Argument save_state.


save_value method

Argument save_value.


size method

Argument size.


size_granularity method

Argument size_granularity.


size_type method

Argument size_type.


slippage method

Argument slippage.


update_value method

Argument update_value.


val_price method

Argument val_price.


FSPreparer class

FSPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_signals().

Superclasses

Inherited members


accumulate method

Argument accumulate.


adjust_args method

Argument adjust_args.


adjust_func_nb method

Argument adjust_func_nb.


allow_partial method

Argument allow_partial.


basic_mode method

Whether the basic mode is enabled.


cash_dividends method

Argument cash_dividends.


combined_mask method

Signals combined using the OR rule into a mask.


delta_format method

Argument delta_format.


direction method

Argument direction.


dt_stop method

Argument dt_stop.


dynamic_mode method

Whether the dynamic mode is enabled.


entries method

Argument entries.


exits method

Argument exits.


explicit_mode method

Whether the explicit mode is enabled.


fees method

Argument fees.


ffill_val_price method

Argument ffill_val_price.


fill_pos_info method

Argument fill_pos_info.


fixed_fees method

Argument fixed_fees.


from_ago method

Argument from_ago.


implicit_mode method

Whether the explicit mode is enabled.


init_in_outputs class method

FSPreparer.init_in_outputs(
    wrapper,
    group_lens=None,
    cash_sharing=False,
    save_state=True,
    save_value=True,
    save_returns=True
)

Initialize FSInOutputs.


leverage method

Argument leverage.


leverage_mode method

Argument leverage_mode.


limit_delta method

Argument limit_delta.


limit_expiry method

Argument limit_expiry.


limit_order_price method

Argument limit_order_price.


limit_reverse method

Argument limit_reverse.


limit_tif method

Argument limit_tif.


log method

Argument log.


long_entries method

Argument long_entries.


long_exits method

Argument long_exits.


ls_mode method

Whether direction-aware mode is enabled.


max_log_records method

Argument max_log_records.


max_order_records method

Argument max_order_records.


max_size method

Argument max_size.


min_size method

Argument min_size.


order_mode method

Argument order_mode.


order_type method

Argument order_type.


post_segment_args method

Argument post_segment_args.


post_segment_func_nb method

Argument post_segment_func_nb.


post_signal_args method

Argument post_signal_args.


post_signal_func_nb method

Argument post_signal_func_nb.


price method

Argument price.


price_and_from_ago method

Arguments price and from_ago after broadcasting.


price_area_vio_mode method

Argument price_area_vio_mode.


raise_reject method

Argument raise_reject.


reject_prob method

Argument reject_prob.


save_returns method

Argument save_returns.


save_state method

Argument save_state.


save_value method

Argument save_value.


short_entries method

Argument short_entries.


short_exits method

Argument short_exits.


signal_args method

Argument signal_args.


signal_func_mode method

Whether signal function mode is enabled.


signal_func_nb method

Argument signal_func_nb.


signals method

Arguments entries, exits, short_entries, and short_exits after broadcasting.


signals_mode method

Whether signals mode is enabled.


size method

Argument size.


size_granularity method

Argument size_granularity.


size_type method

Argument size_type.


sl_stop method

Argument sl_stop.


slippage method

Argument slippage.


stop_entry_price method

Argument stop_entry_price.


stop_exit_price method

Argument stop_exit_price.


stop_exit_type method

Argument stop_exit_type.


stop_ladder method

Argument stop_ladder.


stop_limit_delta method

Argument stop_limit_delta.


stop_order_type method

Argument stop_order_type.


td_stop method

Argument td_stop.


time_delta_format method

Argument time_delta_format.


tp_stop method

Argument tp_stop.


tsl_stop method

Argument tsl_stop.


tsl_th method

Argument tsl_th.


update_value method

Argument update_value.


upon_adj_limit_conflict method

Argument upon_adj_limit_conflict.


upon_adj_stop_conflict method

Argument upon_adj_stop_conflict.


upon_dir_conflict method

Argument upon_dir_conflict.


upon_long_conflict method

Argument upon_long_conflict.


upon_opp_limit_conflict method

Argument upon_opp_limit_conflict.


upon_opp_stop_conflict method

Argument upon_opp_stop_conflict.


upon_opposite_entry method

Argument upon_opposite_entry.


upon_short_conflict method

Argument upon_short_conflict.


upon_stop_update method

Argument upon_stop_update.


use_limit_orders method

Whether to use limit orders.


use_stops method

Argument use_stops.


val_price method

Argument val_price.


PFPrepResult class

PFPrepResult(
    target_func=None,
    target_args=None,
    pf_args=None
)

Result of preparation.

Superclasses

Inherited members


pf_args method

Portfolio arguments.


target_args method

Target arguments.


target_func method

Target function.