hopr_strategy

Module strategy

Source
Expand description

§Multi Strategy

This strategy can stack multiple above strategies (called sub-strategies in this context) into one. Once a strategy event is triggered, it is executed sequentially on the sub-strategies one by one. The strategy can be configured to not call the next sub-strategy event if the sub-strategy currently being executed failed, which is done by setting the on_fail_continue flag.

Hence, the sub-strategy chain then can behave as a logical AND (on_fail_continue = false) execution chain or logical OR (on_fail_continue = true) execution chain.

A Multi Strategy can also contain another Multi Strategy as a sub-strategy if allow_recursive flag is set. However, this recursion is always allowed up to 2 levels only. Along with the on_fail_continue value, the recursive feature allows constructing more complex logical strategy chains.

The MultiStrategy can also observe channels being PendingToClose and running out of closure grace period, and if this happens, it will issue automatically the final close transaction, which transitions the state to Closed. This can be controlled by the finalize_channel_closure parameter.

For details on default parameters see MultiStrategyConfig.

Structs§

MultiStrategy
Defines an execution chain of SingularStrategies. The MultiStrategy itself also implements the SingularStrategy trait, which makes it possible (along with different on_fail_continue policies) to construct various logical strategy chains.
MultiStrategyConfig
Configuration options for the MultiStrategy chain. If fail_on_continue is set, the MultiStrategy sequence behaves as logical AND chain, otherwise it behaves like a logical OR chain.

Traits§

SingularStrategy
Basic single strategy.