Skip to content

contango.strategy.rule_based.position_sizers.position_sizer

contango.strategy.rule_based.position_sizers.position_sizer

PositionSizer

Bases: Labeled, ABC, Generic[C]

Decides how many units to trade when an intent is published.

Attributes:

Name Type Description
C

The context for the PositionSizer.

size abstractmethod

size(context: C) -> int

Returns the size in units for the given context.

Source code in src\contango\strategy\rule_based\position_sizers\position_sizer.py
28
29
30
31
32
33
@abstractmethod
def size(self, context: C) -> int:
    """
    Returns the size in units for the given context.
    """
    ...

update

update(event: MarketDataEvent) -> None

Updates the state of the position sizer with the latest market data event.

Source code in src\contango\strategy\rule_based\position_sizers\position_sizer.py
22
23
24
25
26
def update(self, event: MarketDataEvent) -> None:
    """
    Updates the state of the position sizer with the latest market data event.
    """
    pass