BTX Exchange

BTX: Configuration & Development

This page covers the configuration constants, local development setup, common admin tasks, and tips for working with BTX.


Configuration Reference

All tunables are in constants.js:

ConstantValueDescription
INITIAL_CASH_BALANCE2500Starting virtual cash
MIN_PRICE0.10Absolute minimum price
DEFAULT_BASE_PRICE1.00Base price without seed
PRICE_SENSITIVITY_PER_SHARE0.02Price move per net share
TRANSACTION_FEE_BPS2002% transaction fee
SEED_TO_PRICE_FACTOR0.1Seed to base price conversion
INVESTMENT_TO_SEED_FACTOR0.0001Investment to seed conversion
DRIFT_MAX_PCT_PER_TICK0.015Max random price change per tick
DRIFT_MEAN_REVERSION0.12How quickly prices revert to equilibrium
EQUILIBRIUM_SENSITIVITY_FACTOR0.7Dampens demand component in the equilibrium price for drift mean reversion
EXECUTION_NOISE_MAX_PCT0.01Max execution noise percentage (reserved, not currently applied in executeTrade)
DRIFT_ENABLED"true"Whether random drift is active (string, not boolean)
DEFAULT_EVENT_ID"kickstart"Default event ID used when none is specified

Common Tasks

Adding a New Project

Send a POST to the admin endpoint:

POST /btx/admin/project
{
  "projectId": "team-alpha",
  "eventId": "kickstart",
  "ticker": "ALPHA",
  "name": "Team Alpha",
  "description": "A revolutionary fintech startup",
  "seedAmount": 5
}

Applying a Phase Bump

POST /btx/admin/phase-bump
{
  "projectId": "team-alpha",
  "bumpType": "MVP_SHIPPED"
}

Checking a User's Portfolio

GET /btx/portfolio?eventId=kickstart
Authorization: (Cognito token)

Tips for New Developers

  • Start with constants.js and understand the tunables before diving into the logic
  • The executeTrade function in helpers.js is the heart of the system, so read it carefully.
  • Price history gets recorded for every price change, so charts always have data points even from drift
  • The frontend is a single large page (btx.tsx), so use search (Ctrl+F) to find sections
  • WebSocket broadcasts happen asynchronously after trades and use .catch() to avoid blocking the trade response
Previous
Trade Execution & Frontend