nkaz001 / hftbacktest

A high-frequency trading and market-making backtesting and trading bot 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
2.02k stars 397 forks source link

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

Closed lli839 closed 3 months ago

lli839 commented 3 months 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 3 months 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 3 months 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.