raresats.net API
Market data View as Markdown

Prices

GET/api/prices

The current BTC/USD price and one price per UTC day since 2010-07-19, for converting sats to dollars at the time of a sale. Cacheable 5 minutes (1 minute while nothing is available). Never an error: unavailable parts are null.

Example request #

cURL
curl 'https://raresats.net/api/prices'
JavaScript
const response = await fetch('https://raresats.net/api/prices');
const data = await response.json();
Python
import requests

data = requests.get("https://raresats.net/api/prices").json()

Response 200 #

FieldTypeDescription
currentobject | nullThe BTC price now: usd (dollars) and time (unix seconds of the quote). null while the source is down (after an hour of last good values).
current.usdnumberDollars per bitcoin.
current.timeintegerUnix seconds.
historyobject | nullOne price a UTC day: usd[i] is the day starting start + i × step. null while unavailable.
history.startintegerUnix seconds of the first day (2010-07-19).
history.step86400Seconds per entry: one day.
history.usdarray of numberDaily dollars per bitcoin (the mean of the day's quotes; 4 significant digits under $100, whole dollars above).
Response
{
  "current": {"usd": 86772, "time": 1790945710},
  "history": {"start": 1279497600, "step": 86400, "usd": [0.0858, 0.0808, 0.0747]}
}

Errors #

None of its own.

To value a sale in dollars at the time it happened: usd[Math.floor((time - start) / 86400)] × price / 100000000, with time the sale's unix seconds and price in sats.