开云体育

ctrl + shift + ? for shortcuts
© 2025 开云体育

Re: IB-insync library - how to invoke the priceSizeTick() function


 
Edited

Hey you can use ib.reqTickByTickData and calculate your logic with it... It does return the size of the trade... Try this in Jupyter notebook. I display the last few trades every time a new tick comes...

from IPython.display import display, clear_output

contract = Stock(symbol='TSLA', exchange='SMART', currency='USD')
ib.qualifyContracts(contract)
ticker = ib.reqTickByTickData(contract=contract, tickType='Last', numberOfTicks=0)

all_ticks = []

def onUpdateEvent(ticker):
global all_ticks
all_ticks += [tick for tick in ticker.tickByTicks]
df = util.df(all_ticks)
clear_output()
display(df.tail())

ticker.updateEvent += onUpdateEvent


See at 01:08:00 (1 hour and 8 minutes) I have an example.

Join [email protected] to automatically receive all group messages.