Orders¶
This module contains all order classes as well as helper methods for working with these.
-
class
algotradepy.orders.AnOrder(action, quantity, order_id=None, time_in_force=None, conditions=None, parent_id=None, outside_rth=False, transmit=True, oca_group='', oca_type=0, order_ref='')¶ The abstract order class defining the basic order properties.
- Parameters
action (OrderAction) – The order action.
quantity (float) – The order size.
order_id (int, optional, default None) – The order ID.
time_in_force (TimeInForce, optional, default None) – Time-in-force option.
conditions (list of ~algotradepy.orders.ACondition, optional, default None) – A list of conditions attached to the order.
parent_id (int, optional, default None) – The parent order’s ID.
-
property
order_id¶
-
property
action¶
-
property
quantity¶
-
property
time_in_force¶
-
property
conditions¶
-
property
parent_id¶
-
property
outside_rth¶
-
property
transmit¶
-
property
oca_group¶
-
property
oca_type¶
-
property
order_ref¶
-
class
algotradepy.orders.MarketOrder(action, quantity, order_id=None, **kwargs)¶ A market order definition.
-
class
algotradepy.orders.LimitOrder(action, quantity, limit_price, order_id=None, **kwargs)¶ A limit order definition.
- Parameters
action –
quantity –
limit_price (float) – The limit price for this order.
order_id –
kwargs –
-
property
limit_price¶
-
class
algotradepy.orders.TrailingStopOrder(action, quantity, trail_stop_price=None, aux_price=None, trail_percent=None, order_id=None, **kwargs)¶ A trailing stop order definition.
- Parameters
action –
quantity –
trail_stop_price (float, optional, default None) – The Trailing stop price for this order.
aux_price (float, optional, default None) – Can be specified instead of trail_percent, in which case the order is executed at aux_price away from trailing_stop_price. Must be provided if trail_percent is left blank.
trail_percent (float, optional, default None) – The percentage offset from trail_stop_price at which to execute. Must be provided if aux_price is not set.
order_id –
kwargs –
-
property
trail_stop_price¶
-
property
trail_percent¶
-
property
aux_price¶
-
class
algotradepy.orders.OrderAction(value)¶ The available order actions.
BUY
SELL
-
class
algotradepy.orders.TimeInForce(value)¶ The order time-in-force options.
DAY
GTC