> For the complete documentation index, see [llms.txt](https://docs.koinju.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.koinju.io/exchanges/bitstamp.md).

# Bitstamp Spot historical trade data

Bitstamp Spot historical trade data since 2023-07-01, available through SQL or REST in one unified schema and checked every day against Bitstamp's own data.

Koinju provides Bitstamp Spot trades and OHLCV candles for all markets since **2023-07-01**, under the exchange ID `bitstamp`. This page explains what that gives you compared with Bitstamp's own API, how we collect the data, and how we verify that no trades are missed.

{% hint style="info" %}
How far back you can query depends on your plan: see [Pricing](/pricing.md). Every exchange and its start date is listed on [Coverage](/data/coverage.md).
{% endhint %}

## Why use Koinju for Bitstamp data

* **Full history in one place.** Bitstamp's REST transactions endpoint, which our volume check uses, returns trades for a time interval of a minute, an hour or a day, with no parameter to request an earlier period ([Bitstamp docs](https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions)). Koinju provides it as one continuous history since 2023-07-01, aligned to UTC days and queryable for any period through SQL or REST.
* **One schema across exchanges.** Unified symbols and columns across every exchange we cover, Bitstamp included, so the same query works on all of them.
* **Checked against Bitstamp's own data.** Every day, each market's volume is compared with Bitstamp's own trades, as published by its REST API, and any missing trades are added.
* **Faithful to Bitstamp.** Bitstamp's own trade IDs and trade times.

## At a glance

| Property              | Value                                                                               |
| --------------------- | ----------------------------------------------------------------------------------- |
| Exchange ID           | `bitstamp`                                                                          |
| Historical data since | 2023-07-01                                                                          |
| Data types            | Public trades, OHLCV                                                                |
| Collected from        | Bitstamp's real-time WebSocket API v2, live ticker channel (`live_trades_<market>`) |
| Volume check          | Every day, against Bitstamp's REST trades, summed per UTC day                       |

## How we collect Bitstamp trades

* **Bitstamp's live ticker channel.** We subscribe to Bitstamp's [live ticker channel](https://www.bitstamp.net/websocket/v2/) (`live_trades_<market>`) for every Bitstamp Spot market with trading enabled. Each `trade` event is stored as its own row with Bitstamp's own trade ID.
* **New listings picked up automatically.** The market list is refreshed every minute, and new markets are subscribed without a restart.
* **Active redundancy.** Every market is collected twice, by two collectors running in parallel. If one connection drops, it reconnects and resubscribes automatically while the other keeps collecting trades. Both copies of a trade share one key (exchange, market and trade ID), so the second copy is dropped before storage, and anything missed is recovered by the checks below.
* **Bitstamp's timestamps.** A trade's `timestamp` is the trade time reported by Bitstamp, not the time we received it.

## From Bitstamp's message to your data

Each trade Bitstamp publishes is stored as one row, with Bitstamp's fields mapped to the same columns used for every exchange:

| Bitstamp field   | Koinju column | Notes                                                   |
| ---------------- | ------------- | ------------------------------------------------------- |
| `channel`        | `market`      | Koinju's universal symbol, for example `BTC-USD`        |
| `id`             | `trade_id`    | Bitstamp's own trade ID                                 |
| `price`          | `price`       | Bitstamp's trade price                                  |
| `amount`         | `quantity`    | Bitstamp's trade amount                                 |
| `type`           | `side`        | `buy` for `0`, `sell` for `1`, as Bitstamp publishes it |
| `microtimestamp` | `timestamp`   | Bitstamp's trade time, in microseconds                  |

## How we verify that no Bitstamp trades are missed

### Volume check against Bitstamp's own trades

The reference is Bitstamp's own trades, as published by its REST API. That API serves trades for a time interval of a minute, an hour or a day, with no parameter for an earlier period, so we save the trades it publishes several times a day, and each UTC day's reference is the sum of those saved trades. Each day is checked the morning after, once the whole day has been saved. The daily rhythm follows the reference data rather than an arbitrary time window.

1. **Compare.** Each market's volume for the UTC day is compared with the sum of Bitstamp's REST trades for that day. Markets where our volume is lower than Bitstamp's go to step 2.
2. **Add.** For those markets, the comparison is repeated hour by hour. The trades of the hours that differ are taken from the saved Bitstamp REST trades, and only trades we do not already hold are added.
3. **Re-check.** The whole comparison runs again on the updated data, and any difference that remains is flagged for review.

A day is marked as checked only after all three steps complete. If any step fails, the day stays open and is retried on the next run.

## Bitstamp-specific details

* **UTC days.** Each of Bitstamp's REST trades carries its own trade time (`date`, a Unix timestamp), so the reference covers exactly the same UTC day as our daily total.
* **The exact figure compared.** The volume check compares the sum of the `amount` field of Bitstamp's REST trades, counting each trade ID (`tid`) once, with the sum of the trade quantities we hold for that day.

## Access Bitstamp data

* [Public trades](/data/public-trades.md): every trade, through SQL (`api.trade`) or REST, with `exchange = 'bitstamp'`.
* [OHLCV](/data/ohlcv.md): candles for every market.
* [Market list](/data/market-list.md): all `bitstamp` markets and their symbols.
* [How to connect](/how-to-connect.md): SQL, REST and client setup.

## FAQ

**What does Koinju compare Bitstamp trades against?**

Bitstamp's own trades, as published by its REST API. We save the trades it publishes several times a day. Every day, each market's volume is compared with those saved trades, and any missing trades are added from them.

**Which timestamp does Koinju store?**

The trade time reported by Bitstamp.

**Which Bitstamp Spot markets are included?**

Every Spot market Bitstamp lists with trading enabled. The market list is refreshed every minute, so a new listing is subscribed within a minute of appearing in Bitstamp's market list.
