Skip to content

Latest commit

 

History

History
63 lines (45 loc) · 1.4 KB

File metadata and controls

63 lines (45 loc) · 1.4 KB

Account Balances

Track point-in-time balance snapshots for accounts.

Create a Balance Record

from decimal import Decimal
from datetime import date
from finwise import FinWise

client = FinWise(api_key="your-api-key")

balance = client.account_balances.create(
    account_id="acc_123",
    balance=Decimal("5000.00"),
    balance_date=date(2024, 1, 15),
)

!!! tip "When to Use Balance Records" Balance records are useful for:

- Tracking account balances over time
- Reconciling with bank statements
- Building net worth history

List Balance Records

balances = client.account_balances.list(account_id="acc_123")

for balance in balances:
    print(f"{balance.balance_date}: {balance.balance}")

Get Aggregated Balance

Get the total balance across all accounts for a specific currency:

summary = client.account_balances.aggregated(currency="USD")
print(f"Total: {summary.currency} {summary.total_balance}")
print(f"Across {summary.account_count} accounts")

You can also get the balance as of a specific date:

summary = client.account_balances.aggregated(
    currency="USD",
    as_of_date=date(2024, 1, 31)
)

!!! note "Currency Parameter" The currency parameter specifies which currency to aggregate balances for (e.g., "USD", "EUR", "ZAR").

Archive a Balance Record

client.account_balances.archive("bal_123")