# Crypto portfolio tracker

Use case. Show what a set of holdings is worth now and on a past day, from four routes.

A portfolio tracker multiplies what you hold by a price. It needs the latest price of every coin in one call, the price on the day you bought, and a daily series for the chart. Those are four routes on this API.

- One `/v2/simple/price` call prices up to 250 coins, with the 24-hour change and the time of each price.
- Prices are the median of up to seven exchanges, in USD or converted to 150 currency codes.
- There is no market cap, supply or rank, so a tracker that sorts by market cap needs another source.

## Routes it uses

| Job | Route |
|---|---|
| Value of every holding now | `/v2/simple/price?ids=...&vs_currencies=usd` |
| Turn a name or ticker into a coin id | `/v2/coins/list` and `/v2/search?query=` |
| Price on the day someone bought | `/v2/coins/{id}/history?date=dd-mm-yyyy` |
| Chart of the value over time | `/v2/coins/{id}/market_chart?days=...&interval=daily` |

## Current value

This script holds three positions, asks for all three prices in one call and prints each value and the total. An id the API does not know is left out of the answer, not an error, and an answer with none still counts as a call. It needs `requests` and the key in `COINPRICE_API_KEY`, as in [the Python guide](/guides/python-crypto-prices).

Python:

```python
import os
import requests

API = "https://api.coinprice.dev/v2"
HEADERS = {"Authorization": f"Bearer {os.environ['COINPRICE_API_KEY']}"}

holdings = {"bitcoin": 0.25, "ethereum": 3.0, "solana": 40}  # coin id: amount you hold

response = requests.get(
    f"{API}/simple/price",
    headers=HEADERS,
    params={"ids": ",".join(holdings), "vs_currencies": "usd", "include_24hr_change": "true"},
    timeout=10,
)
prices = response.json()

total = 0
for coin, amount in holdings.items():
    value = amount * prices[coin]["usd"]
    total += value
    change = prices[coin]["usd_24h_change"]
    change_text = f"{change:+.2f}%" if change is not None else "n/a"
    print(f"{coin:<10} {amount:>6} x {prices[coin]['usd']:>10,.2f} = {value:>12,.2f}  ({change_text} 24h)")
print(f"{'total':<10} {'':>6}   {'':>10}   {total:>12,.2f}")
```

Output, real run, 2026-11-24 04:32 UTC:

```text
bitcoin      0.25 x  60,439.05 =    15,109.76  (-1.24% 24h)
ethereum      3.0 x   1,698.46 =     5,095.37  (-1.82% 24h)
solana         40 x      71.72 =     2,868.74  (+0.60% 24h)
total                               23,073.87
```

## The price on the day of a purchase

`/coins/{id}/history` takes a date as `dd-mm-yyyy` and answers with the price that day.

curl:

```bash
curl -s -H "Authorization: Bearer $COINPRICE_API_KEY" \
  "https://api.coinprice.dev/v2/coins/bitcoin/history?date=01-11-2026"
```

JSON, real response, 2026-11-24 04:32 UTC:

```json
{
  "id": "bitcoin",
  "last_updated_at": 1793577600,
  "market_data": {
    "current_price": {
      "usd": 78238.46539
    }
  },
  "name": "Bitcoin",
  "symbol": "btc"
}
```

A day with no price returns a 404. Bitcoin's daily history starts on 1 Jan 2023, so a purchase before that has no price here. Other coins start when they began; `/v2/coverage` shows `daily_from` for each.

## The chart

`market_chart` with `interval=daily` returns one `[time in ms, price]` point a day. Ask for one coin at a time and multiply by the amount held on each day.

curl:

```bash
curl -s -H "Authorization: Bearer $COINPRICE_API_KEY" \
  "https://api.coinprice.dev/v2/coins/bitcoin/market_chart?days=3&interval=daily"
```

JSON, real response, 2026-11-24 04:32 UTC:

```json
{
  "market_caps": [],
  "prices": [
    [
      1795219200000,
      60090.05557
    ],
    [
      1795305600000,
      61166.13363
    ],
    [
      1795392000000,
      61204.98194
    ]
  ],
  "total_volumes": []
}
```

## Why this data fits

- Every price carries its `last_updated_at`, so the tracker can show a price as old when it is.
- One call for the whole portfolio keeps the call count low. Refreshing every minute is 43,200 calls a month, inside the Free plan. Every 15 seconds is 172,800, which fits Starter.
- Each plan stops at its monthly limit with no extra charge, and we email you at 80% and 100%.

## What it does not do

Market cap, circulating supply and rank come back as `null`. Coins on fewer than two exchanges are not listed, and coins that exist only on a chain, such as a token with no exchange listing, are not covered. Check [coverage](/coverage) for your coins.

## Questions

**How many coins can one call price?** Up to 250. A request counts as one call whatever the number of ids.

**Can I show values in my own currency?** Yes. Pass a code from /v2/simple/supported_vs_currencies as vs_currencies, for example eur or idr. A chart or candle history in another currency is converted at today's rate.
