The Freqtrade Operator is a Kubernetes operator designed to manage Freqtrade instances within a Kubernetes cluster. It is written in Rust and leverages the kube-rs library to interact with the Kubernetes API. This operator simplifies the deployment, management, and scaling of Freqtrade bots by using Custom Resource Definitions (CRDs).
The Freqtrade Operator automates the lifecycle management of Freqtrade bots in Kubernetes. It manages the creation, updates, and deletion of Freqtrade instances using Kubernetes Custom Resources. This allows for seamless integration with Kubernetes-native tools and workflows, and makes the operations of multiple bots in a Kubernetes environment easier.
Before installing the Freqtrade Operator, you need to install the Custom Resource Definitions (CRDs). The CRDs define the custom resources that the operator will manage.
helm upgrade --install freqtrade-operator-crds oci://ghcr.io/wizrds/freqtrade-operator/charts/freqtrade-operator-crdsOnce the CRDs are installed, you can install the Freqtrade Operator itself.
helm upgrade --install freqtrade-operator oci://ghcr.io/wizrds/freqtrade-operator/charts/freqtrade-operator --namespace default --create-namespace --set installCRDs=falseNOTE: You can install the CRDs and the Operator in a single step by setting installCRDs=true in the Operator Helm command. However, this is not recommended for production environments, as it may lead to unexpected behavior.
After installing the operator, you can create a Freqtrade bot by creating a Bot resource. There is an example YAML file in the root of the repository named examples/basic.bot.yaml. It defines the basic structure for the CRD, an example configuration and uses the SampleStrategy.
Apply the YAML file using kubectl:
kubectl apply -f examples/basic.bot.yamlNote
For an example with FreqAI usage, please refer to the examples/freqai.bot.yaml file. For a reference on all possible fields, you can check the CRD reference.
Then you can check the status of the bot using:
kubectl get botsTo build the project, you need to have Rust installed. You can install Rust by following the instructions at https://rustup.rs/. Once you have Rust installed, you can build the project by running:
task dev:buildTo build the Docker image for the project, you can run:
task docker:buildYou can control the image name and tag generated by setting the IMAGE_NAME and IMAGE_TAG task variables. For example:
task docker:build IMAGE_NAME=freqtrade-operator IMAGE_TAG=latestTo run the project, simply run:
task dev:runFor development mode, you can run the controller or webhook individually:
task dev:run:controller
task dev:run:webhookTo run the tests, use the following command:
task rust:testThis project is licensed under ISC License.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
Made with ❤️ by Timothy Pogue