Files
3603f34989 feat(bitstamp): add Bitstamp Enterprise connector (#679)
* feat(bitstamp): add Bitstamp Enterprise connector

Add a new Enterprise Edition PSP connector for Bitstamp exchange,
mirroring the Coinbase Prime connector pattern with Bitstamp-specific
adaptations for HMAC-SHA256 auth (hex signature, UUID nonce, ms timestamp),
offset-based pagination, and dynamic JSON key parsing.

Capabilities: FETCH_ACCOUNTS, FETCH_BALANCES, FETCH_PAYMENTS
API: Bitstamp REST v2 with form-urlencoded POST endpoints
Auth: HMAC-SHA256 with X-Auth headers

Key implementation details:
- Deterministic asset selection for multi-currency trades (largest absolute value)
- Positive-match currency key extraction against loaded currencies map
- Offset pagination with len(transactions) increment to avoid skipping records
- Named constants for Bitstamp transaction type codes
- Fixed epoch CreatedAt (Bitstamp launch date) for accounts
- Lazy-load currency precision from /api/v2/currencies/ with mutex safety net

* feat(bitstamp): add configurable base URL for UAT/staging environments

Allow overriding the Bitstamp API base URL via the `baseUrl` config
field. When not set, defaults to https://www.bitstamp.net (production).
This enables testing against UAT or sandbox environments.

* refactor(bitstamp): simplify code from review findings

- Fix data race in ensureCurrencies: use atomic.Bool for fast path
  instead of unsafe map length check outside mutex
- Fix double otelhttp.NewTransport wrapping: httpwrapper.NewClient
  already adds the OTel layer, remove redundant wrapping in client
- Fix signRequest: use req.URL fields directly instead of re-parsing
  with url.Parse (which swallowed errors)
- Extract normalizeCurrency() and isZeroAmount() shared helpers to
  eliminate 6x duplicated strings.ToUpper(strings.TrimSpace()) and
  fragile hardcoded zero-string comparisons
- Merge resolveAssetAndPrecision + extractAmount into single-pass
  resolveAssetAndAmount, eliminating redundant map iteration

* fix(bitstamp): address PR review feedback

* fix: dirty

* Remove orderID and market and metadata in account

* Fix test

---------

Co-authored-by: Claude <[email protected]>
2026-05-08 09:25:28 +00:00

2.6 KiB
Raw Permalink Blame History

V3BitstampConfig

Fields

Field Type Required Description
APIKey string ✔️ N/A
APISecret string ✔️ N/A
Endpoint *string ➖ N/A
Name string ✔️ N/A
PageSize *int64 ➖ : warning: ** DEPRECATED **: From v3.1, this parameter will be ignored.
PollingPeriod *string ➖ N/A
Provider *string ➖ N/A