Skip to content

aaravshah1311/Trade-X

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📈 Trade-X

Live stock-market simulation platform for event rounds, team portfolios, auctions, and luck-based market events.

Node.js Express MySQL Socket.io

Made by Aarav Shah


🚀 Overview

Trade-X is a full-stack simulation system designed for school/college trading events where teams buy virtual stocks and compete on total wealth.

The platform includes:

  • 📺 a live audience screen (/) for market visuals,
  • 🛠️ an admin panel (/admin.html) for controlling rounds,
  • real-time sync using Socket.IO,
  • 🧠 dynamic luck/question events loaded from JSON,
  • 💾 MySQL-backed persistence for teams, companies, and settings.

✨ Core Features

  • 🏢 Multi-company market with per-round price changes
  • 👥 Team portfolio + purse + total wealth tracking
  • 🔄 Auto wealth recalculation after admin actions
  • 🧾 Auction bid lock + resolve (correct/wrong multiplier)
  • 🎲 Random and company-wise luck question draws
  • 🖥️ Public screen mode + overlay sync controls
  • 🔊 Built-in audio control panel (MP3/MP4 from public/song)

🖼️ Screenshots

Trade-X Admin Dashboard 1 Trade-X Admin Dashboard 2

Admin: Dashboard and controls

Trade-X Public Screen Trade-X Question Screen

Public Display: Main market screen and question/luck round view


🧱 Project Structure

Trade-X/
├── server.js                # Main backend (Express + APIs + socket sync)
├── db.sql                   # MySQL schema + seed data
├── public/
│   ├── index.html           # Participant screen
│   ├── admin.html           # Admin control panel
│   ├── song/                # MP3/MP4 tracks for audio control
│   └── screen/              # Round screens + questions.json + media
├── documents/               # Event docs
├── package.json
└── README.md

⚙️ Installation

1) Clone project

git clone https://github.com/aaravshah1311/Trade-X.git
cd Trade-X

2) Install dependencies

npm install

🗄️ Database Setup (MySQL)

Import schema and starter data:

mysql -u root -p < db.sql

This creates:

  • tradex_db database
  • settings table
  • companies table
  • teams table

🔐 Database Credentials (Important)

⚠️ No .env is used in this project currently.

Update your DB credentials directly in server.js inside mysql.createPool(...):

const pool = mysql.createPool({
  host: 'localhost',
  user: 'root',
  password: '',
  database: 'tradex_db'
});

Set your own MySQL user and password there before running.


▶️ Run the Application

node server.js

Open:

  • Public screen: http://localhost:3000/
  • Admin panel: http://localhost:3000/admin.html

🔌 API Endpoints

Method Endpoint Purpose
GET /api/get_data Fetch settings, companies, teams
GET /api/get_songs List files in public/song
POST /api/admin/action Execute admin operations
GET /api/draw-luck Draw random unopened question
GET /api/get-question-counts Remaining unopened questions per company
GET /api/draw-company-luck?company=... Draw by company

Supported action values

  • update_round
  • auction_lock_bids
  • auction_resolve
  • update_portfolio
  • sync_screen
  • sell_all
  • add_team

🧪 Quick Setup Checklist

  • MySQL server is running
  • db.sql imported successfully
  • DB user/password updated in server.js
  • npm install completed
  • node server.js starts successfully

📌 Operational Notes

  • public/screen/questions.json is updated during luck draws (opened: true), so reset it before a fresh event.
  • Team stocks arrays should match company count/order.
  • server.js includes start commands (Windows-style browser launch). On Linux/macOS, app still runs but auto-open behavior may not work.

👤 Author

Aarav Shah


Built for high-energy trading events with real-time scoring and interactive rounds.

About

Trade-X is a full-stack simulation system designed for school/college trading events where teams buy virtual stocks and compete on total wealth.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors