Fetch Token Information

This script retrieves detailed token analytics, including liquidity, holder distribution, and transaction history.

// import requests

# Constants
API_KEY = "your_api_key"
BASE_URL = "https://api.bobradar.io"
TOKEN_ADDRESS = "EXAMPLE_TOKEN_ADDRESS"

# Function to fetch token details
def get_token_info(token_address):
    url = f"{BASE_URL}/api/token/{token_address}"
    headers = {
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json"
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status()  # Raise an error for bad responses (4xx, 5xx)
        token_data = response.json()
        return token_data
    except requests.exceptions.RequestException as e:
        print(f"Error fetching token data: {e}")
        return None

# Fetch and display token data
token_info = get_token_info(TOKEN_ADDRESS)
if token_info:
    print("Token Information:")
    print(token_info)

Response Example:

//{
  "token": "EXAMPLE_TOKEN",
  "symbol": "EXT",
  "liquidity": "5000 SOL",
  "holders": 1200,
  "market_cap": "2,500,000 USDC",
  "transactions": [
    {
      "tx_hash": "#",
      "from": "wallet_1",
      "to": "wallet_2",
      "amount": 50,
      "timestamp": "2024-02-14T12:34:56Z"
    },
    {
      "tx_hash": "0xdef456",
      "from": "wallet_3",
      "to": "wallet_4",
      "amount": 100,
      "timestamp": "2024-02-14T12:40:12Z"
    }
  ]
}

Last updated