---
title: "AGENTS.md — ATrader Pro Autonomous Agent Skill Guide"
description: "Machine-executable instructions, API integration guide, and risk rules for AI agents."
last_updated: "2026-09-12"
canonical: "https://atrader.pro/AGENTS.md"
---
# ATrader Pro — Autonomous Trading Agent Skill & Integration Guide

> Formal machine-executable repository instructions, operational parameters, and API integration guides for autonomous AI agents, LLMs, and quantitative developers interfacing with ATrader Pro (https://atrader.pro) and Deriv API WebSockets.

## Scope
- Applies to all programmatic integrations, LLM tooling, Model Context Protocol (MCP) clients, and automated agents interacting with ATrader Pro.
- Standard protocol specifications: Vercel Agent Readability Spec, llmstxt.org v2, RFC 8414 (OAuth Server Metadata), RFC 9728 (OAuth Protected Resource Metadata), and OpenAPI 3.1.
- Production public domain: `https://atrader.pro`.
- Official WebSocket gateway: `wss://ws.derivws.com/websockets/v3?app_id=1089`.

## Install & Prerequisites

To interact with ATrader Pro APIs and Deriv WebSockets in your agent runtime:

```bash
# Node.js / TypeScript environment
npm install ws @types/ws dotenv
# or using pnpm
pnpm add ws @types/ws dotenv
```

For Python-based agents:

```bash
# Python 3.10+
pip install websockets requests pydantic
```

## Configure

Set the following environment variables in your secure vault or `.env.local` before execution:

```bash
# Official Deriv Account Token (generate at https://app.deriv.com/account/api-token)
DERIV_API_TOKEN="your_deriv_api_token_here"

# Deriv Official Application ID (Production / ATrader default: 1089)
DERIV_APP_ID="1089"

# ATrader Pro API Base Endpoint
ATRADER_API_BASE="https://atrader.pro/api"

# Mandatory Risk Ceiling (Max drawdown per trading session in USD)
MAX_SESSION_LOSS_USD="50.00"

# Target Profit per session in USD
SESSION_TAKE_PROFIT_USD="25.00"

# Maximum Martingale Multiplication Factor (Recommended: 2.4x)
MARTINGALE_FACTOR="2.4"
```

## Usage & Executable Examples

### 1. TypeScript / Node.js: Authenticate and Inspect Bot Status

```typescript
import WebSocket from 'ws'

interface DerivAuthorizeResponse {
  authorize: {
    email: string
    balance: number
    currency: string
    is_virtual: number
    loginid: string
  }
}

async function connectToDeriv(token: string, appId: string = '1089'): Promise<void> {
  const ws = new WebSocket(`wss://ws.derivws.com/websockets/v3?app_id=${appId}`)

  ws.on('open', () => {
    console.log('[ATrader Agent] Connected to Deriv WebSocket. Authenticating...')
    ws.send(JSON.stringify({ authorize: token }))
  })

  ws.on('message', (raw: string) => {
    const data = JSON.parse(raw.toString())
    if (data.msg_type === 'authorize') {
      const auth = (data as DerivAuthorizeResponse).authorize
      console.log(`[ATrader Agent] Authenticated as ${auth.loginid} (${auth.is_virtual ? 'Demo Sandbox' : 'Real Account'})`)
      console.log(`[ATrader Agent] Balance: ${auth.balance} ${auth.currency}`)
      
      // Request active ticks for Volatility 100
      ws.send(JSON.stringify({ ticks: 'R_100', subscribe: 1 }))
    }

    if (data.msg_type === 'tick') {
      console.log(`[Tick R_100] Quote: ${data.tick.quote} (Epoch: ${data.tick.epoch})`)
    }
  })

  ws.on('error', (err) => {
    console.error('[ATrader Agent] WebSocket error:', err)
  })
}

// Execute with your token
connectToDeriv(process.env.DERIV_API_TOKEN || '')
```

### 2. Python: Query Live AI Signals & REST OpenAPI Endpoints

```python
import os
import requests

ATRADER_BASE = os.getenv("ATRADER_API_BASE", "https://atrader.pro/api")

def fetch_live_signals():
    """Fetches high-confluence AI trading signals (>90% win rate)."""
    url = f"{ATRADER_BASE}/signals"
    headers = {
        "Accept": "application/json",
        "User-Agent": "ATrader-Autonomous-Agent/2.0"
    }
    response = requests.get(url, headers=headers, timeout=10)
    response.raise_for_status()
    signals = response.json()
    print(f"Retrieved {len(signals)} live confluence signals from ATrader Pro.")
    return signals

def fetch_openapi_spec():
    """Validates OpenAPI 3.1 contract."""
    res = requests.get("https://atrader.pro/openapi.json", timeout=10)
    res.raise_for_status()
    schema = res.json()
    print(f"OpenAPI Spec: {schema.get('info', {}).get('title')} v{schema.get('info', {}).get('version')}")

if __name__ == "__main__":
    fetch_openapi_spec()
```

## Conventions & Safety Rules

- **Mandatory Sandbox First**: Agents MUST test all algorithmic orders on a Virtual/Demo account (`VRT...` with $10,000 USD virtual credit) prior to real-money deployment.
- **Strict Stop-Loss Enforcement**: Every bot execution sequence must define an explicit `max_loss` parameter. If accumulated losses exceed `MAX_SESSION_LOSS_USD`, terminate execution immediately.
- **No Uncapped Martingale**: Never exceed 5 recovery steps without human confirmation. ATrader pre-calibrated profiles enforce 1.6x (Conservative), 2.0x (Standard), and 2.4x (Moderate).
- **OAuth Protocol**: Respect RFC 7636 PKCE parameters. Tokens must be stored with AES-256 encryption at rest. Never print or log cleartext API keys.

## Don't Touch

- Production database credentials and internal webhook signing secrets.
- Corrupted `.xml` DBot legacy files; ATrader Pro operates exclusively cloud-native via WebSocket APIs.
- User authentication tables and session cookies.

## Further Reading & Machine Index

- Full Machine-Readable Sitemap: [https://atrader.pro/sitemap.md](https://atrader.pro/sitemap.md)
- OpenAPI 3.1 Schema: [https://atrader.pro/openapi.json](https://atrader.pro/openapi.json)
- Model Context Protocol (MCP) Manifest: [https://atrader.pro/.well-known/mcp.json](https://atrader.pro/.well-known/mcp.json)
- LLMs.txt Context Index: [https://atrader.pro/llms.txt](https://atrader.pro/llms.txt)
- Technical Specifications (llms-full.txt): [https://atrader.pro/llms-full.txt](https://atrader.pro/llms-full.txt)
- Technical Glossary & Definitions: [https://atrader.pro/glossary](https://atrader.pro/glossary)
- Operational Risk Disclosure: [https://atrader.pro/risk](https://atrader.pro/risk)

## Sitemap

See the full machine-readable [sitemap](https://atrader.pro/sitemap.md) for all pages, bots, tools, and technical documentation.
