Skip to content

enums module

Named tuples and enumerated types for signals.

Defines enums and other schemas for vectorbtpro.signals.


FactoryMode namedtuple

Factory mode.

FactoryModeT(
    Entries=0,
    Exits=1,
    Both=2,
    Chain=3
)

Attributes

Entries

Generate entries only using generate_func_nb.

Takes no input signal arrays. Produces one output signal array - entries.

Such generators often have no suffix.

Exits

Generate exits only using generate_ex_func_nb.

Takes one input signal array - entries. Produces one output signal array - exits.

Such generators often have suffix 'X'.

Both

Generate both entries and exits using generate_enex_func_nb.

Takes no input signal arrays. Produces two output signal arrays - entries and exits.

Such generators often have suffix 'NX'.

Chain

Generate chain of entries and exits using generate_enex_func_nb.

Takes one input signal array - entries. Produces two output signal arrays - new_entries and exits.

Such generators often have suffix 'CX'.


SignalRelation namedtuple

SignalRelation between two masks.

SignalRelationT(
    OneOne=0,
    OneMany=1,
    ManyOne=2,
    ManyMany=3,
    Chain=4,
    AnyChain=5
)

Attributes

OneOne
One source signal maps to exactly one succeeding target signal.
OneMany
One source signal can map to one or more succeeding target signals.
ManyOne
One or more source signals can map to exactly one succeeding target signal.
ManyMany
One or more source signals can map to one or more succeeding target signals.
Chain
First source signal maps to the first target signal after it and vice versa.
AnyChain
First signal maps to the first opposite signal after it and vice versa.

StopType namedtuple

Stop type.

StopTypeT(
    SL=0,
    TSL=1,
    TTP=2,
    TP=3,
    TD=4,
    DT=5
)

GenEnContext class

GenEnContext(
    target_shape,
    only_once,
    wait,
    entries_out,
    out,
    from_i,
    to_i,
    col
)

Context of an entry signal generator.

Superclasses

  • builtins.tuple

col field

Column of the segment.


entries_out field

Output array with entries.


from_i field

Start index of the segment (inclusive).


only_once field

Whether to run the placement function only once.


out field

Current segment of the output array with entries.


target_shape field

Target shape.


to_i field

End index of the segment (exclusive).


wait field

Number of ticks to wait before placing the next entry.


GenEnExContext class

GenEnExContext(
    target_shape,
    entry_wait,
    exit_wait,
    entries_out,
    exits_out,
    entries_turn,
    wait,
    out,
    from_i,
    to_i,
    col
)

GenEnExContext(target_shape, entry_wait, exit_wait, entries_out, exits_out, entries_turn, wait, out, from_i, to_i, col)

Superclasses

  • builtins.tuple

col field

Alias for field number 10


entries_out field

Alias for field number 3


entries_turn field

Alias for field number 5


entry_wait field

Alias for field number 1


exit_wait field

Alias for field number 2


exits_out field

Alias for field number 4


from_i field

Alias for field number 8


out field

Alias for field number 7


target_shape field

Alias for field number 0


to_i field

Alias for field number 9


wait field

Alias for field number 6


GenExContext class

GenExContext(
    entries,
    until_next,
    skip_until_exit,
    exits_out,
    out,
    wait,
    from_i,
    to_i,
    col
)

Context of an entry/exit signal generator.

Superclasses

  • builtins.tuple

col field

Column of the segment.


entries field

Input array with entries.


exits_out field

Output array with exits.


from_i field

Start index of the segment (inclusive).


out field

Current segment of the output array with entries/exits.


skip_until_exit field

Whether to skip processing entry signals until the next exit.


to_i field

End index of the segment (exclusive).


until_next field

Whether to place signals up to the next entry signal.


wait field

Number of ticks to wait before placing entries/exits.


RankContext class

RankContext(
    mask,
    reset_by,
    after_false,
    after_reset,
    reset_wait,
    col,
    i,
    last_false_i,
    last_reset_i,
    all_sig_cnt,
    all_part_cnt,
    all_sig_in_part_cnt,
    nonres_sig_cnt,
    nonres_part_cnt,
    nonres_sig_in_part_cnt,
    sig_cnt,
    part_cnt,
    sig_in_part_cnt
)

Context of a ranker.

Superclasses

  • builtins.tuple

after_false field

Whether to disregard the first partition of True values if there is no False value before them.


after_reset field

Whether to disregard the first partition of True values coming before the first reset signal.


all_part_cnt field

Number of all partitions encountered including this.


all_sig_cnt field

Number of all signals encountered including this.


all_sig_in_part_cnt field

Number of signals encountered in the current partition including this.


col field

Current column.


i field

Current row.


last_false_i field

Row of the last False value in the main mask.


last_reset_i field

Row of the last True value in the resetting mask.

Doesn't take into account reset_wait.


mask field

Source mask.


nonres_part_cnt field

Number of non-resetting partitions encountered including this.


nonres_sig_cnt field

Number of non-resetting signals encountered including this.


nonres_sig_in_part_cnt field

Number of signals encountered in the current non-resetting partition including this.


part_cnt field

Number of valid and resetting partitions encountered including this.


reset_by field

Resetting mask.


reset_wait field

Number of ticks to wait before resetting the current partition.


sig_cnt field

Number of valid and resetting signals encountered including this.


sig_in_part_cnt field

Number of signals encountered in the current valid and resetting partition including this.