BACK
Native macOS · Market Engine · Simulation Game

Trading Simulator

Stock Market Rookie Village is a native macOS trading simulation game that combines deterministic market generation, A-share-style rules, event-driven prices, and challenge scoring into a replayable local experience.

RoleIndependent Developer
PlatformmacOS 13+
StackSwiftUI / Fastify / SQLite
Stock Market Rookie Village native macOS trading simulator

A Credible Decision Environment Without Live Market Data

The project separates presentation, market generation, and trade settlement. The native SwiftUI app provides the multi-window terminal, while the Fastify backend owns authoritative quotes, positions, fees, events, challenges, and saves. SQLite persists the complete state of each game.

Players can advance the market freely in sandbox mode or enter fixed-day challenges that balance asset targets, maximum drawdown, and trade count. Every stock, price, news item, and event is fictional.

SwiftUI
Swift Canvas
Node.js
Fastify
TypeScript
SQLite
React
Vitest

Market Prices Emerge from Multiple Interacting Factors

Each save stores its own market seed, regime, and difficulty snapshot. Price generation combines market sentiment, capital style, volume heat, sector rotation, stock volatility, event impact, and event-chain persistence, while applying 10% or 20% price-limit boundaries by board.

01 / REGIME
Market Regime
Drift, volatility, correlation, liquidity, and positive or negative event bias define each market run.
02 / SECTOR
Industry Structure
Industry indices track returns, sentiment, volume heat, and event impact to expose rotation signals.
03 / EVENT
Event Driver
Market, industry, and stock events carry direction, strength, and duration, including chains and expectation reversals.
04 / PRICE
Price and Volume
Minute prices remain constrained by daily bars, while volume reflects open, close, midday, and event pulses.
120
Fictional Stocks
40
Industries
180+
Event Templates
240
Minute Bars per Day

Custom Multi-Period K-Lines for a Desktop Terminal

The K-line chart is drawn with SwiftUI Canvas and supports 1, 5, 15, 30, and 60-minute periods plus daily, weekly, and monthly views. Candles, MA5 / MA10 / MA20, volume, volume averages, price and time axes, the latest-price line, and crosshair readings are rendered together.

One-minute data only exposes bars reached by the simulation clock. Other intraday periods aggregate visible minute bars, while weekly and monthly views aggregate daily bars. Players can switch among 30, 45, and 60-bar ranges with pan, zoom, and playback controls.

Server-Authoritative Rules and Multi-Window Consistency

The trading engine enforces 100-share lots, T+1, cash and sellable-position checks, commissions, stamp duty, and price-limit direction rules. SQLite transactions update accounts, positions, and trades together before recalculating market value, total assets, returns, and maximum drawdown.

Every order carries an idempotency key, so retries return the existing trade. Writes also verify expectedStateVersion, preventing stale windows from overwriting newer game state. The main terminal and separate position, order, and chart windows therefore share one authoritative state.

Comparable Strategy Challenges Across Market Regimes

The game includes 20-day warm-up, 60-day beginner, and 120-day steady-growth challenges. Settlement combines asset targets, maximum drawdown, and minimum trade count into a score and S, A, B, or C rating. Difficulty adjusts challenge targets, while sandbox mode has no forced ending.

Multiple saves can be created, loaded, renamed, and deleted. The same content pack generates different market paths under different seeds, regimes, and difficulties while keeping each save reproducible for continued play and verification.

Native Terminal, Domain Engine, and Maintainable Content Packs

The native app's ObservableObject Store connects to the Fastify API. The backend domain layer owns market, order, portfolio, event, challenge, and save logic before persisting to local SQLite. The older React frontend remains a debugging surface rather than the default product.

Industries, stocks, market regimes, difficulties, and event templates live in CSV content packs. Startup validation checks headers, unique IDs, industry references, enum values, and minimum counts so content can expand without changing core trading code.

01
Native Multi-Window UI
Terminal, chart, positions, orders, news, events, and saves share state across windows.
02
Multi-Period Market Data
Intraday, daily, weekly, and monthly K-lines follow consistent price and volume constraints.
03
Event Chains
Fictional news affects markets, industries, and stocks, then decays or reverses over trading days.
04
Trade Consistency
Transactions, idempotency keys, and state versions protect accounts and multi-window actions.
05
Challenge Scoring
Scores combine returns, drawdown, and trading completion rather than final assets alone.
06
Local Saves
Game data stays in local SQLite without collecting real identity information.
This project is for gaming and learning only. It does not connect to live market data, real trading, or brokerage accounts, and it provides no investment advice or return promises.