ib_async icon indicating copy to clipboard operation
ib_async copied to clipboard

Question about the intention behind last trade update logic

Open yangyustc opened this issue 5 months ago • 3 comments

Hi, thank you for maintaining ib_async!

I have a question about the following code snippet in the logic that handles rt volume updates:

if price and size:
    if ticker.prevLast != ticker.last:
        ticker.prevLast = ticker.last
        ticker.last = price
    if ticker.prevLastSize != ticker.lastSize:
        ticker.prevLastSize = ticker.lastSize
        ticker.lastSize = size
    tick = TickData(self.lastTime, tickType, price, size)
    ticker.ticks.append(tick)

https://github.com/ib-api-reloaded/ib_async/blob/38cf54a66a4daefbd3fd1d7476381f0d178a8198/ib_async/wrapper.py#L1056

I noticed that the comparison is between prevLast and last, rather than directly between price and last. I'm wondering: what was the original intention of this logic? Is it meant to filter out certain redundant ticks?

Thanks

yangyustc avatar Jun 19 '25 21:06 yangyustc