The topic of using Numba for Python is not covered, there is almost no explanation of the code. Who is this article aimed at, beginners? - then they won't understand without the code being chewed up. For Python experts? - they don't need it, they already know how to speed up calculations.
The second part of the article is not all smooth either. An example of optimisation with only two parameters with a very coarse step is given and a comparison is made between the full search and the optimisation algorithm, while claiming that the speedup is as much as 2 times faster. At the expense of what is achieved? - it is not explained. By reducing the number of calls to the calculation of the target function test_model_func? - but in the case of AO this very number of accesses is not shown. In fact, since the space of the task is very small, it is possible to get a speedup of 400 times, compared to a full search in this task, it is enough to generate random numbers once but to do multiple tests, and in the article to give the best result from the tests. In general, all the principles of experimentation are violated.
If I understood correctly, the tester inputs price data+trading environment (current orders) to the TS and receives trading signals from the TS.
If I understood correctly, it is somewhat different for you.
Price data + trade directions for each observation (buy, sell) that the MO has predicted.
That is, the TS is not executed inside the tester, the directions of trades are calculated and known in advance.

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Check out the new article: Fast trading strategy tester in Python using Numba.
When developing trading algorithms based on machine learning, it is important to correctly and quickly evaluate the results of their trading on history. If we take into account the rare use of the tester on large time intervals and with a small history depth, then the tester in Python is quite suitable. However, if the task involves multiple tests and high-frequency strategies, then an interpreted language may be too slow.
Let's say we are not satisfied with the execution speed of some scripts, but we do not want to give up our familiar Python development environment. This is where Numba comes to the rescue, allowing us to convert and compile native Python code into fast machine code on the fly. The execution speed of such a code becomes comparable to the execution speed of code in programming languages, such as C and FORTRAN.
Author: Maxim Dmitrievsky