InstaMarket is a local, multi-service prediction-market assistant for X/News workflows.
It combines:
- A Chrome extension that detects posts and surfaces related Polymarket markets.
- An AI research + matching API.
- A bridge service for persona simulation + paper trade submission.
- A low-latency CLOB engine for trade ingestion.
- An optional dashboard for monitoring activity.
- Core Matching Engine (C++): Built for strict low-latency ingestion. Utilizes contiguous data structures (
std::vector/std::array) with flattened hash tables to optimize CPU cache utilization. - Zero-Allocation Hot Path: Pre-allocated capacities ensure zero heap allocations (
new/malloc) during active order matching and execution. - Risk Daemon: Asynchronous stop-loss monitoring detached from the primary matching thread.
- A polyglot prediction-market stack that brings market discovery, AI research, and paper-trade execution directly into content surfaces. InstaMarket matches live Polymarket data to X/Twitter posts and news articles, generates AI-backed theses via AWS Bedrock (Amazon Nova), simulates crowd flow, and routes paper trades into a custom low-latency C++ CLOB and risk pipeline.
- Content-Native Market Matching: A Manifest V3 Chrome extension scans X/Twitter and Washington Post pages, scoring and injecting live Polymarket candidate markets directly into your feed.
- AI Research Thesis Generation: A 4-agent AWS Bedrock pipeline scrapes cross-platform evidence (X, Reddit, Google News) to output fair probability, catalysts, risk flags, and suggested trade sizing.
- Swarm / Persona Trade Simulation: A Node.js bridge turns social comments into deterministic persona profiles, running risk/portfolio agents to simulate market flow.
- Paper Execution & Risk Automation: Bets are filled by a custom local C++23 order book and monitored by a Supabase-realtime risk daemon for automated stop-loss management.
- Frontend: Chrome Extension (Manifest V3), React 18 / Vite, Framer Motion
- Backend & Orchestration: Node.js, Express 5, TypeScript/JavaScript microservices
- Execution Engine: Bare-metal C++23 in-memory CLOB (Central Limit Order Book)
- AI & Inference: AWS Bedrock (
amazon.nova-lite-v1:0) - Data & Persistence: Supabase (Postgres + Realtime), Polymarket Gamma API
- Web3 Integration: Solana localnet (
@solana/web3.js), SPL token tooling
person1_clob/— Core Matching Engine: Bare-metal C++ matching engine + market/orderbook endpoints.person2/— AI Thesis Backend: Match + thesis generation API (/v1/match-market,/v1/research-thesis).person3/chrome-extension/— Client Extension: UI, tweet injection, sidebar, and research UX.integration_bridge/— Integration API: Bridge service (/api/persona-sim,/api/bet, paper trade piping).person4/— Risk Daemon: Asynchronous stop-loss daemon.instamarket-dashboard/— Frontend Client: React/Vite monitoring dashboard.shared_schemas/— Shared contract files.
- Extension reads tweet context and asks AI Thesis Backend for the best market match.
- AI Backend queries live market data + scraper evidence and returns a thesis.
- Extension can run persona simulation via Integration Bridge.
- Bridge can forward paper trades to the Core Matching Engine.
- Sidebar + dashboard reflect research, saved markets, and bets.
8080— Core Matching Engine (person1_clob/src/main.cpp)8787— AI Thesis Backend API3000— Integration Bridge API4173— Dashboard dev server (Vite default)
1) Core Matching Engine (CLOB)
cd person1_clob/src
g++ -O3 -std=c++20 -march=native -o clob_engine main.cpp
./clob_engine2) Integration Bridge
cd integration_bridge
npm install
node server.js3) AI Thesis Backend API
cd person2
npm install
cp .env.example .env.local
npm run match-api4) Chrome Extension
- Open Chrome ->
chrome://extensions - Enable Developer mode
- Load unpacked ->
person3/chrome-extension - Open X/Twitter and use the injected market cards + sidebar
5) Dashboard (optional)
cd instamarket-dashboard
npm install
npm run devAI Thesis Backend (person2/.env.local)
Typical values used during local runs:
AWS_REGIONBEDROCK_MODEL_ID- Scraper tuning / credentials (optional):
APIFY_API_TOKEN,YOUTUBE_API_KEY,SCRAPER_PROCESS_TIMEOUT_MS,SCRAPER_PYTHON_BIN
Integration Bridge (integration_bridge/.env)
SUPABASE_URLSUPABASE_ANON_KEYSOLANA_RPC- (Optional) Bedrock credentials if simulation uses Bedrock-backed paths.
AI Thesis Backend
npm run build
npm run test
npm run verify-scrapers
npm run match-apiDashboard
npm run dev
npm run build
npm run preview-
vite: command not foundRunnpm installinsideinstamarket-dashboard/. -
fatal error: 'vector' file not found(macOS) This is a local toolchain/header issue. Use Homebrew GCC (g++-15) or repair Xcode Command Line Tools. -
Source collection degraded; continuing with fallback seeds Scraper could not fully collect live sources and switched to deterministic fallback seeds. Check scraper credentials, network, and
person2logs.
This repo is organized by module ownership for parallel development. If you are demoing locally, start services in this order: person1_clob -> integration_bridge -> person2 -> extension -> dashboard.