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(),
    skip_empty=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='args',
        substitute_templates=True
    ),
    post_sim_func_nb=dict(),
    post_sim_args=dict(
        type='args',
        substitute_templates=True
    ),
    pre_group_func_nb=dict(),
    pre_group_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_group_func_nb=dict(),
    post_group_args=dict(
        type='args',
        substitute_templates=True
    ),
    pre_row_func_nb=dict(),
    pre_row_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_row_func_nb=dict(),
    post_row_args=dict(
        type='args',
        substitute_templates=True
    ),
    pre_segment_func_nb=dict(),
    pre_segment_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_segment_func_nb=dict(),
    post_segment_args=dict(
        type='args',
        substitute_templates=True
    ),
    order_func_nb=dict(),
    order_args=dict(
        type='args',
        substitute_templates=True
    ),
    flex_order_func_nb=dict(),
    flex_order_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_order_func_nb=dict(),
    post_order_args=dict(
        type='args',
        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='args',
        substitute_templates=True
    ),
    signal_func_nb=dict(),
    signal_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_signal_func_nb=dict(),
    post_signal_args=dict(
        type='args',
        substitute_templates=True
    ),
    post_segment_func_nb=dict(),
    post_segment_args=dict(
        type='args',
        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(),
    skip_empty=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 cached_property

Argument attach_call_seq.


auto_call_seq cached_property

Whether automatic call sequence is enabled.


auto_sim_end cached_property

Get automatic sim_end


auto_sim_start cached_property

Get automatic sim_start


bm_close cached_property

Argument bm_close.


call_seq cached_property

Argument call_seq.


cash_deposits cached_property

Argument cash_deposits.


cash_earnings cached_property

Argument cash_earnings.


cash_sharing cached_property

Argument cash_sharing.


close cached_property

Argument close.


cs_group_lens cached_property

Cash sharing aware group lengths.


data cached_property

Argument data.


group_by cached_property

Argument group_by.


group_lens cached_property

Group lengths.


high cached_property

Argument high.


in_outputs cached_property

Argument in_outputs.


init_cash cached_property

Argument init_cash.


init_cash_mode cached_property

Initial cash mode.


init_position cached_property

Argument init_position.


init_price cached_property

Argument init_price.


keep_inout_flex cached_property

Argument keep_inout_flex.


low cached_property

Argument low.


open cached_property

Argument open.


parse_data class method

BasePFPreparer.parse_data(
    data,
    all_ohlc=False
)

Parse an instance with OHLC features.


pf_args cached_property

Arguments to be passed to the portfolio.


result cached_property

Result as an instance of PFPrepResult.


sim_end cached_property

Argument sim_end.


sim_group_lens cached_property

Simulation group lengths.


sim_start cached_property

Argument sim_start.


FDOFPreparer class

FDOFPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_def_order_func.

Superclasses

Inherited members


allow_partial cached_property

Argument allow_partial.


direction cached_property

Argument direction.


fees cached_property

Argument fees.


fixed_fees cached_property

Argument fixed_fees.


leverage cached_property

Argument leverage.


leverage_mode cached_property

Argument leverage_mode.


log cached_property

Argument log.


max_size cached_property

Argument max_size.


min_size cached_property

Argument min_size.


price cached_property

Argument price.


price_area_vio_mode cached_property

Argument price_area_vio_mode.


raise_reject cached_property

Argument raise_reject.


reject_prob cached_property

Argument reject_prob.


size cached_property

Argument size.


size_granularity cached_property

Argument size_granularity.


size_type cached_property

Argument size_type.


slippage cached_property

Argument slippage.


val_price cached_property

Argument val_price.


FOFPreparer class

FOFPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_order_func.

Superclasses

Inherited members

Subclasses


call_post_segment cached_property

Argument call_post_segment.


call_pre_segment cached_property

Argument call_pre_segment.


ffill_val_price cached_property

Argument ffill_val_price.


fill_pos_info cached_property

Argument fill_pos_info.


flex_order_args cached_property

Argument flex_order_args.


flex_order_func_nb cached_property

Argument flex_order_func_nb.


flexible cached_property

Whether the flexible mode is enabled.


max_log_records cached_property

Argument max_log_records.


max_order_records cached_property

Argument max_order_records.


order_args cached_property

Argument order_args.


order_func_nb cached_property

Argument order_func_nb.


post_group_args cached_property

Argument post_group_args.


post_group_func_nb cached_property

Argument post_group_func_nb.


post_order_args cached_property

Argument post_order_args.


post_order_func_nb cached_property

Argument post_order_func_nb.


post_row_args cached_property

Argument post_row_args.


post_row_func_nb cached_property

Argument post_row_func_nb.


post_segment_args cached_property

Argument post_segment_args.


post_segment_func_nb cached_property

Argument post_segment_func_nb.


post_sim_args cached_property

Argument post_sim_args.


post_sim_func_nb cached_property

Argument post_sim_func_nb.


pre_group_args cached_property

Argument pre_group_args.


pre_group_func_nb cached_property

Argument pre_group_func_nb.


pre_row_args cached_property

Argument pre_row_args.


pre_row_func_nb cached_property

Argument pre_row_func_nb.


pre_segment_args cached_property

Argument pre_segment_args.


pre_segment_func_nb cached_property

Argument pre_segment_func_nb.


pre_sim_args cached_property

Argument pre_sim_args.


pre_sim_func_nb cached_property

Argument pre_sim_func_nb.


row_wise cached_property

Argument row_wise.


segment_mask cached_property

Argument segment_mask.


track_value cached_property

Argument track_value.


update_value cached_property

Argument update_value.


FOPreparer class

FOPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_orders.

Superclasses

Inherited members


allow_partial cached_property

Argument allow_partial.


cash_dividends cached_property

Argument cash_dividends.


direction cached_property

Argument direction.


fees cached_property

Argument fees.


ffill_val_price cached_property

Argument ffill_val_price.


fixed_fees cached_property

Argument fixed_fees.


from_ago cached_property

Argument from_ago.


leverage cached_property

Argument leverage.


leverage_mode cached_property

Argument leverage_mode.


log cached_property

Argument log.


max_log_records cached_property

Argument max_log_records.


max_order_records cached_property

Argument max_order_records.


max_size cached_property

Argument max_size.


min_size cached_property

Argument min_size.


price cached_property

Argument price.


price_and_from_ago cached_property

Arguments price and from_ago after broadcasting.


price_area_vio_mode cached_property

Argument price_area_vio_mode.


raise_reject cached_property

Argument raise_reject.


reject_prob cached_property

Argument reject_prob.


save_returns cached_property

Argument save_returns.


save_state cached_property

Argument save_state.


save_value cached_property

Argument save_value.


size cached_property

Argument size.


size_granularity cached_property

Argument size_granularity.


size_type cached_property

Argument size_type.


skip_empty cached_property

Argument skip_empty.


slippage cached_property

Argument slippage.


update_value cached_property

Argument update_value.


val_price cached_property

Argument val_price.


FSPreparer class

FSPreparer(
    arg_config=None,
    **kwargs
)

Class for preparing Portfolio.from_signals.

Superclasses

Inherited members


accumulate cached_property

Argument accumulate.


adjust_args cached_property

Argument adjust_args.


adjust_func_nb cached_property

Argument adjust_func_nb.


allow_partial cached_property

Argument allow_partial.


basic_mode cached_property

Whether the basic mode is enabled.


cash_dividends cached_property

Argument cash_dividends.


combined_mask cached_property

Signals combined using the OR rule into a mask.


delta_format cached_property

Argument delta_format.


direction cached_property

Argument direction.


dt_stop cached_property

Argument dt_stop.


dynamic_mode cached_property

Whether the dynamic mode is enabled.


entries cached_property

Argument entries.


exits cached_property

Argument exits.


explicit_mode cached_property

Whether the explicit mode is enabled.


fees cached_property

Argument fees.


ffill_val_price cached_property

Argument ffill_val_price.


fill_pos_info cached_property

Argument fill_pos_info.


fixed_fees cached_property

Argument fixed_fees.


from_ago cached_property

Argument from_ago.


implicit_mode cached_property

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 cached_property

Argument leverage.


leverage_mode cached_property

Argument leverage_mode.


limit_delta cached_property

Argument limit_delta.


limit_expiry cached_property

Argument limit_expiry.


limit_order_price cached_property

Argument limit_order_price.


limit_reverse cached_property

Argument limit_reverse.


limit_tif cached_property

Argument limit_tif.


log cached_property

Argument log.


long_entries cached_property

Argument long_entries.


long_exits cached_property

Argument long_exits.


ls_mode cached_property

Whether direction-aware mode is enabled.


max_log_records cached_property

Argument max_log_records.


max_order_records cached_property

Argument max_order_records.


max_size cached_property

Argument max_size.


min_size cached_property

Argument min_size.


order_mode cached_property

Argument order_mode.


order_type cached_property

Argument order_type.


post_segment_args cached_property

Argument post_segment_args.


post_segment_func_nb cached_property

Argument post_segment_func_nb.


post_signal_args cached_property

Argument post_signal_args.


post_signal_func_nb cached_property

Argument post_signal_func_nb.


price cached_property

Argument price.


price_and_from_ago cached_property

Arguments price and from_ago after broadcasting.


price_area_vio_mode cached_property

Argument price_area_vio_mode.


raise_reject cached_property

Argument raise_reject.


reject_prob cached_property

Argument reject_prob.


save_returns cached_property

Argument save_returns.


save_state cached_property

Argument save_state.


save_value cached_property

Argument save_value.


short_entries cached_property

Argument short_entries.


short_exits cached_property

Argument short_exits.


signal_args cached_property

Argument signal_args.


signal_func_mode cached_property

Whether signal function mode is enabled.


signal_func_nb cached_property

Argument signal_func_nb.


signals cached_property

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


signals_mode cached_property

Whether signals mode is enabled.


size cached_property

Argument size.


size_granularity cached_property

Argument size_granularity.


size_type cached_property

Argument size_type.


skip_empty cached_property

Argument skip_empty.


sl_stop cached_property

Argument sl_stop.


slippage cached_property

Argument slippage.


stop_entry_price cached_property

Argument stop_entry_price.


stop_exit_price cached_property

Argument stop_exit_price.


stop_exit_type cached_property

Argument stop_exit_type.


stop_ladder cached_property

Argument stop_ladder.


stop_limit_delta cached_property

Argument stop_limit_delta.


stop_order_type cached_property

Argument stop_order_type.


td_stop cached_property

Argument td_stop.


time_delta_format cached_property

Argument time_delta_format.


tp_stop cached_property

Argument tp_stop.


tsl_stop cached_property

Argument tsl_stop.


tsl_th cached_property

Argument tsl_th.


update_value cached_property

Argument update_value.


upon_adj_limit_conflict cached_property

Argument upon_adj_limit_conflict.


upon_adj_stop_conflict cached_property

Argument upon_adj_stop_conflict.


upon_dir_conflict cached_property

Argument upon_dir_conflict.


upon_long_conflict cached_property

Argument upon_long_conflict.


upon_opp_limit_conflict cached_property

Argument upon_opp_limit_conflict.


upon_opp_stop_conflict cached_property

Argument upon_opp_stop_conflict.


upon_opposite_entry cached_property

Argument upon_opposite_entry.


upon_short_conflict cached_property

Argument upon_short_conflict.


upon_stop_update cached_property

Argument upon_stop_update.


use_limit_orders cached_property

Whether to use limit orders.


use_stops cached_property

Argument use_stops.


val_price cached_property

Argument val_price.


PFPrepResult class

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

Result of preparation.

Superclasses

Inherited members


pf_args cached_property

Portfolio arguments.


target_args cached_property

Target arguments.


target_func cached_property

Target function.