In a column-oriented design, a *feature* can be viewed as a single column.
In this project, all data is assumed to be stored in one table; therefore, all features exist as columns within this main table.
This primary data table is represented as a `pandas``DataFrame`, where features correspond to columns and rows correspond to timestamps at a specific frequency.
-`generator`: A string representing either a predefined built-in generator name or a user-defined Python function implementing a custom feature generator.
-`column_prefix`: This prefix is removed from column names before data is passed to the generator.
For example, if analyzing BTC and ETH data simultaneously, columns might include `btc_close` and `eth_close`.
However, if a generator should process only the `open` column, this can be achieved by specifying `column_prefix: btc` or `column_prefix: eth` for two features sharing the same configuration. Alternatively, the input column can be specified directly in the generator's `config` parameters.
-`feature_prefix`: This prefix (followed by an underscore) is automatically appended to all features returned by the generator.
It may match the `column_prefix`. Again, the `config` section can be used to provide a desired output name for the generated feature.
-`config`: A dictionary containing feature configuration parameters specific to each generator.
ITB provides a collection of ready-to-use feature generators that allow for the definition of standard technical indicators as well as some original features.
[TA-Lib](https://ta-lib.org/) is a native C/C++ library implementing approximately 200 indicators for financial analysis and trading applications.
It includes a [Python wrapper](https://github.com/ta-lib/ta-lib-python), which ITB uses to expose these indicators as feature definitions.
Note that using this feature generator requires the native TA-Lib binary library to be installed.
This can be accomplished in several ways:
- Install TA-Lib as a Linux package.
- Build and install TA-Lib from source, ensuring the library is accessible from Python.
- Install the native TA-Lib library via a Python package manager. For example: `$ conda install -c conda-forge libta-lib`.
- Install the Python wrapper via a package manager that supports platform-specific libraries.
For example, Conda supports this for certain platforms and Python versions: `conda install -c conda-forge ta-lib`.
- In some cases, it may be possible to locate the library manually and copy it to a location accessible from Python.
To use TA-Lib, set the generator name to `"talib"`: `"generator": "talib"`.
The generator maps `config` attributes to TA-Lib indicator arguments, calls the appropriate TA-Lib functions, and returns the results as one or more `pandas` columns attached to the main DataFrame.
The generator `config` attributes are interpreted as follows (not all are required for every feature):
-`columns`: A list of column (feature) names to pass to the TA-Lib function.
For example, `columns: ["close","high","low"]` indicates that these three price columns will be used to compute the feature.
-`functions`: A list of functions as defined in the [TA-Lib documentation](https://ta-lib.org/functions/). One feature is generated for each function name.
For example, `functions: ["SMA"]` specifies Simple Moving Average, meaning each feature value is computed as the average of several previous values.
-`windows`: A list of integers interpreted as the window size (number of previous rows, including the current time).
One feature is generated for each window value.
For example, `windows: [20]` with the `SMA` function computes a 20-row simple moving average. For daily data, this represents a 20-day moving average.
-`parameters`: A dictionary of parameters for post-processing the series of indicators returned by TA-Lib (not specific to TA-Lib itself).
These are applied to the time series resulting from different `windows` values, typically to compute relative values within the sequence.
-`rel_base`: Possible values include:
-`next`: Relative to the next element in the sequence.
-`last`: Relative to the last element in the sequence.
-`prev`: Relative to the previous element in the sequence.
-`first`: Relative to the first element in the sequence.
-`rel_func`: Defines how the new value is derived from the original and reference values:
-`diff`: Difference between the original and reference value (`value - reference_value`).
-`rel`: Ratio of the original to the reference value (`value / reference_value`).
Custom feature generators can be specified as user-defined Python functions.
In this case, the `generator` attribute in the feature definition must be a fully qualified Python function name consisting of the module name and function name separated by a colon.
Note that while the configuration dictionary may have an arbitrary format and attributes, the feature generator must adhere to this specific signature.