Skip to content
All library documents

Serving Custom CSV Data to a Backtesting System

Article FMZ digest · Author: 善

Summary

The document explains how to adapt a market data collector so a backtesting system can read user supplied price data from a CSV file. A configuration flag selects CSV input, and a file path identifies the data file on the collector’s server. The service parses the header and rows, maps time and OHLCV fields into the expected schema, scales prices and volume using request precision settings, and returns the data to the backtester. When CSV mode is disabled, the existing database-backed collection and response path remains available.

The example test uses one-minute bars and checks the returned records through a simple strategy and chart comparison with the source file. This demonstrates a route for testing data beyond the exchanges and instruments already supported by the platform. The article does not report quantitative strategy results or validate data quality systematically. It also notes format constraints through its parser: the file is expected to have a recognized six-column header, with one blank header permitted, and the shown code does not document broader CSV edge cases such as malformed rows or timestamp ordering.

Key ideas

  • A configuration flag can route backtest data requests to a local CSV file instead of the collector database.
  • The service maps CSV columns into time, open, high, low, close, and volume fields expected by the backtester.
  • Price and volume values are scaled according to precision parameters supplied with the data request.
  • The example compares returned bars with the CSV contents using a simple backtest and chart.
  • The parser assumes a specific six-column schema and does not describe comprehensive validation of malformed input.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.