It reads data from the input file specified in the `feature_sets` parameter ("data" by default), generates the features defined in the `feature_sets` section, and stores the result in the output file specified in the `feature_file_name` parameter ("features" by default).
In real trading, machine learning models trained on historical data are used to predict future behavior.
The `predict_rolling` script simulates walk-forward prediction:
- Train models using available historical data (e.g., all data up to 2026-01-01).
- Apply these models to predict future behavior starting from the end of the training period for a relatively short interval (e.g., from 2026-01-01 to 2026-02-01).
- Append a new data chunk and repeat the train-predict cycle (e.g., using all data up to 2026-02-01).
The result is a table of predictions generated in small chunks using models trained on progressively growing historical data.
This simulates the train-predict workflow over time, mimicking a real-world environment.
For example, with daily data, monthly chunks could be used to keep models up to date.
The script might start from an initial date (e.g., one year ago) and perform 12 iterations, training and predicting for each subsequent month.
The final output contains one year of predictions generated in a "fair" manner that closely resembles actual deployment.
Iteration parameters are specified in the `rolling_predict` section:
-`data_start` (default: 0): Truncate input data from the start.
-`data_end` (default: null): Truncate input data from the end.
-`prediction_start`: First row for starting iterations (end of the first training dataset), e.g., "2020-01-02".
-`prediction_size`: Size of each new data chunk and prediction in rows.
-`prediction_steps`: Number of iterations to perform (e.g., 12 for 12 train-predict cycles). If None or 0, iterations continue from `prediction_start` to the end of the data.
-`use_multiprocessing`: Whether to enable multiprocessing (true or false).
-`max_workers`: Number of workers to use when multiprocessing is enabled.
Data analysis in ITB focuses on generating new features, including those based on machine learning algorithms.
This provides insights into future behavior, such as the probability that the price will increase by 2% within the next week.
However, this knowledge cannot be used *directly* for trading and reveals little about trade performance.
The primary reason is that many possible trading strategies can be derived from knowledge of future behavior.
These strategies generate buy and sell signals based on current market conditions and asset states. The simulation script bridges this gap by evaluating trade performance based on a chosen strategy and its parameters.
This file must include all derived features and should be produced by the `predict_rolling` script.
Note that the script does not evaluate performance for a single parameter set.
Instead, it evaluates a large set of parameters to identify the best-performing trade model.
The `simulate_model` section describes a set of trade models and includes the following attributes:
-`data_start`: Start simulation from this date (e.g., "1998-01-05").
-`data_end`: End simulation on this date. If empty, all available data is used.
-`direction`: "long" or "short".
-`topn_to_store`: Number of top-performing trade models (and their parameters) to store in the output file.
-`signal_generator`: Name of the generator that produces the column used for buy/sell decisions.
-`buy_sell_equal`: true or false. Indicates whether threshold parameters for buy and sell signals are symmetric.
-`grid`: Dictionary containing lists. Each combination of values from these lists constitutes one model. Attributes are lists or strings evaluated to lists
-`buy_signal_threshold`: List of values interpreted as buy thresholds to test (e.g., [0.1, 0.2, 0.3]). If provided as a string, it is evaluated as Python code and must return a list (e.g., "np.arange(0.0, 0.5, 0.1).tolist()").
-`sell_signal_threshold`: Same as above, but used to identify sell signals.