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.01k stars 395 forks source link

How to get historical market data during the backtesting process #156

Closed loorr closed 2 weeks ago

loorr commented 2 weeks ago

I want to obtain historical prices, trading volumes and other market data before the current time point during the backtesting process to help me post new orders or cancel orders at the current moment. How can I obtain historical market data during the backtesting process?

nkaz001 commented 2 weeks ago

You'll need to store past values manually. For example, if you're working with time-series data for prices at specific intervals, you should record these values in an array or list. Here’s an example that might help.

loorr commented 2 weeks ago

Thanks for your help, this is very useful!