hbdmapi / huobi_futures_Python

An Asynchronous Event-driven High-frequency Trading System,huobi future,huobi coin margined swap, huobi usdt margined swap included.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Time delay in order books and market trade

igkoh opened this issue · comments

commented

Time delay in order books and market trade

_async def on_event_orderbook_update(self, orderbook: Orderbook):
self.last_orderbook_timestamp = orderbook.timestamp
self.timeNow=time.time()
dif=self.timeNow-float(self.last_orderbook_timestamp )/float(1000)

async def on_event_trade_update(self, trade: MarketTrade):
self.last_trade_timestamp=trade.timestamp
self.timeNow=time.time()
dif=self.timeNow-float(self.last_trade_timestamp)/float(1000 )_

No time delay is detected in order book. Market trade data shows 0.4 second(400 millisecond)
delay in the extreme market condition
.

I want to understand why this phenomena is observed.

Orderbook is simple where maker puts order in the queue in order books.
Market trades are heavily populated in the extreme market condition. Matching engines are overloaden
to handle large number of taker and maker / unit time. Each of partial fills are sent to database of
order owner.

If there are other reasons other than large number of matching between taker and maker during the extreme market condition.
kindly let me know.

The followin png is future price and market trade time delay at 2020-08-09- 17:54 (GMT +8 ). Observe that
trade delay time is less than 100 millisecond normally, but increase to 300 millisecond .
MarketTradeTimeDelay

Best regards,
Ingyu

Hi @igkoh Just as you said,Market trades are heavily populated in the extreme market condition.It increase to 300 millisecond during the extreme market condition.We are planing to improve the performance of our system in September.The delay will be greatly reduced in the next version in September.

@igkoh Did you encounter this issue at 2020-08-10?

commented

@foonsun , today I have not monitored. The matching engine of maker and taker have CPU clock and cannot match all the incoming flux of new takers in very short of amount of time. Even after matching of maker and taker with the last_trade_timestamp, matching engines report to the owner of maker and taker in a short amount time. This will inevitably introduce time delay. Accept the mechanism of matching engines and find a prediction model based on the details of matching engines.
Best regards,
Ingyu

Thanks for your feedback.pls feel free to post the issues if you encounter the time delay.