How to trigger a function when a new minute bar comes in.

Hi,

As I am using ibapi in Python to retrieve minute data, I need some mechanism to trigger the data processing function when a new minute bar matured.

While ib_insync offers this function by the eventkit( onBarUpdate += some_function), it does not seem to incorporate extra variables, for example, if you want to process some historic data when there are not enough bars.

This must be a newbie question. But I have no idea at this moment how to implement it?
 
Code:
def your_function():
    magic()

onBarUpdate += your_function

the += adds your function as a listener to the onBarUpdate event
 
Code:
def your_function():
    magic()

onBarUpdate += your_function

the += adds your function as a listener to the onBarUpdate event

Yes, I know this trick as it appears in the example codes. The problem now is, your_function() defined this way, can not take extra variables such as historic data.
 
Back
Top