Skip to content

A sample playground for building stock trading applications with Apache Flink on Ververica

Notifications You must be signed in to change notification settings

ververica/ververica-flink-stock-trading

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stock Trading Analysis with Apache Flink on Ververica

Note: The easiest way to get started and deploy the application is by signing up for a free trial of Ververica Cloud.

You can also find more details on this video here.

Project Overview

You can find the application here. This project provides multiple Apache Flink streaming jobs to handle various stock market scenarios:

  1. MarketEventImpactAnalysis
    Evaluates how specific market events impact stock prices in real time.

  2. PriceSpikeDetection
    Detects significant stock price increases within a defined time window using Flink's CEP.

  3. RapidTradeDetection
    Identifies potential rapid or manipulative trading activities by detecting multiple trades from the same trader in quick succession, while also enriching trade data.

  4. SmartTradeExecution
    Dynamically decides whether to execute, delay, or cancel trade orders based on real-time price volatility thresholds.

Sample Data Generation

  • models package
    Defines the data model for stock trading, including Market Events, Stocks, Trade Orders and Trader details.

  • StockMarketDataGenerator.java
    Uses javafaker to create realistic synthetic transaction data with random amounts, currency codes, merchants, and geolocation.

  • FxProducer.java Generates transactions and sends them to a Kafka topic. Make sure to fill in the required properties for bootstrap.servers and sasl.jaas.config into the AppConfig.java file.

Build and Package

Use Maven to build and package the application:

mvn clean package

Deploy and Run

Run any of the jobs by specifying its main class. For example:

java -cp target/your-jar-file.jar com.ververica.apps.SmartTradeExecution

Replace SmartTradeExecution with the desired job name.

Requirements

  • Java 11
  • Maven
  • Apache Flink 1.17

About

A sample playground for building stock trading applications with Apache Flink on Ververica

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages