Creating an Order object with the IB API
Similar to how a Contract
object encapsulates all the information IB needs for financial instruments, Order
objects contain all the information required for IB to correctly place orders in the market. IB is famous for having dozens of order types, from simple market orders to advanced algorithms that slowly execute trades based on time or volume conditions. Key attributes of the Order
class include the following:
orderId
: A unique identifier for the order, typically assigned by the clientaction
: Specifies the action type of the order, such asBUY
orSELL
totalQuantity
: The amount of the asset to be bought or soldorderType
: Defines the type of order, such asLMT
for limit orders orMKT
for market orderslmtPrice
: The limit price for limit ordersauxPrice
: Used for stop or stop-limit orders to specify the stop pricetif
: Time in force, determining how long the order remains activeoutsideRTH
: A boolean indicating...