getAccountLedger method
Get a single account's ledger
Lists ledger activity for an account. This includes anything that would affect the accounts balance - transfers, trades, fees, etc.
https://docs.cloud.coinbase.com/exchange/reference/exchangerestapi_getaccountledger
Implementation
Future<Paginator<LedgerEntry, DateTime>> getAccountLedger({
required String accountId,
DateTime? startDate,
DateTime? endDate,
DateTime? before,
DateTime? after,
int? limit,
}) async {
var response = await _accountsRestClient.getAccountLedger(
accountId: accountId,
startDate: startDate,
endDate: endDate,
before: before,
after: after,
limit: limit,
);
if (response.statusCode != 200) throw response;
return Paginator(
before: response.headers.containsKey('cb-before')
? DateTime.parse(response.headers['cb-before']!)
: null,
after: response.headers.containsKey('cb-after')
? DateTime.parse(response.headers['cb-after']!)
: null,
elements: listDecode(response.body)
.map((hold) => LedgerEntry.fromJson(hold))
.toList(),
);
}