RoutingState#

tradeexecutor.strategy.routing.RoutingState class.

class RoutingState[source]#

Bases: ABC

Keep the track record of already done transactions.

When performing multiple blockchain transactions for multiple trades in one cycle, we need to know what approvals and such we have already done.

Life cycle

  • Created early at the cycle

  • Used for price revaluation

  • Used for execution

  • May cache information about the past price lookups

  • Must cache information about the already on approve() etc blockchain transactions relevant to trades

  • Discarded at the end of the cycle

__init__(universe)[source]#
Parameters

universe (tradeexecutor.strategy.universe_model.StrategyExecutionUniverse) –

Methods

__init__(universe)

Attributes

universe

Each routing state is specific to the current trading universe.

__init__(universe)[source]#
Parameters

universe (tradeexecutor.strategy.universe_model.StrategyExecutionUniverse) –

universe#

Each routing state is specific to the current trading universe. The trade routing will change when new pairs are added and old goes away.