Skip to content

aditiids/trading-webapp

Repository files navigation

🧠 Real-Time Stock Trading and Analytics Platform

A full-stack real-time trading application built using modern frontend technologies, big data tools, and a scalable backend database.

Tech Stack Kafka Backend


πŸ“Œ Project Modules


πŸ“ Repository Structure

trading-webapp/
β”œβ”€β”€ CassandraJavaConnection/        # Java backend using Cassandra DB
β”œβ”€β”€ frontend/                       # Next.js + Tailwind frontend
β”œβ”€β”€ kafka-pipeline/                 # Kafka + Spark based data stream
└── Trading Matchmaking Algorithm/  # Java-based trading engine (matching logic)


πŸ’» Frontend -- Next.js + Tailwind

Project Screenshot

A modern trading platform frontend built with Next.js and Tailwind CSS, featuring real-time data visualization and responsive design.

πŸš€ Features

  • πŸ“ˆ Real-time market data with WebSocket integration

  • πŸ“± Fully responsive UI

  • πŸ“Š Interactive trading charts

  • πŸ”’ Secure authentication flows

  • πŸ’Ό Portfolio dashboard

πŸ”§ Tech Stack

  • Framework: Next.js 14 (App Router)

  • Styling: Tailwind CSS + CSS Modules

  • State Management: Zustand/Redux Toolkit

  • API Client: Axios/React Query

  • Forms: React Hook Form + Zod

  • Testing: Jest + React Testing Library

πŸ–  Setup

git clone https://github.com/aditiids/trading-webapp.git
cd trading-webapp/frontend
npm install
cp .env.example .env.local
npm run dev

🌱 Environment Variables

NEXT_PUBLIC_API_URL=your_api_url
NEXT_PUBLIC_WS_URL=your_websocket_url

πŸ“‚ Structure

frontend/
β”œβ”€β”€ public/
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ components/
β”‚   β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ stores/
β”‚   └── styles/
β”œβ”€β”€ tailwind.config.js
└── next.config.js

πŸ“œ Scripts

npm run dev
npm run build
npm run start
npm test

πŸ”— Deploy

Deploy with Vercel


πŸ”„ Big Data Pipeline -- Kafka + Spark

A real-time stock data processing pipeline using Apache Kafka, Apache Spark, and Alpha Vantage.

πŸ”§ Your Role: Big Data Engineer

  • Connect Kafka & Spark for data pipelines

  • Ingest real-time stock data from Alpha Vantage

  • Produce and consume Kafka messages

  • Analyze and clean data using PySpark

  • Store processed data or pass it downstream

🧱 Technologies

  • Kafka + Zookeeper

  • PySpark

  • Cassandra

  • Alpha Vantage API

  • Kafka Python client

πŸ§ͺ Setup & Installation

# Install Kafka, Spark, Java, Python
# Start Zookeeper & Kafka
kafka\bin\windows\zookeeper-server-start.bat config\zookeeper.properties
kafka\bin\windows\kafka-server-start.bat config\server.properties

🐍 Python Libraries

pip install kafka-python requests pyspark

πŸ” Workflow

  1. stock_producer.py

    • Calls Alpha Vantage API

    • Pushes data to Kafka topic stock_data

  2. stock_consumer.py

    • Reads data from Kafka

    • Preprocesses with PySpark

    • Writes to new topic or Cassandra

python stock_producer.py
python stock_consumer.py

πŸ“„ Files

  • stock_producer.py -- Producer script

  • stock_consumer.py -- Spark consumer

🧠 AI/ML Integration (Future)

  • Predict stock trends using Spark MLlib

  • Portfolio optimization based on user profile


πŸ—„οΈ Backend -- Cassandra + Java

Java Cassandra Maven

A Java-based trading backend connected to a Cassandra database using DataStax Java Driver.

πŸ” Features

  • Buy/Sell stocks

  • View transaction history

  • Secure DB connection using Astra bundle

  • Interactive CLI for easy interaction

πŸ“‹ Requirements

  • Java 21

  • Apache Maven 3.8.8+

  • Cassandra or Astra DB

  • Secure Connect bundle

βš™οΈ Setup

git clone https://github.com/aditiids/trading-webapp.git
cd trading-webapp/CassandraJavaConnection

Configure credentials:

  • Add secure bundle to your project

  • Use the bundle path in Connector.java

πŸ“† Project Structure

CassandraJavaConnection/
β”œβ”€β”€ pom.xml
β”œβ”€β”€ .idea/
β”œβ”€β”€ src/
β”‚   └── main/
β”‚       └── java/
β”‚           └── org/example/
β”‚               β”œβ”€β”€ Connector.java
β”‚               β”œβ”€β”€ Main.java
β”‚               └── Operations.java


🌐 Trading Matchmaking Algorithm -- Java

A high-performance Order Matching Engine written in Java for trade execution.

✨ Features

  • Matches buy and sell orders

  • Uses limit price, FIFO rules

  • Supports order history via Trade class

  • Modular and extendable design

πŸ“š Files

  • OrderMatchingEngine.java -- Main class containing matching logic

  • Order.class, Trade.class -- Helper classes

  • Compiled .class files included

  • A hello test file for demo/debug purposes

πŸ”„ Future Enhancements

  • Integration with Kafka + Cassandra

  • RESTful API exposure

  • More complex order types (Stop, Market, etc.)


πŸ“š References & Resources


🀝 Contributing

  1. Fork the repo

  2. Create a new branch git checkout -b feature/your-feature

  3. Commit changes git commit -m "Add feature"

  4. Push branch git push origin feature/your-feature

  5. Create a Pull Request


πŸ“„ License

MIT Β© Aditi Suryawanshi

About

A full-stack trading platform that provides real-time stock data, order execution, and predictive analytics using deep learning and big data technologies.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors