trade29.sc.AttachedOrder#

class trade29.sc.AttachedOrder(quantity: float, target_offset: float = 0, target_price: float = 0, stop_offset: float = 0, stop_price: float = 0)#

Represents a child OCO order.

This order is attached to another order such that it will be executed in the direction opposite to the parent order when the price meets the conditions specified in the parameters. Note that both a stop and target offset/price can be set at the same time, but it doesnt make sense to set both a stop/target offset and price at the same time, as setting a target is simply a proxy for setting an offset.

Parameters:
quantityint

The quantity to buy/sell when the order is executed

target_offsetint, default 0

Setting target offset makes this order behave like a limit order (see OrderType) and sets its limit price relative to the parent order price.

target_priceint, default 0

Setting target price makes this order behave like a limit order (see OrderType) and sets its absolute limit price. Note that in practice, setting an absolute price will just set a offset price taking the offset between the absolute price and the parent price at submission. For example, if an OCO is submitted when a parent is at 100.0 with a child with an absolute target price of 105.0, and said parent moves suddenly such that it is filled at 100.5, then the child will be adjusted to have a target of 105.5.

stop_offsetint, default 0

Setting target offset makes this order behave like a stop order (see OrderType) and sets its stop price relative to the parent order price.

stop_priceint, default 0

Setting stop price makes this order behave like a stop order (see OrderType) and sets its absolute stop price. Note that in practice, setting an absolute price will just set a offset price taking the offset between the absolute price and the parent price at submission. For example, if an OCO is submitted when a parent is at 100.0 with a child with an absolute stop price of 105.0, and said parent moves suddenly such that it is filled at 100.5, then the child will be adjusted to have a stop price of 105.5.