Average balance

Calculate average balance

Calculate an average balance for an account.<br> Using this endpoint, you specify a datetime range and calculate the average balance of an account for that period. The calculation multiplies each unchanged balance by the number of days it remains constant, sums those values, and divides the total by the number of days in the selected range.<br> The begin_date_datetime and end_date_datetime values are interpreted in the account's time zone, determined in the following order: the account's division, its parent division, the program, and finally UTC when no time zone is available. Only the calendar date of each value is considered. The calculation period begins at 00:00:00 on the start date and ends at 23:59:59 on the end date in the time zone. The period cannot exceed 366 days, and the end date must have already passed in that time zone; otherwise, the request is rejected with HTTP 400. Requests for the same calendar days are treated as the same calculation, regardless of the time of day provided. If a matching calculation already exists, the request is rejected with HTTP 409, and the details field contains the idempotency key of the existing calculation, which can be used with the GET endpoint.<br> This endpoint generates the Average balance calculated event once calculation is complete.

post/v1/accounts/{accountId}/average-balance

Request

  • Base URL
    https://sandbox.pismolabs.io/savings-products
  • URL
    https://sandbox.pismolabs.io/savings-products/v1/accounts/{accountId}/average-balance
  • Auth
    HTTP bearer

Path parameters

accountIdstring required

Account ID. Accepts either the Pismo account_id or your external_account_id. Send the same ID used to generate the access token.

Headers

idempotencystring required

A unique identifier for the request. If you need to retry a request, use the same idempotency key to avoid creating duplicate resources.

Request body

begin_date_datetimestring date-time

The specified datetime when the average balance calculation begins. The datetime is displayed in the RFC 3339 format; for example: 2024-01-28T10:33:01Z.<br> The date time is converted to the account's time zone (refer to the operation description), and only the resulting calendar date is considered. The calculation starts at the beginning of that day (00:00:00). For example, 2024-01-28T02:00:00Z converts to 2024-01-27 in the America/Sao_Paulo time zone, so the calculation begins at 2024-01-27T00:00:00-03:00.

end_date_datetimestring date-time

The specified datetime when the average balance calculation ends. The datetime is displayed in the RFC 3339 format; for example: 2024-01-29T10:33:01Z.<br> The date time is interpreted in the account's time zone (see the operation description), and only the calendar date is used. The calculation ends at 23:59:59 on that date. The date must have already passed in the account's time zone. The current date and future dates are rejected with HTTP 400.

balance_types_to_calculatestring[]

Choose a balance to calculate its average balance, you can select multiple balance types to calculate their average balances simultaneously. The balance types are:<br>

  • available
  • savings
  • held_funds

Example request

{
  "begin_date_datetime": "2024-01-28T10:33:01.000Z",
  "end_date_datetime": "2024-01-30T10:33:01.000Z",
  "balance_types_to_calculate": [
    "available",
    "savings",
    "held_funds"
  ]
}

Response

Accepted

account_idnumber

Account ID.

idempotency_keystring

Idempotency key.

status'PROCESSING' | 'COMPLETE'

Status of the average balance calculation request.

messagestring

Message.

Example response

{
  "account_id": 123456,
  "idempotency_key": "123e4567-e89b-12d3-a456-xyz",
  "message": "Request is under progress"
}

Changes

No recorded changes to this operation across all 1 revision of this API.