Path: blob/master/src/ordermgmt/Order.py
296 views
1class Order:2def __init__(self, orderInputParams = None):3self.tradingSymbol = orderInputParams.tradingSymbol if orderInputParams != None else ""4self.exchange = orderInputParams.exchange if orderInputParams != None else "NSE"5self.productType = orderInputParams.productType if orderInputParams != None else ""6self.orderType = orderInputParams.orderType if orderInputParams != None else "" # LIMIT/MARKET/SL-LIMIT/SL-MARKET7self.price = orderInputParams.price if orderInputParams != None else 08self.triggerPrice = orderInputParams.triggerPrice if orderInputParams != None else 0 # Applicable in case of SL orders9self.qty = orderInputParams.qty if orderInputParams != None else 010self.orderId = None # The order id received from broker after placing the order11self.orderStatus = None # One of the status defined in ordermgmt.OrderStatus12self.averagePrice = 0 # Average price at which the order is filled13self.filledQty = 0 # Filled quantity14self.pendingQty = 0 # Qty - Filled quantity15self.orderPlaceTimestamp = None # Timestamp when the order is placed16self.lastOrderUpdateTimestamp = None # Applicable if you modify the order Ex: Trailing SL17self.message = None # In case any order rejection or any other error save the response from broker in this field1819def __str__(self):20return "orderId=" + str(self.orderId) + ", orderStatus=" + str(self.orderStatus) \21+ ", symbol=" + str(self.tradingSymbol) + ", productType=" + str(self.productType) \22+ ", orderType=" + str(self.orderType) + ", price=" + str(self.price) \23+ ", triggerPrice=" + str(self.triggerPrice) + ", qty=" + str(self.qty) \24+ ", filledQty=" + str(self.filledQty) + ", pendingQty=" + str(self.pendingQty) \25+ ", averagePrice=" + str(self.averagePrice)262728