Replies: 1 comment
-
q1) At a glance, there are two ways to approach this: you can either set the window based on sample size or time (or you can define another one such as trade quantity.). The choice depends entirely on your objectives for standardization. For example, you can opt for a 10-minute window, in which case your sample size will vary over time. Alternatively, you can set a fixed sample size of 100, and the window's duration in terms of time will vary according to the frequency of book updates. q2) I haven't thoroughly explored that area due to its speed limitations. One useful trick is to introduce the "elapse_event" method, which elapse time based on the number of events rather than relying solely on a fixed time interval. This approach can potentially enhance the speed slightly. q3) I need more specific code to replicate the issue. Then, I'll look into it. |
Beta Was this translation helpful? Give feedback.
-
Hey!
So i was experimenting with back testing a strategy that relies more on book updates rather than on elapsing certain time intervals. The idea behind it is when some parts of the environment change in (or against) our favour we must act immediately and not wait for some interval of time to pass.
For example, i use the following code:
`
So in do_some_calculations_with_the_book_data i either analyze LOB on things like book imbalance or maybe i analyze trades or anything else and when reality of the book/trades/anything changes i try to act immediately.
The problem with such logic is it is very slow :) The backtester has to run through millions of rows of data.
I have a question though - in the market making example, you standardize imbalance essentially using z_score method while putting imbalance values into a sliding window every second. Now, will i have to use a larger window for standardization if i use logic described above? In my case, changes happen much often than each 1 second.
And another question - how would you yourself construct an event based backtesting? Using wait_next_feed or in some other way?
Aaand another question :) When i place orders on "if change > threshold:" condition, i try to monitor the status of them by iterating through hbt.orders dictionary on each feed update and when order is filled i'd like to post/cancel other orders not waiting for the threshold condition, but this seem to hang the whole backtester. Why could this be?
Beta Was this translation helpful? Give feedback.
All reactions