Pre-built integrations for popular AI frameworks
from langchain.agents import Tool, AgentExecutor, initialize_agent
from langchain.llms import OpenAI
import requests
# Initialize HGM API client
HGM_API_KEY = "your_api_key_here"
HGM_BASE_URL = "https://api.hgm.io"
def get_arbitrage_opportunities(market: str = "global"):
"""Fetch real-time arbitrage opportunities from HGM"""
response = requests.get(
f"{HGM_BASE_URL}/api/scanner/opportunities",
params={"market": market},
headers={"Authorization": f"Bearer {HGM_API_KEY}"}
)
return response.json()["opportunities"]
def get_market_intelligence(category: str):
"""Get macro signals and market intelligence"""
response = requests.get(
f"{HGM_BASE_URL}/api/market-intelligence",
params={"category": category},
headers={"Authorization": f"Bearer {HGM_API_KEY}"}
)
return response.json()
# Create tools for the agent
tools = [
Tool(
name="HGM Arbitrage Scanner",
func=get_arbitrage_opportunities,
description="Get real-time arbitrage opportunities across markets"
),
Tool(
name="HGM Market Intelligence",
func=get_market_intelligence,
description="Get macro signals, sentiment, and market analysis"
)
]
# Initialize agent
llm = OpenAI(temperature=0)
agent = initialize_agent(tools, llm, agent="zero-shot-react-description")
# Use the agent
result = agent.run("Find high-confidence crypto arbitrage opportunities in Asia")
print(result)