Kapacitor Multi-Indicator Batch UDF
Overview
This project implements a User-Defined Function (UDF) for Kapacitor, providing batch processing capabilities for multiple financial indicators. Currently, it supports Exponential Moving Average (EMA) and Simple Moving Average (SMA) calculations and can be easily extended for other indicators.
Features
- Batch processing of time series data
- Support for multiple indicators (EMA and SMA)
- Unix socket communication with Kapacitor
- Asynchronous processing using async-std
- Configurable options for each indicator
Requirements
- Rust 1.70 or later
- Kapacitor 1.6 or later
Installation
-
Clone the repository:
-
Build / Install the project:
or
Usage
-
Start the UDF server:
By default, the server listens on
/tmp/indicator-batch.sock. You can specify a different socket path using the-sor--socketoption: -
Configure Kapacitor to use this UDF. Add the following to your Kapacitor configuration file:
[] [] [] = "/tmp/kapacitor-multi-indicator-udf" = "10s" -
Use the UDF in your TICKscripts:
|) )
Configuration Options
type: The type of indicator to calculate (EMAorSMA)period: The period for the indicator calculationfield: The field name in the incoming data to use for calculationsas: The field name to use for the calculated indicator value in the outputticker_field: The field name containing the ticker or symbol for the data point
Development
To run with debug logging:
RUST_LOG=debug
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.