Skip to main content
GET
/
api
/
v1
/
arbitrage
/
history
Get Arbitrage History
curl --request GET \
  --url https://api.example.com/api/v1/arbitrage/history
{
  "history": [
    {
      "id": 123,
      "symbol": "<string>",
      "buy_exchange": "<string>",
      "sell_exchange": "<string>",
      "buy_price": 123,
      "sell_price": 123,
      "profit_percent": 123,
      "detected_at": "<string>"
    }
  ],
  "count": 123,
  "page": 123,
  "limit": 123
}

Overview

This endpoint returns historical arbitrage opportunities that were detected by the system. It supports filtering by symbol, exchange, and date range, with pagination for large result sets.

Query Parameters

page
integer
default:"1"
Page number for pagination (starts at 1)
limit
integer
default:"20"
Number of items per page (1-100)
symbol
string
Filter by trading pair symbol (e.g., BTC/USDT)
exchange
string
Filter by exchange name (applies to both buy and sell exchanges)
start_date
string
Filter opportunities detected after this date (ISO 8601 format: 2026-03-01T00:00:00Z)
end_date
string
Filter opportunities detected before this date (ISO 8601 format)

Response

history
array
List of historical arbitrage opportunities
count
integer
Number of items in the current page
page
integer
Current page number
limit
integer
Items per page limit

Data Retention

Historical arbitrage data is stored with the following retention policy:
  • Spot arbitrage opportunities: Retained for analysis and backtesting
  • Data age: The endpoint retrieves opportunities from the last 24 hours by default
  • Database table: arbitrage_opportunities
For long-term historical analysis, consider exporting data periodically or using the statistics endpoint.

Example Request

curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?symbol=BTC/USDT&page=1&limit=10" \
  -H "Authorization: Bearer YOUR_API_KEY"

Example Response

{
  "history": [
    {
      "id": 12847,
      "symbol": "BTC/USDT",
      "buy_exchange": "binance",
      "sell_exchange": "bybit",
      "buy_price": 43250.50,
      "sell_price": 43680.25,
      "profit_percent": 0.993,
      "detected_at": "2026-03-03T09:45:12Z"
    },
    {
      "id": 12846,
      "symbol": "BTC/USDT",
      "buy_exchange": "okx",
      "sell_exchange": "bitget",
      "buy_price": 43180.00,
      "sell_price": 43550.80,
      "profit_percent": 0.858,
      "detected_at": "2026-03-03T09:30:45Z"
    },
    {
      "id": 12845,
      "symbol": "BTC/USDT",
      "buy_exchange": "binance",
      "sell_exchange": "okx",
      "buy_price": 43100.25,
      "sell_price": 43425.60,
      "profit_percent": 0.755,
      "detected_at": "2026-03-03T09:15:20Z"
    }
  ],
  "count": 3,
  "page": 1,
  "limit": 10
}

Pagination

When working with large datasets, use pagination to retrieve results efficiently:
# First page
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?page=1&limit=20"

# Second page
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?page=2&limit=20"

# Third page
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?page=3&limit=20"
Pagination Tips:
  • Use appropriate limit values (10-50) for optimal performance
  • The count field tells you how many items are in the current page
  • If count < limit, you’ve reached the last page
  • Maximum limit is 100 items per request

Filtering by Date Range

Retrieve opportunities within a specific time window:
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?start_date=2026-03-01T00:00:00Z&end_date=2026-03-03T23:59:59Z" \
  -H "Authorization: Bearer YOUR_API_KEY"

Combining Filters

All query parameters can be combined for precise filtering:
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?symbol=ETH/USDT&exchange=binance&start_date=2026-03-01T00:00:00Z&page=1&limit=25" \
  -H "Authorization: Bearer YOUR_API_KEY"

Use Cases

1. Backtesting Strategies

Analyze historical opportunities to validate trading strategies:
const response = await fetch(
  'https://api.neuratrade.com/api/v1/arbitrage/history?symbol=BTC/USDT&limit=100',
  {
    headers: { 'Authorization': 'Bearer YOUR_API_KEY' }
  }
);

const data = await response.json();
const avgProfit = data.history.reduce((sum, opp) => 
  sum + opp.profit_percent, 0
) / data.history.length;

console.log(`Average profit: ${avgProfit.toFixed(3)}%`);

2. Exchange Performance Analysis

Identify which exchanges offer the best arbitrage opportunities:
import requests
from collections import Counter

response = requests.get(
    'https://api.neuratrade.com/api/v1/arbitrage/history',
    params={'limit': 100},
    headers={'Authorization': 'Bearer YOUR_API_KEY'}
)

data = response.json()
exchanges = [f"{h['buy_exchange']}-{h['sell_exchange']}" 
             for h in data['history']]
pairs = Counter(exchanges).most_common(5)

for pair, count in pairs:
    print(f"{pair}: {count} opportunities")

3. Profit Trend Analysis

Track how profit percentages change over time:
# Get last 7 days of data
curl -X GET "https://api.neuratrade.com/api/v1/arbitrage/history?start_date=2026-02-25T00:00:00Z&limit=100" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  | jq '[.history[] | {date: .detected_at, profit: .profit_percent}]'

Implementation Details

Current Implementation Note:The history endpoint currently simulates historical data from recent market data. For production deployments, ensure that detected opportunities are being persisted to the arbitrage_opportunities table for accurate historical tracking.Query logic: services/backend-api/internal/api/handlers/arbitrage.go:1024-1085

Source Reference

Implementation: services/backend-api/internal/api/handlers/arbitrage.go:240-280 Database repository: services/backend-api/internal/database/arbitrage_repository.go:143-185

Build docs developers (and LLMs) love