Overseas access: www.kdjingpai.com
Bookmark Us
Current Position:fig. beginning " AI Answers

How to optimize the execution speed of VeighNa strategy backtesting?

2025-09-10 1.5 K

Performance Optimization Solutions

To address the problem of slow backtesting, efficiency can be improved by the following methods:

  • Data preprocessing::
    1. CSV historical data pre-imported into MongoDB/MySQL
    2. Establishment of timestamp indexesdb.bar_data.create_index([("datetime", ASCENDING)])
  • backtest in batches::
    - utilizationoptimize()Setting a reasonable step size for the function
    - Consolidated results after piecemeal testing by year/quarter
  • hardware acceleration::
    - Enable multi-process mode (requires modification)backtesting.py)
    - Using GPU acceleration libraries such as Numba to modify policy core functions
  • Code-Level Optimization::
    - Avoid executing database queries inside loops
    - Replacing Native Python List Operations with NumPy
    - Disable real-time chart output (setting)output=False)

Advancement Program:

  • Using the distributed backtesting component vnpy_portfoliostrategy
  • Rent a cloud server to improve standalone performance (recommended 16-core + 32GB configuration)

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

Top