Update get_account_balance to use sum(weight) for SATS
Replace sum(position) with sum(weight) for efficient SATS aggregation from price notation. Also return fiat amount from sum(number). This simplifies the parsing logic and provides consistent SATS totals across all BQL-based balance methods. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
048d19f90b
commit
49d18c3e73
2 changed files with 27 additions and 22 deletions
|
|
@ -309,7 +309,8 @@ async def api_get_account_balance(account_id: str) -> dict:
|
|||
return {
|
||||
"account_id": account_id,
|
||||
"balance": balance_data["sats"], # Balance in satoshis
|
||||
"positions": balance_data["positions"] # Full Beancount positions with cost basis
|
||||
"fiat": float(balance_data.get("fiat", 0)), # Fiat amount
|
||||
"fiat_currency": balance_data.get("fiat_currency", "EUR")
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue