Skip to content

shreed27/DAIN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

105 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DAIN - Autonomous Trading OS

One Brain. Every Market. Zero Wallet Popups.

Built for Colosseum Lines of Code npm Real Tests

The operating system for autonomous trading agents. Trade Solana DEXs, prediction markets, and perpetual futures - without wallet popups or human babysitting.


SDK Quick Start

npm install @dain/agent-sdk
import { DainClient } from '@dain/agent-sdk';

const dain = new DainClient({ apiKey: process.env.DAIN_API_KEY });

// Register your agent
const agent = await dain.registerAgent({
  name: 'my-trading-bot',
  permissions: ['SWAP', 'LIMIT_ORDER']
});

// Execute a Solana swap via Jupiter
const result = await dain.solana.swap({
  inputMint: 'So11...112',  // SOL
  outputMint: 'EPjF...1v',  // USDC
  amount: 100000000,
  slippage: 0.5
});

Integrations: Eliza | solana-agent-kit | Claude MCP | LangChain

Full SDK Documentation


Quick Start (For Judges)

Option 1: Docker (Recommended - 2 minutes)

# Clone and start
git clone https://github.com/your-repo/collesium-project.git
cd collesium-project
cp .env.docker .env
docker-compose up

# Open http://localhost:3000

Option 2: Local Development (5 minutes)

# 1. Install dependencies
npm install

# 2. Copy environment file
cp .env.docker .env

# 3. Start all services
npm run dev

# Frontend: http://localhost:3000
# API:      http://localhost:4000

Option 3: Frontend Only

cd trading-frontend
npm install
cp .env.example .env.local
echo "NEXT_PUBLIC_DEMO_MODE=true" >> .env.local
npm run dev

# Open http://localhost:3000 - Shows demo data without backend

What DAIN Does

DAIN unifies 7 trading projects into one platform where AI agents can:

  • Trade across 9 prediction markets with unified position management
  • Execute on Solana DEXs via Jupiter V6 with best-price routing
  • Follow elite "God Wallets" with automatic trade mirroring
  • Manage risk with Survival Mode - adaptive limits based on P&L health
  • Run autonomous AI agents that analyze and execute trades 24/7

Key Features

25+ Trading Features

Category Features
DEX Trading Jupiter V6 swaps, limit orders, portfolio tracking
Copy Trading Whale following, configurable sizing, stop-loss/take-profit
Risk Management Survival Mode, VaR calculation, circuit breaker, kill switch
AI Analysis Token analysis, market sentiment, trade recommendations
Arbitrage Cross-platform scanning, auto-execution
Automation Rule-based triggers, scheduled orders
Analytics P&L tracking, trade ledger, performance metrics

Survival Mode (Unique)

Adaptive risk management based on portfolio P&L health:

Health Ratio = currentBalance / initialBalance

>= 120%  GROWTH     Aggressive mode unlocked
85-120%  SURVIVAL   Normal trading operations
50-85%   DEFENSIVE  Positions reduced 50%
< 50%    CRITICAL   Full hibernation (capital preservation)

God Wallet Tracking

Monitor 24 elite traders in real-time with:

  • Automatic trade detection
  • Configurable copy sizing
  • Risk limits per wallet
  • Performance attribution

Architecture

                    [Frontend :3000]
                          |
                    [Gateway :4000]
                          |
        +-----------------+-----------------+
        |                 |                 |
[Orchestrator :4001] [CloddsBot :18789] [Agent-DEX :3001]
        |                 |                 |
        +-----------------+-----------------+
                          |
              [OpenClaw :3003 - Survival Mode]
                          |
    +---------------------+---------------------+
    |           |           |           |       |
[Jupiter]  [Raydium]  [Polymarket] [Binance] [Bybit]

What's Working Right Now

Feature Status Notes
Frontend (25 pages) Working Full UI renders
Wallet Connect Working Phantom, Solflare, etc.
Demo Mode Working Shows sample data
Jupiter Swaps Working Requires agent-dex running
Copy Trading UI Working CRUD operations
Survival Mode Logic Working State machine executes
Real-time Prices Working Binance WebSocket
AI Token Analysis Working Requires API key
Arbitrage Scanner Demo Real detection, simulated execution
Whale Tracking Demo Mock data, real architecture

Integrated Projects

Project Purpose Lines of Code
trading-frontend Next.js 16 dashboard ~15,000
trading-orchestrator Central coordination hub ~3,500
CloddsBot-main Multi-platform trading terminal ~50,000
agent-dex-main Solana DEX API (Jupiter V6) ~1,500
openclaw-sidex-kit Multi-exchange + Survival Mode ~1,500
AgentHub-Repo Orchestration core + types ~7,500
clawdnet-main A2A protocol + X402 payments Docs + Contracts

Total: 80,000+ lines of production code


Supported Platforms

DEXs (Solana)

  • Jupiter V6 (aggregator)
  • Raydium
  • Orca
  • Meteora

Prediction Markets

  • Polymarket
  • Kalshi
  • Manifold
  • Metaculus
  • PredictIt
  • Betfair

Perpetuals

  • Hyperliquid
  • Binance Futures
  • Bybit
  • Drift

API Reference

REST Endpoints (Gateway :4000)

# Agents
POST /api/v1/agents                  Create agent
GET  /api/v1/agents                  List agents
PUT  /api/v1/agents/:id/kill         Emergency kill switch

# Trading
POST /api/v1/execution/quote         Get swap quote
POST /api/v1/execution/swap          Execute swap

# Copy Trading
GET  /api/v1/copy-trading/configs    List copy configs
POST /api/v1/copy-trading/configs    Create config

# Risk
GET  /api/v1/survival-mode/status    Current survival state
GET  /api/v1/risk/metrics            Risk dashboard

WebSocket Events

socket.emit('subscribe', ['signals', 'positions', 'market']);

socket.on('signal_received', data => { /* whale/ai signals */ });
socket.on('price_update', data => { /* real-time prices */ });
socket.on('execution_completed', data => { /* trade executed */ });

Environment Variables

# Required for full functionality
ANTHROPIC_API_KEY=sk-ant-...    # AI analysis
SOLANA_PRIVATE_KEY=...          # Trading execution

# Optional - enables additional features
TELEGRAM_BOT_TOKEN=...          # CloddsBot Telegram
POLY_API_KEY=...                # Polymarket trading
BINANCE_API_KEY=...             # Futures trading

Tech Stack

Layer Technology
Frontend Next.js 16, React 19, Tailwind CSS 4, Framer Motion
Backend Express.js, Socket.io, TypeScript
Database SQLite (better-sqlite3)
Blockchain @solana/web3.js, viem, Jupiter V6
AI/LLM Claude, GPT-4, Gemini, Groq
Testing Jest (2,443 lines of tests)

What Makes This Unique

  1. 7 Projects Unified - Real integration, not just documentation
  2. Survival Mode - Novel adaptive risk management based on P&L health
  3. 80,000+ Lines of Code - Production-grade, not hackathon boilerplate
  4. Real Test Suite - 2,443 lines of actual tests
  5. Working Jupiter Integration - Real Solana DEX trading
  6. Copy Trading Engine - Full CRUD with risk controls
  7. Kill Switch - Emergency position closure across all platforms

Demo Features

When running in demo mode, you'll see:

  1. Dashboard - Real-time signal feed with whale alerts and AI reasoning
  2. Agent Management - Deploy, pause, and monitor trading agents
  3. Copy Trading - Follow God Wallets with trust scores
  4. Arbitrage Scanner - Cross-platform opportunities
  5. Survival Mode - Adaptive risk visualization
  6. Leaderboard - Hunter rankings with badges

Running Tests

cd trading-orchestrator
npm test

# Output: 2,443 lines of Jest tests passing

Documentation


License

MIT


Built with care for the Solana Colosseum Hackathon

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors