How tristan-xo/stock-war works
Stock Wars is a browser-based, server-authoritative stock-trading simulation for live events. Players register, explore simulated stocks, request trade estimates, place orders, and follow portfolio performance; hosts manage rounds, timing, news, and event operations. The server coordinates these workflows and persists event and market state in SQLite. The README documents additional capabilities—such as SSE updates, recovery, and event export—that are not fully visible in the sampled source, so those links are shown only where documented.
Main entry points: app.js Web Interface · server.js HTTP API
Components 15
Player and Host Experience
- Web Interface
public/app.js
Market and Trading
- Stock Catalog
server.js - Stock Discovery
public/app.js - Order Handling
server.js - Portfolio Accounting
server.js - Price History
server.js
Event Operations
- Round News and Impacts
server.js - Round Lifecycle
server.js - Host Operations
server.js - Audit and Presence
server.js
Server and Persistence
- HTTP API
server.js - Live Updates
server.js - SQLite Event Store
server.js
Other components
- Players
- Hosts
Connections 25
- Players → Web Interface: use
README.md - Hosts → Web Interface: use
README.md - Web Interface → HTTP API: requests
public/app.js - HTTP API → Web Interface: returns data
public/app.js - HTTP API → Live Updates: publishes updates
server.js - Live Updates → Web Interface: streams state
README.md - Web Interface → Stock Discovery: renders
public/app.js - Web Interface → Stock Catalog: requests catalog
public/app.js - Web Interface → Price History: requests history
public/app.js - Web Interface → Order Handling: requests quotes
public/app.js - HTTP API → Order Handling: handles trades
server.js - HTTP API → Portfolio Accounting: serves transactions
server.js - Order Handling → SQLite Event Store: reads and writes
server.js - Portfolio Accounting → SQLite Event Store: reads and writes
server.js - Price History → SQLite Event Store: records prices
server.js - HTTP API → Round News and Impacts: generates news
server.js - Round News and Impacts → SQLite Event Store: stores impacts
server.js - Round Lifecycle → Round News and Impacts: applies impacts
server.js - Round Lifecycle → SQLite Event Store: commits round
server.js - HTTP API → Round Lifecycle: controls phases
server.js - Web Interface → Host Operations: requests operations
public/app.js - HTTP API → Host Operations: serves operations
server.js - Host Operations → SQLite Event Store: updates event state
server.js - HTTP API → Audit and Presence: records activity
server.js - Audit and Presence → SQLite Event Store: stores events
server.js