# Changelog

All notable changes to this package are documented in this file.

## 0.8.7 - 2026-05-28

### Added
- remove redis fields from response (eg latest_orders)

### Fixed
- Margin account `withdrawable_collateral` and the transfer-in/out responses' `new_withdrawable_collateral` now return the amount that can actually be moved back to spot — `MIN(free_collateral, wallet.margin_locked)` — instead of `available_margin` alone.

Previously the field could overstate withdrawability when an account had realized PnL gains or lower live free collateral: equity-based `available_margin` includes PnL but the BE only releases up to what was originally transferred in and what live risk allows. Using the field as the Max amount for `POST /accounts/{id}/collateral/transfer-out` could fail with "Insufficient wallet margin-locked collateral".

Also fixes a regression where `transfer-out` rejected all amounts with "Insufficient margin-locked collateral for this margin account asset" for users whose pre-existing `wallet.margin_locked` had no corresponding `margin_account_transfer_in` ledger entries. The ledger-based check has been removed; the wallet UPDATE's `margin_locked >= amount` guard remains the safety gate (matching the gRPC path's existing behavior).

Affects: `GET /accounts`, `GET /accounts/{id}`, `POST /accounts/{id}/collateral/transfer-in`, `POST /accounts/{id}/collateral/transfer-out`.

- Position margin reduction now resolves the collateral asset from the margin bucket/default collateral asset instead of historical transfer ledger rows, so accounts funded before margin transfer ledger entries existed can reduce isolated margin when wallet margin-locked collateral is available.

## 0.8.5 - 2026-05-25

### Added
- Add GET /api/v1/applications/stats endpoint exposing volume and fee aggregates for the authenticated application. Backend-auth only (Authorization: Bearer sk_...).

Query params:
- since (optional): ISO 8601 datetime to filter from. Omit for all-time.

Response: { volume, maker_fee, taker_fee, application_taker_fee, trade_count } — stats scoped to trades where the application's users were the taker.

## 0.8.4 - 2026-05-20

### Fixed
- Updated SDK to match 0.8.4 API changes

## 0.8.1 - 2026-05-12

### Fixed
- Retrigger release pipeline after 0.8.0 publish failure

## 0.8.0 - 2026-05-12

### Changed
- sdk update

## 0.7.8 - 2026-05-06

### Changed
- Synchronized repository metadata with the already-published 0.7.8 SDK release.
