Ticker
ib_interface.api.ticker
Access to realtime market information.
Ticker
Current market data such as bid, ask, last price, etc. for a contract.
Streaming level-1 ticks of type :class:.TickData are stored in
the ticks list.
Streaming level-2 ticks of type :class:.MktDepthData are stored in the
domTicks list. The order book (DOM) is available as lists of
:class:.DOMLevel in domBids and domAsks.
Streaming tick-by-tick ticks are stored in tickByTicks.
For options the :class:.OptionComputation values for the bid, ask, resp.
last price are stored in the bidGreeks, askGreeks resp.
lastGreeks attributes. There is also modelGreeks that conveys
the greeks as calculated by Interactive Brokers' option model.
Events:
updateEvent(ticker: :class:.Ticker)
hasBidAsk
def hasBidAsk() -> bool
See if this ticker has a valid bid and ask.
midpoint
def midpoint() -> float
Return average of bid and ask, or NaN if no valid bid and ask are available.
marketPrice
def marketPrice() -> float
Return the first available one of
- last price if within current bid/ask or no bid/ask available;
- average of bid and ask (midpoint).
TickerUpdateEvent
trades
def trades() -> Tickfilter
Emit trade ticks.
bids
def bids() -> Tickfilter
Emit bid ticks.
asks
def asks() -> Tickfilter
Emit ask ticks.
bidasks
def bidasks() -> Tickfilter
Emit bid and ask ticks.
midpoints
def midpoints() -> Tickfilter
Emit midpoint ticks.
Tickfilter
Tick filtering event operators that emit(time, price, size).
on_source
def on_source(ticker)
timebars
def timebars(timer: Event) -> TimeBars
Aggregate ticks into time bars, where the timing of new bars
is derived from a timer event.
Emits a completed :class:Bar.
This event stores a :class:BarList of all created bars in the
bars property.
Args: timer: Event for timing when a new bar starts.
tickbars
def tickbars(count: int) -> TickBars
Aggregate ticks into bars that have the same number of ticks.
Emits a completed :class:Bar.
This event stores a :class:BarList of all created bars in the
bars property.
Args: count: Number of ticks to use to form one bar.
volumebars
def volumebars(volume: int) -> VolumeBars
Aggregate ticks into bars that have the same volume.
Emits a completed :class:Bar.
This event stores a :class:BarList of all created bars in the
bars property.
Args: volume (int): Volume threshold to use to form one bar.
Midpoints
on_source
def on_source(ticker)
Bar
BarList
TimeBars
on_source
def on_source(time, price, size)
TickBars
on_source
def on_source(time, price, size)
VolumeBars
on_source
def on_source(time, price, size)