# Bitstamp

Source: https://docs.formance.com/v4.0/modules/connectivity/connectors/bitstamp

Stack: v4.0

Digital-asset trading and custody on Bitstamp, booked into a double-entry ledger with fees kept separate

Documented release: Bitstamp v0.5.0 (0.5.0-beta.8, beta).

## Overview

Bitstamp is a digital-asset exchange for individuals and institutions. One
Bitstamp account holds fiat currency and digital assets together: customers
fund it by bank transfer or on-chain deposit, trade spot markets, convert
between currencies and stablecoins, withdraw to a bank or a wallet, and can
commit assets to Bitstamp Earn. An account can also have sub-accounts, each
with its own balances.

The connector books that activity into Formance Ledger. It follows each
deposit and withdrawal from the moment Bitstamp reports it until it settles
or fails, books every settled trade and conversion with its fee, and brings
sub-accounts and Earn into the same ledger as the main account. The first
connection reads the account back to its first transaction. The connector
also records the balances Bitstamp reports beside the booked position, so
the two can be compared.

The connector only reads. It never places an order, initiates a withdrawal,
or moves funds on Bitstamp. Derivatives are not yet covered.

### Provider documentation

- [Bitstamp overview](https://www.bitstamp.net/)
- [Bitstamp HTTP API v2 reference](https://www.bitstamp.net/api/)
- [Bitstamp WebSocket API v2 reference](https://www.bitstamp.net/websocket/v2/)

## Use cases

### Track deposits and withdrawals until they settle

A digital-asset deposit reaches the balance only when Bitstamp reports it final, and a withdrawal's funds are set aside from the moment it opens. Reverted, rejected, canceled, and failed items stay on the record with Bitstamp's own status. Treasury can query what is still in flight, item by item, at any point in the month.

### Keep the account's whole history in the ledger

Bitstamp's API filters reach back 30 days. The first connection reads the account from its first transaction instead, including trades, conversions, deposits, and withdrawals. The ledger then holds the account's record even for activity Bitstamp's filters no longer return.

### Compare Bitstamp's balances with booked activity

The connector records the balances Bitstamp reports for each asset (available, total, and reserved, plus Earn amounts) next to the position the ledger builds from booked activity. It adjusts neither figure, so a difference shows up per asset and can be investigated.

### See what trading and withdrawals cost

Each trading fee is booked as its own movement, so the cost of a fill does not disappear into its executed price. A fee Bitstamp charges on a withdrawal is booked next to the withdrawal. Fees can be traced fill by fill and withdrawal by withdrawal.

### Report Earn rewards apart from principal

With Earn enabled, a subscription moves the committed assets to their own Earn position and an unsubscription moves them back. Rewards land in a separate account, so yield can be reported without separating it from principal by hand.

### Bring sub-accounts into the same ledger

Each sub-account named in the configuration is read alongside the main account and keeps its own balances. A transfer to or from a sub-account is booked on the sub-account as money leaving or arriving, so each sub-account's position includes it.

## Coverage

Read both lists before you rely on this connector for a provider product or lifecycle state.

### Supported

- Digital-asset deposits, held apart while pending and credited once final, with the chain transaction, network, and address recorded; reverted and rejected deposits keep their status
- Fiat bank deposits, credited to the fiat balance when Bitstamp records them as settled
- Fiat and digital-asset withdrawals, set aside from the moment they open; a canceled or failed withdrawal returns its funds, and a withdrawal fee is booked as its own movement
- Settled spot trades in both directions, including instant buys and sells and conversions between fiat and stablecoins, each with its trading fee booked as its own movement
- Sub-accounts named in the configuration, read into the same ledger as the main account with their own balances, including transfers to and from each sub-account
- Bitstamp Earn, when enabled: committed assets move to their own position and back, and rewards land in a separate account
- The balances Bitstamp reports for each asset (available, total, and reserved, plus Earn amounts), recorded next to the booked position; the connector adjusts neither side
- History from the account's first transaction, further back than the 30 days Bitstamp's API filters reach, with each movement booked once
- Amounts booked to at least eight decimal places, so trade and fee amounts finer than Bitstamp's two-decimal fiat display are kept
- An optional live feed that brings settled trades in sooner; completeness never depends on catching a live message

### Not supported

- Moving money. The connector never places an order, initiates a withdrawal or transfer, closes a position, or changes an Earn subscription on Bitstamp
- Derivatives. Perpetual positions, their settlements, and margin are not yet covered
- Open orders. An order appears once its fills settle, and funds held by an open order show only in the reserved balance Bitstamp reports
- The main account's side of a sub-account transfer. Bitstamp does not show these transfers in the main account's history, so they appear on the sub-account only
- Sub-accounts the configuration does not name. Bitstamp offers no way to list them, so each one is added by hand
- Legacy staking and referral rewards, and transfers that carry a fee. When one appears, updates for that account pause until it is supported, instead of booking a guess
- Instant updates for deposits, withdrawals, and balances. Bitstamp has no live feed for them, so they appear with a short delay
- Deposit and withdrawal history beyond 200,000 records of each kind, which Bitstamp's API does not return; older records need an export from Bitstamp
- Status signals that move no money. Deposit review and Travel Rule status, liquidation alerts, and address registrations are not recorded
- Market data. Tickers, order books, and price history stay out of scope

## Ledger model

Profile v0.1.0. Parts of an account address in braces are replaced with provider identifiers.

### Accounts

- `bitstamp:{conn_id}`: Venue counterparty (bare leaf); deposits source from it, withdrawals and fees sink to it. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:fiat:main`: Fiat and stablecoin balance (USD, EUR, USDC, ...); funds trades and receives sells. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:crypto:main`: Crypto balance (BTC, SOL, ETH, ...). Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:margin:main`: Derivatives collateral / margin balance. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:pnl:main`: Realized derivatives PnL counterpart. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:earn:main`: Earn (lending / staking) subscription principal. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:earn:main:reward`: Earn / lending rewards received (kept separate from principal). Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:deposit:hold:processing:{tx_id}`: In-flight crypto deposit register; drains to balance on FINALIZED. Persistence: ephemeral. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`, `tx_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:withdrawal:hold:processing:{tx_id}`: In-flight withdrawal register; drains to the venue on finished. Persistence: ephemeral. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`, `tx_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:position:hold:open:{position_id}`: Open derivatives position marker. Persistence: ephemeral. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`, `position_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:suspense:main`: Last-resort source and residue. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:spot_report`: Current native report facts; metadata only. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:margin_report`: Current native report facts; metadata only. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `bitstamp:{conn_id}:earn_report`: Current native report facts; metadata only. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.
- `external:earn:main`: Earn program counterparty (reward source). Persistence: normal.
- `reconciliation:variance:bitstamp:{conn_id}:main`: Snapshot vs ledger-derived drift. Persistence: normal. Segments: `conn_id` matches `[a-zA-Z0-9_-]+`.

### Recorded activity

- `DEPOSIT_HOLD`: Crypto deposit entered a non-terminal state; open its hold from the venue. (Deposit)
- `DEPOSIT_DONE`: Crypto deposit finalized; settle from its hold before the venue fallback. (Deposit)
- `DEPOSIT_COMPENSATE`: Crypto deposit reverted or rejected; drain the hold back to the venue. (Deposit)
- `FIAT_DEPOSIT`: Settled fiat bank deposit; book it from the venue into the fiat balance. (Transaction)
- `WITHDRAWAL_HOLD`: Withdrawal opened; reserve the funds from the balance into its hold. (Withdrawal)
- `WITHDRAWAL_DONE`: Withdrawal finished; settle from its hold before the original wallet fallback. (Withdrawal)
- `WITHDRAWAL_COMPENSATE`: Withdrawal canceled or failed; drain the hold back to the balance. (Withdrawal)
- `WITHDRAWAL_FEE`: Settled withdrawal fee from the journal; book it from the balance to the venue. (Transaction)
- `TRADE`: Spot trade fill with a fee (also covers fiat/stablecoin swaps). (Transaction)
- `TRADE_NO_FEE`: Spot trade fill with no fee (maker rebate or fee-free market). (Transaction)
- `SUBACCOUNT_TRANSFER_IN`: Sub-account transfer in; the venue counterparty funds this account's balance. (Transaction)
- `SUBACCOUNT_TRANSFER_OUT`: Sub-account transfer out; this account's balance moves to the venue counterparty. (Transaction)
- `POSITION_FILL`: Derivatives fill; record it as an open-position marker (fees settle later). (Derivatives\_trade)
- `POSITION_SETTLEMENT_GAIN`: Position settlement with a net gain; credit the margin from PnL. (Transaction)
- `POSITION_SETTLEMENT_LOSS`: Position settlement with a net loss; debit the margin into PnL. (Transaction)
- `EARN_SUBSCRIBE`: Earn subscription; move principal from the balance into earn. (Earn\_transaction)
- `EARN_UNSUBSCRIBE`: Earn unsubscription; return principal from earn to the balance. (Earn\_transaction)
- `EARN_REWARD`: Earn reward or interest distribution; credit the dedicated earn reward account from the earn program. (Earn\_transaction)

### Queries and views

- `transaction-by-utx` (Transactions): Transaction(s) by the source user\_transactions id (utx\_id).
- `transactions-by-event` (Transactions): Transactions filtered by event\_type metadata.
- `transaction-lifecycle` (Transactions): The hold to done/reverted chain for one source id.
- `accounts-by-prefix` (Accounts): Accounts under a given address prefix (in-flight holds, per category).

## Config

Install a connection with fctl. The command tracks the beta channel; replace the ledger name with your own.

```bash
fctl connectivity connections install ee-bitstamp --ledger my-ledger --channel beta --poll-interval 30s --config bitstamp-config.json
```

The config file is JSON with `env` and `files` maps, keyed by each setting's name.

| Setting                   | Type           | Required | Default                           | Description                                                                                                                                                                            |
| ------------------------- | -------------- | -------- | --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `env.API_KEY`             | string, secret | Yes      |                                   | Bitstamp API key.                                                                                                                                                                      |
| `env.API_SECRET`          | string, secret | Yes      |                                   | Bitstamp API secret used as the HMAC key.                                                                                                                                              |
| `env.CONN_ID`             | string         | No       |                                   | Ledger connection identifier; when omitted, the connector resolves the account or user ID bound to the API key.                                                                        |
| `env.SUBACCOUNT_ID`       | string         | No       |                                   | Sub-account identifier sent in X-Auth-Subaccount-Id.                                                                                                                                   |
| `env.SUBACCOUNT`          | array, secret  | No       |                                   | Repeatable sub-account specifications: id=<id>\[,key=<key>,secret=<secret>]\[,earn]\[,derivatives].                                                                                    |
| `env.API_BASE_URL`        | string         | No       | `https://www.bitstamp.net/api/v2` | Bitstamp HTTP API v2 base URL.                                                                                                                                                         |
| `env.WITH_DERIVATIVES`    | boolean        | No       | `false`                           | Outside the supported scope; leave off. Opt in to derivatives trades, settlements, and margin information. Requires product access and endpoint read permissions.                      |
| `env.WITH_EARN`           | boolean        | No       | `false`                           | Opt in to Earn transactions and subscription attestations. Requires product access and endpoint read permissions.                                                                      |
| `env.STREAM`              | boolean        | No       | `false`                           | Enable the optional WebSocket live tail for order fills after the REST backfill.                                                                                                       |
| `env.MARKETS`             | array          | No       |                                   | Markets to subscribe to when streaming; when omitted, the connector discovers all markets.                                                                                             |
| `env.WS_BASE_URL`         | string         | No       | `wss://ws.bitstamp.net`           | Bitstamp WebSocket feed base URL.                                                                                                                                                      |
| `env.SCHEMA_MODE`         | string         | No       | `stored`                          | Numscript delivery: 'stored' registers the script in the ledger and references it by name; 'explicit' inlines the source in every transaction, for testing. Options: stored, explicit. |
| `env.NUMSCRIPT_VERSION`   | string         | No       |                                   | Stored Numscript version override; use latest or an explicit version.                                                                                                                  |
| `env.INITIAL_LOOKBACK`    | string         | No       | `87600h0m0s`                      | First-run backfill window (no cursor): how far back to fetch.                                                                                                                          |
| `env.LOOKBACK_MARGIN`     | string         | No       | `5m0s`                            | Safety overlap subtracted from the oldest in-flight item.                                                                                                                              |
| `env.REQUESTS_PER_SECOND` | number         | No       | `8`                               | Shared per-IP request pacing across all configured Bitstamp accounts.                                                                                                                  |
| `env.MAX_RETRIES`         | integer        | No       | `4`                               | Max retries on HTTP 429/5xx (honoring Retry-After) before failing a fetch.                                                                                                             |

## Changelog

### v0.5.0

#### 0.5.0-beta.8, published 2026-11-06

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.7, published 2026-11-03

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.6, published 2026-10-29

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.5, published 2026-10-28

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.4, published 2026-10-28

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.3, published 2026-10-26

The Bitstamp 0.5.0 connector reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal. The fee is treated as an
additional charge on top of the withdrawal amount.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

Earn is off by default. With `WITH_EARN=true`, the connector follows Bitstamp
Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

The live feed is off by default. With `STREAM=true`, the connector also listens
to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. It is
  outside the supported scope; leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

#### 0.5.0-beta.2, published 2026-10-16

Version 0.5.0 is the first release of the Bitstamp connector. It reads a
Bitstamp account, and the sub-accounts you name, into Formance Ledger: deposits,
withdrawals, trades, conversions, fees, Earn activity and the balances Bitstamp
reports. The connector only reads. It never places an order, initiates a
withdrawal or moves funds on Bitstamp.

##### How an account appears in the ledger

Each Bitstamp account you connect has two balances in the ledger. One holds fiat
currencies and stablecoins, the other holds every other digital asset, and each
carries all the assets of its kind. The connector books money that enters or
leaves the account, fees included, against a counterparty account that stands
for Bitstamp, so every movement has a named other side in the ledger.

Amounts are booked to at least eight decimal places. Bitstamp displays fiat
balances to the cent but calculates trades and fees more finely, so the ledger
keeps detail that Bitstamp's own figures leave out. The balances section below
explains how to compare the two.

##### Deposits and withdrawals

The connector holds a digital-asset deposit apart from the balance while
Bitstamp reports it pending, and moves it into the balance when Bitstamp reports
it final. If Bitstamp reverts or rejects the deposit, the connector releases the
held amount and keeps the deposit's status on the record. A deposit first seen
already final reaches the same balance. Each deposit carries its chain
transaction, network and receiving address.

Fiat bank deposits arrive already settled, and the connector credits them when
Bitstamp records them.

A withdrawal sets its funds aside when it opens and sends them out when Bitstamp
reports it finished. A canceled or failed withdrawal returns its funds to the
balance. When Bitstamp charges a fee for a withdrawal, the connector books the
fee as a separate movement next to the withdrawal.

##### Trades and fees

The connector books every settled spot trade in either direction, including
instant buys and sells and conversions between fiat currencies and stablecoins.
Each trade moves the asset sold out of the balance and the asset bought into it.
The trading fee is a separate movement in the currency Bitstamp charged it in,
which makes the cost of each fill visible. Fills without a fee are booked too.

##### Sub-accounts

Name a sub-account in the configuration and the connector reads it alongside
the main account, with its own balances in the same ledger. A transfer to or
from a sub-account is booked on the sub-account as money leaving or arriving.
Bitstamp does not show these transfers in the main account's history, so the
main account's side of a transfer is not booked. Its ledger balance differs from
the balance Bitstamp reports by the amount of those transfers.

##### Bitstamp Earn

With `WITH_EARN=true`, the connector follows Bitstamp Earn on the main account.
A subscription moves the committed assets to their own Earn position, and an
unsubscription moves them back. Rewards are booked to a separate account, so
yield can be reported apart from principal.

##### Balances and history

Each time it finishes reading the account, the connector records the balances
Bitstamp reports for each asset: available, total and reserved, plus the Earn
amounts when Earn is enabled. They sit next to the ledger's own balances for
comparison. The connector never calculates a difference or posts an adjustment.

Each recorded balance keeps the precision Bitstamp reports it at, such as
`EUR/2`, and names the ledger asset it compares with, such as `EUR/8`. Bitstamp
reports fiat balances to the cent while the ledger keeps every digit of the
trades and fees behind them, so cut the ledger balance to Bitstamp's precision
before comparing. A ledger balance of 10.94239 euros matches a reported 10.94.

The first connection reads the account back to its first transaction. That goes
further than the 30 days Bitstamp's API filters reach, and each movement is
booked once however often Bitstamp returns it.

##### Optional live trade feed

With `STREAM=true`, the connector also listens to Bitstamp's live feed and books
a filled trade sooner. It still confirms every trade against Bitstamp's settled
history, and that history decides completeness, so a missed live message never
means a missed trade. Deposits, withdrawals and balances have no live feed and
appear with a short delay.

##### Not covered

- Derivatives. The `WITH_DERIVATIVES` setting exists and is off by default. Its
  accounting has not yet been checked against Bitstamp data, so leave it off.
- Placing orders, withdrawals or transfers, closing positions, and changing
  Earn subscriptions.
- Open orders. An order appears once its fills settle. Funds held by an open
  order show only in the reserved balance Bitstamp reports.
- Sub-accounts the configuration does not name. Bitstamp offers no way to list
  them.
- Legacy staking and referral rewards, transfers that carry a fee, and activity
  types Bitstamp does not document. When the connector meets one, it pauses
  updates for that account until a later release supports it, instead of
  guessing how to book it.
- Deposit or withdrawal history beyond 200,000 records of each kind. Bitstamp's
  API stops there, and older records need an export from Bitstamp.

##### Setting up

`API_KEY` and `API_SECRET` are required. Use a read-only key, with read access
to Earn if you enable it. `API_BASE_URL` points at Bitstamp's production API by
default. `CONN_ID` names the account in the ledger and defaults to the user ID
the key belongs to.

Add each sub-account as a `SUBACCOUNT` entry in the form
`id=<id>,key=<key>,secret=<secret>`. Each sub-account needs its own API key,
because Bitstamp answers a main-account key with the main account's data.

`INITIAL_LOOKBACK` defaults to ten years and sets how far back a new connection
reads. Choose a start older than every deposit and withdrawal that is still
pending.

The accounting profile uses stored Numscript version `1.0.5`.

##### Updates

A later compatible release continues from the connector's saved progress and
changes only what it writes from then on. History already in the ledger is never
rewritten, backfilled or renamed. When a release changes the accounting profile,
the connector pauses until you confirm the change: deploy once with
`CONNECTIVITY_ALLOW_PROFILE_CHANGE=true`, wait for a successful fetch, then
remove the setting. If saved progress cannot be resumed, the connector stops
before contacting Bitstamp and says so. In that case, install a fresh connection
on a separate ledger and keep the previous one with its history.

##### Known limitations

Two booking paths have not yet been confirmed against a live Bitstamp account.
Withdrawal fees are booked on the understanding that Bitstamp charges them on
top of the withdrawn amount, and a real withdrawal still has to confirm it.
Sub-account transfers have been tested only with sample data; a transfer that
arrives with details Bitstamp has not documented pauses updates for that
account. The optional live trade feed has not yet run against a live account.
