Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

HTTP Endpoints

POST /info

HTTP endpoint for querying order book data. Your IP address must be whitelisted - authentication is automatic.


All Mids

Request mid prices for all trading pairs.

Request:
{
  "type": "allMids"
}
Response:
{
  "BTC": "97000.5",
  "ETH": "3500.25",
  ...
}

Returns a map of coin symbols to their mid prices as strings.


Impact Price

Calculate impact prices for a given coin and notional size.

Request:
{
  "type": "impactPrice",
  "coin": "BTC",
  "notional": "10000"
}
FieldTypeRequiredDescription
typestringyesMust be "impactPrice"
coinstringyesTrading pair (e.g., "BTC", "ETH")
notionalstringyesNotional size in USD
Response:
{
  "buyImpactPx": "97100.5",
  "sellImpactPx": "96900.3",
  "time": 1703271234000
}
FieldTypeDescription
buyImpactPxstring | nullPrice to buy the notional amount (walk asks)
sellImpactPxstring | nullPrice to sell the notional amount (walk bids)
timenumberTimestamp in milliseconds
Error Responses:
  • 400 Bad Request - Invalid notional value
  • 500 Internal Server Error - Failed to process request

Example: cURL

All Mids

curl -X POST https://api.example.com/info \
  -H "Content-Type: application/json" \
  -d '{"type": "allMids"}'

Impact Price

curl -X POST https://api.example.com/info \
  -H "Content-Type: application/json" \
  -d '{"type": "impactPrice", "coin": "BTC", "notional": "100000"}'

IP Whitelist Management

Endpoints for managing IP whitelists. Requires signature authentication.

Authentication Header:
Authorization: Signature ts=<timestamp>,sig=<signature>
ParameterTypeDescription
tsnumberUnix timestamp in seconds (must be within 60s of server time)
sigstringEthereum signature (hex with 0x prefix)

Sign the message hfun-feed:<timestamp> with your Ethereum wallet. The signature must be from an address with an active AlphaHype seat.

Example (JavaScript/ethers.js):
const timestamp = Math.floor(Date.now() / 1000);
const message = `hfun-feed:${timestamp}`;
const signature = await wallet.signMessage(message);
 
const headers = {
    'Authorization': `Signature ts=${timestamp},sig=${signature}`,
    'Content-Type': 'application/json'
};

POST /ip/add

Add an IP address to the whitelist for the authenticated address.

Request:
{
  "ip": "203.0.113.42"
}
FieldTypeRequiredDescription
ipstringyesIPv4 or IPv6 address to add
Response (200 OK):
{
  "status": "ok",
  "ip": "203.0.113.42"
}
Errors:
  • 400 Bad Request - Invalid IP address format or IP already whitelisted
  • 401 Unauthorized - Invalid or missing signature
  • 403 Forbidden - Signer does not have an active seat, or max IPs per seat exceeded
  • 503 Service Unavailable - IP whitelist feature not enabled

POST /ip/remove

Remove an IP address from the whitelist for the authenticated address.

Request:
{
  "ip": "203.0.113.42"
}
FieldTypeRequiredDescription
ipstringyesIPv4 or IPv6 address to remove
Response (200 OK):
{
  "status": "ok",
  "ip": "203.0.113.42"
}
Errors:
  • 400 Bad Request - Invalid IP address format
  • 401 Unauthorized - Invalid or missing signature
  • 403 Forbidden - Signer does not have an active seat
  • 503 Service Unavailable - IP whitelist feature not enabled

POST /ip/list

List all whitelisted IP addresses for the authenticated address.

Request:

Empty body or {}.

Response (200 OK):
{
  "ips": [
    "203.0.113.42",
    "198.51.100.10"
  ]
}
Errors:
  • 401 Unauthorized - Invalid or missing signature
  • 403 Forbidden - Signer does not have an active seat
  • 503 Service Unavailable - IP whitelist feature not enabled

Example: IP Management with cURL

Add IP

curl -X POST https://api.example.com/ip/add \
  -H "Content-Type: application/json" \
  -H "Authorization: Signature ts=1234567890,sig=0x..." \
  -d '{"ip": "203.0.113.42"}'

Remove IP

curl -X POST https://api.example.com/ip/remove \
  -H "Content-Type: application/json" \
  -H "Authorization: Signature ts=1234567890,sig=0x..." \
  -d '{"ip": "203.0.113.42"}'

List IPs

curl -X POST https://api.example.com/ip/list \
  -H "Content-Type: application/json" \
  -H "Authorization: Signature ts=1234567890,sig=0x..." \
  -d '{}'