J6Crypto is backend engine to run user defined trading strategy. Each trading strategy will start a bot instance to run in kubernete pod. 1 pod may run multiple trading bots with spring boot.
There are 2 existing main trading logic's.
- Why Zookeeper service mesh and not kubernetes
- Local development environmet is same as cloud environment.
- Architecture not depend on kubernete.
- Since Kafka is using it.
- Ready to use more features from zookeeper.
- Centralised config/data to enable decentralise microservices/logic.
- Download kafka_2.13-2.8.0
- Start Zookeeper
cd C:\dev\tools\kafka_2.13-2.8.0\bin\windows
zookeeper-server-start.bat ..\..\config\zookeeper.properties
- Start Kafka
cd C:\dev\tools\kafka_2.13-2.8.0\bin\windows
kafka-server-start.bat ..\..\config\server.properties
- Checkout this repo and run
./mvn spring-boot:run
- Checkout j6crypto-gateway repo and run
./mvn spring-boot:run
kubectl create -f c:\workspace\j6crypto-engine\kube\zookeeper.yml --namespace=j6crypto
kubectl scale deployment.apps/zookeeper --replicas=1 --namespace=j6crypto
kubectl create -f c:\workspace\j6crypto-engine\kube\kafka.yml --namespace=j6crypto
kubectl scale deployment.apps/kafka --replicas=1 --namespace=j6crypto
kubectl create -f c:\workspace\j6crypto-engine\j6crypto-engine.yml --namespace=j6crypto
kubectl scale deployment.apps/j6crypto-engine --replicas=1 --namespace=j6crypto
kubectl create -f c:\workspace\j6crypto-gateway\j6crypto-gateway.yml --namespace=j6crypto
kubectl scale deployment.apps/j6crypto-gateway --replicas=1 --namespace=j6crypto
kubectl apply -f c:\workspace\j6crypto-engine\kube\public-ingres.yml
- J6CryptoAllApp - All in one starter.
- J6CryptoApiApp - Start Rest API only.
- J6CryptoEngineApp - Start crypto engine only.
- J6CryptoProducerApp - Start Coin producer only. It pull data from binance exchange, etc.
- J6CryptoEngineLocalTestApp - Dev testing trading logic
- Auto assign spring.application.instance_id. instance_id must be same as DB Table field AutoTradeOrder.ms_id. Thus, microservices are able to restart and restore the unassigned AutoTradeOrder from DB. If no unassigned ATO, new max msId + 1 will be assign to this microservice.
- Edit apache curator zookeeper caller ServiceDiscoveryImpl.java line 175 to throw error when zookeeper registers new instance by using existing instance_id/msId. This is needed becaue pods may start at the same time. Currently it will delete existing service/node in zookeeper and replace with new service/node.
This is API Testing framework. Run EngineApiTest.java for testing.
Auto adjust/assign pod crypto-engine base on memory and cpu usage by using Spring Boot Actuator.