Live stock-market simulation platform for event rounds, team portfolios, auctions, and luck-based market events.
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.
- 🏢 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)
Admin: Dashboard and controls
Public Display: Main market screen and question/luck round view
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
git clone https://github.com/aaravshah1311/Trade-X.git
cd Trade-Xnpm installImport schema and starter data:
mysql -u root -p < db.sqlThis creates:
tradex_dbdatabasesettingstablecompaniestableteamstable
⚠️ No.envis 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.
node server.jsOpen:
- Public screen:
http://localhost:3000/ - Admin panel:
http://localhost:3000/admin.html
| 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 |
update_roundauction_lock_bidsauction_resolveupdate_portfoliosync_screensell_alladd_team
- MySQL server is running
-
db.sqlimported successfully - DB
user/passwordupdated inserver.js -
npm installcompleted -
node server.jsstarts successfully
public/screen/questions.jsonis updated during luck draws (opened: true), so reset it before a fresh event.- Team
stocksarrays should match company count/order. server.jsincludesstartcommands (Windows-style browser launch). On Linux/macOS, app still runs but auto-open behavior may not work.
Aarav Shah
- GitHub: https://github.com/aaravshah1311/
- Portfolio: https://aaravshah1311.is-great.net
- Email: aaravprogrammers@gmail.com



