Receive Market Depth

View as MarkdownOpen in Claude

EWrapper.updateMktDepth (

tickerId: int. Request identifier used to track data.

position: int. The order book’s row being updated

operation: int. Indicates a change in the row’s value.:

  • 0 = insert (insert new price into the row)·
  • 1 = update (update the existing order in the row)·
  • 2 = delete (delete the existing order at the row).

side: int. 0 for ask, 1 for bid

price: double. The order’s price

size: decimal. The order’s size
)

Returns the order book. Used for direct routed requests only.

1def updateMktDepth(self, reqId: TickerId, position: int, operation: int, side: int, price: float, size: Decimal):
2 print("UpdateMarketDepth. ReqId:", reqId, "Position:", position, "Operation:", operation, "Side:", side, "Price:", floatMaxString(price), "Size:", decimalMaxString(size))

EWrapper.updateMktDepthL2 (

tickerId: int. Request identifier used to track data.

position: int. The order book’s row being updated.

marketMaker: String. The exchange holding the order if isSmartDepth is True, otherwise the MPID of the market maker.

operation: int. Indicates a change in the row’s value.:

  • 0 = insert (insert new price into the row)·
  • 1 = update (update the existing order in the row)·
  • 2 = delete (delete the existing order at the row).

side: int. 0 for ask, 1 for bid

price: double. The order’s price

size: decimal. The order’s size

isSmartDepth: bool. Flag indicating if this is smart depth response (True) or the MPID of the market maker.
)

Returns the order book.

1def updateMktDepthL2(self, reqId: TickerId, position: int, marketMaker: str, operation: int, side: int, price: float, size: Decimal, isSmartDepth: bool):
2 print("UpdateMarketDepthL2. ReqId:", reqId, "Position:", position, "MarketMaker:", marketMaker, "Operation:", operation, "Side:", side, "Price:", floatMaxString(price), "Size:", decimalMaxString(size), "isSmartDepth:", isSmartDepth)