What would be the best approach to continuously update a limit order? 

Let's say I have an equity, MSFT, in my on data method, I obtain the current bid/ask spread, then create a buy limit order at the current bid price. The order is sent to the broker. 

I understand that this will generate an OrderEvent that will be consumed by the OnOrderEvent method and within this method I can check the status. 

My question is how can I continuous update the limit order so that I can obtain the best fill price. For example, let's say MSFT is trading at 215,1.0 and current bid is 215.05 and current ask is 215.20. I'd like to place initial bid price at 215.05, then wait 3 seconds, if it doesn't fill, then update the limit order to 215.06, and the process continues until filled. 

Where in the algorithm would be the best place to code this? In the OnOrderEvent? Or should it somehow be done in the OnData method? Or in another method? Also, how can I handle this asynchronously so that it doesn't block my code. 

Any help would be greatly appreciated. 

Python is preferred. 

Author