scallop-portfolio-analyticslisted
Install: claude install-skill scallop-io/scallop-skills
# Portfolio Analytics
Aggregate every Scallop position a user holds — supplied assets, all obligations (with debts + collaterals + USD values), spool stakes, veSCA — into a single view. Plus protocol-level TVL.
## Overview
`ScallopQuery` exposes three composite read methods that fan out across all of a user's positions, plus a protocol-wide TVL view. The assembly logic lives in `buildUserPortfolio` in [src/services/query/portfolioCalculations.ts](../../../sui-scallop-sdk/src/services/query/portfolioCalculations.ts); the I/O entry points are on [src/models/scallopQuery/index.ts](../../../sui-scallop-sdk/src/models/scallopQuery/index.ts) — call them on the `query` instance, not via internal subpaths.
| `ScallopQuery` method | Returns |
|-----------------------|---------|
| `getUserPortfolio({ walletAddress?, indexer? })` | Lendings + obligation accounts (as `borrowings`) + pending rewards + veSCAs, all priced |
| `getLendings(poolCoinNames?, ownerAddress?, args?)` | Just the supplied positions (cheaper) |
| `getTvl({ indexer? })` | Protocol-wide TVL (`supplyValue`, `borrowValue`, `totalValue`, plus the lending/collateral split) |
The Python SDK (`sui-scallop-sdk` >= 0.3.0a1) wraps the same views: `query.get_user_portfolio(address)`, `query.get_lendings(address)`, `query.get_tvl()` — the examples below are TypeScript, but you are not locked to it. All TS shapes on this page were verified against `@scallop-io/sui-scallop-sdk` v4.3.0.
## Full User Portfolio
```typescript
im