Skip to main content

Building with the Hoops API

Welcome to the practical guide for integrating with the Hoops Finance API! This section provides real-world examples and code snippets to help you build powerful DeFi applications quickly.

What You'll Learn

  • Analytics Dashboards - Build comprehensive DeFi analytics with TVL, volume, and fee data
  • Wallet Tracking - Monitor wallet balances, transactions, and operations on Stellar
  • Token Data Management - Fetch and display token metadata for UI components
  • Liquidity Monitoring - Track pool health and identify trading opportunities

Supported Languages & Tools

The Hoops Finance API is accessible via any language that can make HTTP requests. Below are examples in multiple languages to help you get started quickly.

Modern JavaScript Support

All JavaScript and TypeScript examples use the native fetch API, which is built into modern browsers and Node.js 18+. No extra dependencies required.

Basic API Setup

import requests
import json

BASE_URL = "https://api.hoops.finance"

def make_request(endpoint):
"""Make a GET request to the Hoops Finance API"""
url = f"{BASE_URL}/{endpoint}"
response = requests.get(url)
response.raise_for_status()
return response.json()

Getting Started

No Authentication Required

The Hoops Finance Public AMM API doesn't require API keys for most endpoints, making it perfect for quick prototyping and development.

Python:

  • requests - HTTP library for API calls
  • pandas - Data manipulation and analysis
  • plotly or matplotlib - Data visualization

JavaScript:

  • Native fetch API - Built-in HTTP client (no dependencies)
  • chart.js or d3.js - Charting and visualization

API Base URLs

  • Production: https://api.hoops.finance
  • Local Development: http://localhost:9999

Rate Limits

  • 120 requests per minute
  • 30 requests burst limit
  • Monitor with X-RateLimit-* headers

Stellar Classic Endpoints

Stellar Classic Support

Some endpoints work with Stellar Classic blockchain data. These are clearly marked throughout the documentation.

Endpoints that support Stellar Classic include:

  • Account information and balances
  • Transaction history
  • Asset details
  • Payment tracking

Quick Example

Here's a simple example to get platform metrics in multiple languages:

import requests

def get_platform_metrics():
"""Fetch basic platform metrics"""
response = requests.get("https://api.hoops.finance/getmetrics?period=24h")
return response.json()

# Usage
metrics = get_platform_metrics()
print(f"Total TVL: ${metrics['tvl']:,.2f}")
print(f"24h Volume: ${metrics['volume24h']:,.2f}")

What's Next?

API Reference

For complete endpoint documentation, visit the API Reference section.

Support

Need help? Contact us at [email protected] or check out our interactive API testing tools.