nkaz001 / hftbacktest

A high-frequency trading and market-making backtesting tool in Python and Rust, which accounts for limit orders, queue positions, and latencies, utilizing full tick data for trades and order books, with real-world crypto market-making examples for Binance Futures
MIT License
1.78k stars 357 forks source link

Is hbt.elapse(100_000_000) used in live trading? #132

Closed lli839 closed 2 weeks ago

lli839 commented 2 weeks ago

hi, hbt.elapse(100_000_000) is used in both backtesting and live trading code samples. My understanding of hbt.elapse() is to accumulate events happening during that time window(100ms in above case), then make trade decision based on the latest time window's data.

My original hunch is that it's fine for backtesting. However, I guess we should not use it in live trading code since many things happening during that time window. Maybe a more practical way is to actively react to each event received through TCP connection?

Moreover, do you have a discord channel?

nkaz001 commented 2 weeks ago

If you want to react more frequently, you can decrease the elapsed interval or use the wait_next_feed method. In any case, I believe a strategy should be validated through backtesting first. The strategy should exhibit the same behavior as it did during backtesting and vice-versa.

https://discord.gg/K9pDsWrPEe

lli839 commented 2 weeks ago

If you want to react more frequently, you can decrease the elapsed interval or use the wait_next_feed method. In any case, I believe a strategy should be validated through backtesting first. The strategy should exhibit the same behavior as it did during backtesting and vice-versa.

https://discord.gg/K9pDsWrPEe

That makes sense. Appreciate your reply.