Requesting Time and Sales data

View as MarkdownOpen in Claude

EClient.reqHistoricalTicks (

requestId: int, id of the request

contract: Contract, Contract object that is subject of query.

startDateTime: String, i.e. ā€œ20170701 12:01:00ā€. Uses TWS timezone specified at login.

endDateTime: String, i.e. ā€œ20170701 13:01:00ā€. In TWS timezone. Exactly one of startDateTime or endDateTime must be defined.

numberOfTicks: int, Number of distinct data points. Max is 1000 per request.

whatToShow: String, (Bid_Ask, Midpoint, or Trades) Type of data requested.

useRth: bool, Data from regular trading hours (1), or all available hours (0).

ignoreSize: bool, Omit updates that reflect only changes in size, and not price. Applicable to Bid_Ask data requests.
Note: Options and Future Options will only display a value of 1, unless to indicate a removed bid/ask, which will instead return a price and size value of 0.

miscOptions: list, Should be defined asĀ null; reserved for internal use.
)

Requests historical Time & Sales data for an instrument.

1self.reqHistoricalTicks(18001, contract, "20170712 21:39:33 US/Eastern", "", 10, "TRADES", 1, True, [])