Trade

class algotradepy.trade.Trade(contract, order, status=None)

This class defines a trade.

Parameters
  • contract (AContract) – The contract definition for this trade.

  • order (AnOrder) – The order definition for this trade.

  • status (TradeStatus, optional, default None) – The status of the trade.

property contract
property order
property status
class algotradepy.trade.TradeStatus(state, filled, remaining, ave_fill_price, order_id=None)

Defines the status of an order.

Parameters
  • state (TradeState) – The state of the order.

  • filled (float) – How much of the order was filled. Cannot exceed the order size.

  • remaining (float) – How much of the order is remaining.

  • ave_fill_price (float) – The average price at which the order was filled.

  • order_id (int, optional, default None) – The associated order’s ID.

property order_id
property state
property filled
property remaining
property ave_fill_price
class algotradepy.trade.TradeState(value)

The possible trade states.

  • SUBMITTED

  • FILLED

  • CANCELLED

  • PENDING

  • INACTIVE