ib_async.ticker
Generated from the installed ib_async 2.1.0 package. Signatures and defaults are version-specific.
Access to realtime market information.
Bar
Bar(time: datetime.datetime | None, open: float = nan, high: float = nan, low: float = nan, close: float = nan, volume: int = 0, count: int = 0) -> None
Bar(time: datetime.datetime | None, open: float = nan, high: float = nan, low: float = nan, close: float = nan, volume: int = 0, count: int = 0)
Fields
| Name | Type | Default |
|---|---|---|
time | datetime.datetime | None | required |
open | float | nan |
high | float | nan |
low | float | nan |
close | float | nan |
volume | int | 0 |
count | int | 0 |
BarList
BarList(*args)
Built-in mutable sequence.
If no argument is given, the constructor creates a new empty list. The argument must be an iterable if specified.
Midpoints
Midpoints(tickTypes, source=None)
Tick filtering event operators that emit(time, price, size).
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
on_source
on_source(self, ticker)
Emit a new value to all connected listeners.
Args: args: Argument values to emit to listeners.
TickBars
TickBars(count, source=None)
Aggregate ticks into bars that have the same number of ticks.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: count: Number of ticks to use to form one bar.
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
on_source
on_source(self, time, price, size)
Emit a new value to all connected listeners.
Args: args: Argument values to emit to listeners.
Ticker
Ticker(contract: ib_async.contract.Contract | None = None, time: datetime.datetime | None = None, timestamp: float | None = None, marketDataType: int = 1, minTick: float = nan, bid: float = nan, bidSize: float = nan, bidExchange: str = '', ask: float = nan, askSize: float = nan, askExchange: str = '', last: float = nan, lastSize: float = nan, lastExchange: str = '', lastTimestamp: datetime.datetime | None = None, prevBid: float = nan, prevBidSize: float = nan, prevAsk: float = nan, prevAskSize: float = nan, prevLast: float = nan, prevLastSize: float = nan, volume: float = nan, open: float = nan, high: float = nan, low: float = nan, close: float = nan, vwap: float = nan, low13week: float = nan, high13week: float = nan, low26week: float = nan, high26week: float = nan, low52week: float = nan, high52week: float = nan, bidYield: float = nan, askYield: float = nan, lastYield: float = nan, markPrice: float = nan, halted: float = nan, rtHistVolatility: float = nan, rtVolume: float = nan, rtTradeVolume: float = nan, rtTime: datetime.datetime | None = None, avVolume: float = nan, tradeCount: float = nan, tradeRate: float = nan, volumeRate: float = nan, volumeRate3Min: float = nan, volumeRate5Min: float = nan, volumeRate10Min: float = nan, shortable: float = nan, shortableShares: float = nan, indexFuturePremium: float = nan, futuresOpenInterest: float = nan, putOpenInterest: float = nan, callOpenInterest: float = nan, putVolume: float = nan, callVolume: float = nan, avOptionVolume: float = nan, histVolatility: float = nan, impliedVolatility: float = nan, openInterest: float = nan, lastRthTrade: float = nan, lastRegTime: str = '', optionBidExch: str = '', optionAskExch: str = '', bondFactorMultiplier: float = nan, creditmanMarkPrice: float = nan, creditmanSlowMarkPrice: float = nan, delayedLastTimestamp: datetime.datetime | None = None, delayedHalted: float = nan, reutersMutualFunds: str = '', etfNavClose: float = nan, etfNavPriorClose: float = nan, etfNavBid: float = nan, etfNavAsk: float = nan, etfNavLast: float = nan, etfFrozenNavLast: float = nan, etfNavHigh: float = nan, etfNavLow: float = nan, socialMarketAnalytics: str = '', estimatedIpoMidpoint: float = nan, finalIpoLast: float = nan, dividends: ib_async.objects.Dividends | None = None, fundamentalRatios: ib_async.objects.FundamentalRatios | None = None, ticks: list[ib_async.objects.TickData] = <factory>, tickByTicks: list[ib_async.objects.TickByTickAllLast | ib_async.objects.TickByTickBidAsk | ib_async.objects.TickByTickMidPoint] = <factory>, domBids: list[ib_async.objects.DOMLevel] = <factory>, domBidsDict: dict[int, ib_async.objects.DOMLevel] = <factory>, domAsks: list[ib_async.objects.DOMLevel] = <factory>, domAsksDict: dict[int, ib_async.objects.DOMLevel] = <factory>, domTicks: list[ib_async.objects.MktDepthData] = <factory>, bidGreeks: ib_async.objects.OptionComputation | None = None, askGreeks: ib_async.objects.OptionComputation | None = None, lastGreeks: ib_async.objects.OptionComputation | None = None, modelGreeks: ib_async.objects.OptionComputation | None = None, custGreeks: ib_async.objects.OptionComputation | None = None, bidEfp: ib_async.objects.EfpData | None = None, askEfp: ib_async.objects.EfpData | None = None, lastEfp: ib_async.objects.EfpData | None = None, openEfp: ib_async.objects.EfpData | None = None, highEfp: ib_async.objects.EfpData | None = None, lowEfp: ib_async.objects.EfpData | None = None, closeEfp: ib_async.objects.EfpData | None = None, auctionVolume: float = nan, auctionPrice: float = nan, auctionImbalance: float = nan, regulatoryImbalance: float = nan, bboExchange: str = '', snapshotPermissions: int = 0, defaults: ib_async.objects.IBDefaults = <factory>, created: bool = False) -> None
Current market data such as bid, ask, last price, etc. for a contract.
Streaming level-1 ticks of type .TickData are stored in
the ticks list.
Streaming level-2 ticks of type .MktDepthData are stored in the
domTicks list. The order book (DOM) is available as lists of
.DOMLevel in domBids and domAsks.
Streaming tick-by-tick ticks are stored in tickByTicks.
For options the .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:.Ticker)
Fields
| Name | Type | Default |
|---|---|---|
contract | ib_async.contract.Contract | None | None |
time | datetime.datetime | None | None |
timestamp | float | None | None |
marketDataType | int | 1 |
minTick | float | nan |
bid | float | nan |
bidSize | float | nan |
bidExchange | str | `` |
ask | float | nan |
askSize | float | nan |
askExchange | str | `` |
last | float | nan |
lastSize | float | nan |
lastExchange | str | `` |
lastTimestamp | datetime.datetime | None | None |
prevBid | float | nan |
prevBidSize | float | nan |
prevAsk | float | nan |
prevAskSize | float | nan |
prevLast | float | nan |
prevLastSize | float | nan |
volume | float | nan |
open | float | nan |
high | float | nan |
low | float | nan |
close | float | nan |
vwap | float | nan |
low13week | float | nan |
high13week | float | nan |
low26week | float | nan |
high26week | float | nan |
low52week | float | nan |
high52week | float | nan |
bidYield | float | nan |
askYield | float | nan |
lastYield | float | nan |
markPrice | float | nan |
halted | float | nan |
rtHistVolatility | float | nan |
rtVolume | float | nan |
rtTradeVolume | float | nan |
rtTime | datetime.datetime | None | None |
avVolume | float | nan |
tradeCount | float | nan |
tradeRate | float | nan |
volumeRate | float | nan |
volumeRate3Min | float | nan |
volumeRate5Min | float | nan |
volumeRate10Min | float | nan |
shortable | float | nan |
shortableShares | float | nan |
indexFuturePremium | float | nan |
futuresOpenInterest | float | nan |
putOpenInterest | float | nan |
callOpenInterest | float | nan |
putVolume | float | nan |
callVolume | float | nan |
avOptionVolume | float | nan |
histVolatility | float | nan |
impliedVolatility | float | nan |
openInterest | float | nan |
lastRthTrade | float | nan |
lastRegTime | str | `` |
optionBidExch | str | `` |
optionAskExch | str | `` |
bondFactorMultiplier | float | nan |
creditmanMarkPrice | float | nan |
creditmanSlowMarkPrice | float | nan |
delayedLastTimestamp | datetime.datetime | None | None |
delayedHalted | float | nan |
reutersMutualFunds | str | `` |
etfNavClose | float | nan |
etfNavPriorClose | float | nan |
etfNavBid | float | nan |
etfNavAsk | float | nan |
etfNavLast | float | nan |
etfFrozenNavLast | float | nan |
etfNavHigh | float | nan |
etfNavLow | float | nan |
socialMarketAnalytics | str | `` |
estimatedIpoMidpoint | float | nan |
finalIpoLast | float | nan |
dividends | ib_async.objects.Dividends | None | None |
fundamentalRatios | ib_async.objects.FundamentalRatios | None | None |
ticks | list | factory: list |
tickByTicks | list | factory: list |
domBids | list | factory: list |
domBidsDict | dict | factory: dict |
domAsks | list | factory: list |
domAsksDict | dict | factory: dict |
domTicks | list | factory: list |
bidGreeks | ib_async.objects.OptionComputation | None | None |
askGreeks | ib_async.objects.OptionComputation | None | None |
lastGreeks | ib_async.objects.OptionComputation | None | None |
modelGreeks | ib_async.objects.OptionComputation | None | None |
custGreeks | ib_async.objects.OptionComputation | None | None |
bidEfp | ib_async.objects.EfpData | None | None |
askEfp | ib_async.objects.EfpData | None | None |
lastEfp | ib_async.objects.EfpData | None | None |
openEfp | ib_async.objects.EfpData | None | None |
highEfp | ib_async.objects.EfpData | None | None |
lowEfp | ib_async.objects.EfpData | None | None |
closeEfp | ib_async.objects.EfpData | None | None |
auctionVolume | float | nan |
auctionPrice | float | nan |
auctionImbalance | float | nan |
regulatoryImbalance | float | nan |
bboExchange | str | `` |
snapshotPermissions | int | 0 |
defaults | IBDefaults | factory: IBDefaults |
created | bool | False |
dict
dict(obj) -> dict
Return dataclass values as dict.
This is a non-recursive variant of dataclasses.asdict.
hasBidAsk
hasBidAsk(self) -> bool
See if this ticker has a valid bid and ask.
isUnset
isUnset(self, value) -> bool
No library docstring is provided; consult the signature, type fields, and operational guides.
marketPrice
marketPrice(self) -> 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).
midpoint
midpoint(self) -> float
Return average of bid and ask, or defaults.unset if no valid bid and ask are available.
nonDefaults
nonDefaults(obj) -> dict[str, typing.Any]
For a dataclass instance get the fields that are different from the
default values and return as dict.
tuple
tuple(obj) -> tuple[typing.Any, ...]
Return dataclass values as tuple.
This is a non-recursive variant of dataclasses.astuple.
update
update(obj, *srcObjs, **kwargs) -> object
Update fields of the given dataclass object from zero or more
dataclass source objects and/or from keyword arguments.
TickerUpdateEvent
TickerUpdateEvent(_name: 'str' = '', _with_error_done_events: 'bool' = True, error_event: 'Event | None' = None, done_event: 'Event | None' = None, _value: 'AnyType' = <NoValue>, _slots: 'Final[Slots]' = <factory>, _done: 'bool' = False, _source: 'Event | None' = None, __weakref__: 'AnyType' = None, _task: 'AnyType' = None, NO_VALUE: 'Final[_NoValue]' = <NoValue>) -> None
Enable event passing between loosely coupled components. The event emits values to connected listeners and has a selection of operators to create general data flow pipelines.
Args: name: Name to use for this event.
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
asks
asks(self) -> 'Tickfilter'
Emit ask ticks.
bidasks
bidasks(self) -> 'Tickfilter'
Emit bid and ask ticks.
bids
bids(self) -> 'Tickfilter'
Emit bid ticks.
midpoints
midpoints(self) -> 'Tickfilter'
Emit midpoint ticks.
trades
trades(self) -> 'Tickfilter'
Emit trade ticks.
Tickfilter
Tickfilter(tickTypes, source=None)
Tick filtering event operators that emit(time, price, size).
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
on_source
on_source(self, ticker)
Emit a new value to all connected listeners.
Args: args: Argument values to emit to listeners.
tickbars
tickbars(self, count: int) -> 'TickBars'
Aggregate ticks into bars that have the same number of ticks.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: count: Number of ticks to use to form one bar.
timebars
timebars(self, timer: eventkit.event.Event) -> 'TimeBars'
Aggregate ticks into time bars, where the timing of new bars
is derived from a timer event.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: timer: Event for timing when a new bar starts.
volumebars
volumebars(self, volume: int) -> 'VolumeBars'
Aggregate ticks into bars that have the same volume.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: count: Number of ticks to use to form one bar.
TimeBars
TimeBars(timer, source=None)
Aggregate ticks into time bars, where the timing of new bars
is derived from a timer event.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: timer: Event for timing when a new bar starts.
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
on_source
on_source(self, time, price, size)
Emit a new value to all connected listeners.
Args: args: Argument values to emit to listeners.
VolumeBars
VolumeBars(volume, source=None)
Aggregate ticks into bars that have the same volume.
Emits a completed Bar.
This event stores a BarList of all created bars in the
bars property.
Args: count: Number of ticks to use to form one bar.
Fields
| Name | Type | Default |
|---|---|---|
_name | str | `` |
_with_error_done_events | bool | True |
error_event | Event | None | None |
done_event | Event | None | None |
_value | AnyType | <NoValue> |
_slots | Final[Slots] | factory: Slots |
_done | bool | False |
_source | Event | None | None |
__weakref__ | AnyType | None |
_task | AnyType | None |
NO_VALUE | Final[_NoValue] | <NoValue> |
on_source
on_source(self, time, price, size)
Emit a new value to all connected listeners.
Args: args: Argument values to emit to listeners.