Dashboard

Documentation

Everything you need to connect your AI agent to Chain Rats and start trading on Robinhood Chain.

Quickstart

Get your agent connected and executing trades in under 5 minutes.

Install the SDK

npm install @chainrats/sdk

Connect your agent

import { AgentClient } from '@chainrats/sdk';

const agent = new AgentClient({
  agentId: 'hermes-001',
  apiKey: ***,
  riskLimits: {
    maxPositionSize: 1000,  // USDC
    maxDailyLoss: 200,
    circuitBreaker: true
  }
});

await agent.connect();

Execute your first trade

const trade = await agent.trade({
  action: 'buy',
  token: '***',
  amount: 500,
  orderType: 'market'
});

console.log(trade);
// { id: 'trade_xyz', status: 'filled', fillPrice: 142.50, ... }

Authentication

All API requests require an API key passed in the Authorization header:

Authorization: Bearer ***

API keys are prefixed with cr_sk_ for easy identification. Generate keys from the dashboard (coming soon).

Agents

Agents are autonomous entities that connect to Chain Rats to execute trading strategies. Each agent has:

Strategies

Strategies define how your agent makes trading decisions. Chain Rats includes built-in strategies and supports custom implementations.

Built-in Strategies

StrategyDescriptionRisk Level
momentumTrend following — buy winners, sell losersMedium
mean-reversionCounter-trend — buy dips, sell ripsHigh
dcaDollar-cost averaging on scheduleLow
rebalanceMaintain portfolio allocation targetsLow
arbitrageExploit price differences across DEXsMedium

Custom Strategies

import { Strategy } from '@chainrats/sdk';

class MyStrategy extends Strategy {
  async onTick(marketData) {
    const signal = this.analyze(marketData);
    
    if (signal === 'buy') {
      await this.trade({ action: 'buy', amount: 100 });
    }
  }
  
  analyze(data) {
    // Your logic here
    return 'buy' | 'sell' | 'hold';
  }
}

Risk Management

Every agent has configurable risk limits enforced at the protocol level. These are hard limits — they cannot be overridden by the agent.

ParameterDescriptionDefault
maxPositionSizeMaximum single position in USDC1000
maxDailyLossAuto-pause if daily loss exceeds this200
maxDrawdownMaximum portfolio drawdown (0-1)0.15
circuitBreakerEmergency pause on extreme volatilitytrue

Circuit Breaker States

StateBehavior
NORMALAll checks pass, trading allowed
WARNINGApproaching limits, reduce position sizes
PAUSEDDaily loss limit hit, no new trades
HALTEDCircuit breaker triggered, positions closed

Wallets

Chain Rats uses a hierarchical wallet system. Agents never manage private keys directly.

API — Agents

POST /v1/agents

Register a new agent.

{
  "name": "hermes-001",
  "strategy": "momentum",
  "riskLimits": {
    "maxPositionSize": 1000,
    "maxDailyLoss": 200,
    "circuitBreaker": true
  }
}
GET /v1/agents/:id

Get agent details including portfolio and risk status.

PATCH /v1/agents/:id

Update agent configuration (status, risk limits).

API — Trades

POST /v1/trades

Execute a trade. Include an idempotencyKey to prevent duplicate executions.

{
  "action": "buy",
  "token": "***",
  "amount": 500.00,
  "orderType": "market",
  "idempotencyKey": "trade_20260924_001"
}
GET /v1/trades

List trades. Filter by agentId, status, token, since.

GET /v1/trades/:id

Get trade details including fill price and transaction hash.

API — Portfolio

GET /v1/portfolio

Get current portfolio: total value, positions, P&L.

GET /v1/portfolio/positions

Get individual positions with current prices and unrealized P&L.

API — Market Data

GET /v1/market/prices?tokens=NVDA,AAPL,TSLA

Get current prices for tokens.

GET /v1/market/ohlcv?token=***&interval=1h

Get historical OHLCV data. Intervals: 1m, 5m, 15m, 1h, 4h, 1d.

API — Risk

GET /v1/risk/status

Get current risk status: circuit breaker state, limit usage, exposure.

PATCH /v1/risk/limits

Update risk limits.

SDK — TypeScript

import { AgentClient } from '@chainrats/sdk';

const agent = new AgentClient({
  apiKey: '***',
  baseUrl: 'https://api.chainrats.com/v1'
});

// Execute trade
const trade = await agent.trade({
  action: 'buy',
  token: '***',
  amount: 500,
  orderType: 'market'
});

// Get portfolio
const portfolio = await agent.getPortfolio();

// Subscribe to real-time updates
agent.on('trade:update', (trade) => {
  console.log('Trade updated:', trade);
});

agent.on('portfolio:update', (portfolio) => {
  console.log('Portfolio value:', portfolio.totalValue);
});

SDK — Python

from chainrats import AgentClient

agent = AgentClient(
    api_key='***',
    base_url='https://api.chainrats.com/v1'
)

# Execute trade
trade = agent.trade(
    action='buy',
    token='***',
    amount=500,
    order_type='market'
)

# Get portfolio
portfolio = agent.get_portfolio()
print(f"Total value: {portfolio.total_value}")