Skip to content

ContingencyLink

ContingencyLink(
    id: int,
    type: ContingencyType,
    role: Optional[ContingencyRole] = None,
    triggered: bool = False,
    triggered_time: Optional[datetime] = None,
)

Bases: Object

Links an order to a contingency, that is, a relationship with other orders of the same OrderContingency, and defines the role the order plays in it

Creates a new instance

Parameters:

Name Type Description Default
id int

The contingency id, unique within its set of contingent orders

required
type ContingencyType

The contingency type

required
role Optional[ContingencyRole]

The role of the order in this contingency, required for ContingencyType.ONE_TRIGGERS_OTHER only

None
triggered bool

For a child, whether it was already triggered

False
triggered_time Optional[datetime]

For a child, the utc time at which it was triggered

None

id

id: int

The contingency id, unique within its set of contingent orders. Orders sharing a contingency id are related through it

type

The contingency type

role

role: Optional[ContingencyRole]

The role of the order in this contingency, for a ContingencyType.ONE_TRIGGERS_OTHER contingency. Null for the other types, whose orders are all siblings

triggered

triggered: bool

For a ContingencyRole.CHILD, whether the parent filled and so the order was released to the market

triggered_time

triggered_time: Optional[datetime]

For a ContingencyRole.CHILD, the utc time at which the order was triggered, if any

clone

clone() -> ContingencyLink

Creates a copy of this instance

is_valid_role

is_valid_role(
    type: ContingencyType, role: Optional[ContingencyRole]
) -> bool

Determines whether the role is valid for the contingency type: ContingencyType.ONE_TRIGGERS_OTHER has a parent and children, while the orders of the other types are all siblings, with no role

to_string

to_string() -> str

Returns a string that represents the current object