Skip to content

About

TradeStream Genetic Algorithm Core — strategy discovery, backtesting, and optimization engine (to be transferred to tradestreamhq)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

tradestream-ga

Genetic Algorithm engine for TradeStream — strategy parameter optimization using evolutionary algorithms.

Extracted from tradestreamhq/tradestream.

Architecture

This repo contains the Jenetics-based GA engine that discovers optimal trading strategy parameters. It calls tradestream-backtest via gRPC as its fitness evaluator.

Tech Stack

Component Technology
Language Kotlin / Java 21
GA Engine Jenetics 7.2
Pipeline Apache Beam 2.62 on Flink
Build Gradle (Kotlin DSL)
Messaging Apache Kafka
Storage PostgreSQL
Transport gRPC / Protocol Buffers

gRPC Interface

GAService

Defined in src/main/proto/protos/ga_service.proto.

RPC Description
SubmitStrategySpec Kick off a GA optimization run for a given strategy/symbol/timeframe
GetTopStrategies Retrieve top N strategies from a completed or in-progress run
GetPerformance Get detailed performance metrics for a specific strategy

Data Flow

  Kafka (requests)          tradestream-backtest
       │                         ▲
       ▼                         │ gRPC: RunBacktest
  ┌─────────────┐           ┌────┴──────┐
  │ Discovery   │──────────►│ Fitness   │
  │ Pipeline    │           │ Function  │
  │ (Beam)      │◄──────────│ (remote)  │
  └──────┬──────┘           └───────────┘
         │
    ┌────┴────┐
    ▼         ▼
  Kafka    PostgreSQL
  (results) (persist)

Inputs

  • Discovery requests via Kafka or gRPC (StrategyDiscoveryRequest)
  • GA parameters: population size, max generations, mutation/crossover rates

Outputs

  • Discovered strategies: Top N optimized parameter sets with fitness scores
  • Run status: SUBMITTED → RUNNING → COMPLETED

Building

./gradlew build

Running

Requires tradestream-backtest to be running on the configured gRPC endpoint.

./gradlew run

Relationship to tradestream-backtest

This repo does not contain TA4J or any strategy implementation code. All fitness evaluation is delegated to tradestream-backtest via gRPC. This separation allows:

  • Independent scaling of GA compute vs. backtesting compute
  • Swapping the backtesting engine without changing the GA
  • Running multiple GA instances against a shared backtesting service

About

TradeStream Genetic Algorithm Core — strategy discovery, backtesting, and optimization engine (to be transferred to tradestreamhq)

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages