Skip to main content

Quickstart

You need an API key on a PAYG, Grow or Enterprise plan. See Authentication.

Resolve Bitcoin, read its last day of events, then see how accounts are positioned on it.

BASE=https://api.elfa.ai

# 1. Resolve. Check the name: the first match may not be the asset you meant.
ID=$(curl -s "$BASE/v3/entities?q=btc&entityType=token&limit=1" \
-H "x-elfa-api-key: $ELFA_API_KEY" | jq -r '.entities[0].id')

# 2. Its events of the last 24 hours. from is required, in seconds.
# An empty list is a quiet range, not an error.
FROM=$(( $(date +%s) - 86400 ))
curl -s "$BASE/v3/events?entityIds=$ID&from=$FROM&limit=10" \
-H "x-elfa-api-key: $ELFA_API_KEY"

# 3. Open longs and shorts on it right now.
curl -s "$BASE/v3/calls/positioning?entityId=$ID" \
-H "x-elfa-api-key: $ELFA_API_KEY"

See Choosing a Match before you rely on step 1, and Workflows for longer recipes.