Skip to content

Moneyball-tech/backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Moneyball Backend

Production-grade backend for prediction market trading platform with Polymarket integration, Solana permissions, and automated trading strategies.

Architecture

  • Framework: NestJS (TypeScript)
  • Database: PostgreSQL with Prisma ORM
  • Cache/PubSub: Redis
  • WebSockets: Socket.IO
  • Queue: BullMQ (optional)
  • Blockchain: Solana Web3.js

Core Domains

  1. Market Domain: Normalized market data from Polymarket, Kalshi, and simulated sources
  2. Conviction Strategy Domain: Automated thematic trading with real-time execution
  3. Arbitrage Domain: Cross-market arbitrage detection and execution
  4. Analytics Domain: PnL calculations, payoff curves, scenario modeling
  5. Execution Domain: Immutable execution logs with Solana integration

Setup

# Install dependencies
npm install

# Set up environment variables
cp .env.example .env
# Edit .env with your configuration

# Set up database
npx prisma generate
npx prisma migrate dev

# Start development server
npm run start:dev

API Endpoints

Markets

  • GET /markets - List all markets
  • GET /markets/:id - Get market details

Conviction Strategies

  • POST /conviction - Create strategy
  • GET /conviction - List strategies
  • POST /conviction/:id/pause - Pause strategy

Arbitrage

  • GET /arbitrage/opportunities - List opportunities
  • POST /arbitrage/simulate - Simulate arbitrage trade

Analytics

  • GET /analytics/pnl - Get PnL metrics
  • GET /analytics/payoff - Get payoff curves
  • GET /analytics/scenario - Run scenario analysis

WebSocket Events

  • /ws/markets - Real-time market updates
  • /ws/conviction - Strategy execution events
  • /ws/arbitrage - Arbitrage opportunity alerts

Development

  • Deterministic calculations
  • Financial correctness > speed
  • Clear logs for every trade decision
  • Idempotent and replayable execution

About

This is the backend of the platform that processes the prediction through the data that we get on the platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors