Agent Integration Guide

Build autonomous AI agents that discover, evaluate, and execute trading strategies with HGM Intelligence API.

Quick Start (3 Steps)

1

Get API Key

Sign up for free and get instant API access

Learn more
2

Authenticate

Use Bearer token in Authorization header

Learn more
3

Start Querying

Call endpoints and receive real-time data

Learn more

Built for Autonomous Agents

Sub-100ms Latency

P95 latency of 85ms ensures agents can execute decisions instantly

Cryptographic Receipts

Every API call generates HMAC-SHA256 signed receipts for verification

Per-Request Billing

Pay only for what you use via x402 protocol in USDC

Automated Onboarding

3-call setup: discover → authenticate → start querying

WebSocket Support

Real-time streaming of opportunities, alerts, and market data

Webhook Integration

Push notifications for opportunities, alerts, and sentiment changes

Batch Operations

Query multiple categories and assets in single request

Error Recovery

Automatic retry with exponential backoff and detailed error codes

Authentication

All API requests require a Bearer token in the Authorization header:

Authorization: Bearer hgm_live_xxxxxxxxxxxxx

Get your API key from the Agent Dashboard

Code Examples

Python Agent

import requests
import json
from datetime import datetime

# Initialize HGM API client
class HGMAgent:
    def __init__(self, api_key: str):
        self.api_key = api_key
        self.base_url = "https://api.heathglobalmacro.xyz"
        self.headers = {
            "Authorization": f"Bearer {api_key}",
            "Content-Type": "application/json"
        }
    
    def discover_opportunities(self, min_confidence: int = 80):
        """Discover arbitrage opportunities"""
        response = requests.get(
            f"{self.base_url}/api/v1/opportunities",
            params={"minConfidence": min_confidence},
            headers=self.headers
        )
        return response.json()
    
    def get_market_intelligence(self):
        """Get macro indicators and sector signals"""
        response = requests.get(
            f"{self.base_url}/api/v1/market-intelligence",
            headers=self.headers
        )
        return response.json()
    
    def get_sentiment(self, asset: str = None):
        """Get sentiment analysis"""
        params = {}
        if asset:
            params["asset"] = asset
        
        response = requests.get(
            f"{self.base_url}/api/v1/sentiment",
            params=params,
            headers=self.headers
        )
        return response.json()
    
    def execute_autonomous_workflow(self):
        """Example autonomous trading workflow"""
        # 1. Discover opportunities
        opportunities = self.discover_opportunities(min_confidence=85)
        
        # 2. Get market intelligence
        intelligence = self.get_market_intelligence()
        
        # 3. Get sentiment
        sentiment = self.get_sentiment()
        
        # 4. Evaluate and execute
        for opp in opportunities['data']:
            if opp['confidence'] > 85 and sentiment['sentiment_score'] > 0.7:
                print(f"Executing: {opp['name']}")
                print(f"Expected Return: {opp['expectedReturn']}")
                print(f"Spread: {opp['spread']}%")
        
        return {
            "opportunities": opportunities,
            "intelligence": intelligence,
            "sentiment": sentiment,
            "timestamp": datetime.now().isoformat()
        }

# Usage
if __name__ == "__main__":
    agent = HGMAgent(api_key="your_api_key_here")
    result = agent.execute_autonomous_workflow()
    print(json.dumps(result, indent=2))

Core Endpoints

GET/api/v1/opportunities

Discover arbitrage opportunities across 8 market categories

$0.001 per call

GET/api/v1/market-intelligence

Get macro indicators, sector signals, and volatility indices

$0.0005 per call

GET/api/v1/sentiment

Real-time sentiment analysis from news and social media

$0.002 per call

GET/api/v1/alerts/weather

Weather events affecting commodity prices

$0.0003 per call

GET/api/v1/alerts/policy

Policy changes and regulatory updates

$0.0005 per call

Need Help?