Broker position, custody, inflows and commission
Deduplication, complete day, advisor in effect on the date
AUC, net inflows and revenue by advisor
Dashboard, advisor's daily list and AI agent
What it solves
- Each advisor's assets and inflows match the broker's report, with no partial days or duplicate rows.
- Inflows and revenue stay with the advisor who served the account on that date, even after a book transfer.
- Advisors get a daily to-do list: maturities, negative balances, new sign-ups.
Business questions it answers
Ask your agent these questions once the case is live.
What you need
- The broker connector (BTG Parceiros or XP) or the report files connected to Nekt
- The client base with advisor, origin and the history of book transfers
- The commission spreadsheets for sources that do not come through the API
What you get
- Custody, inflow and revenue tables by account and day, with the advisor as of that date
- A dashboard by advisor and office with AUC, net inflows and revenue
- Daily lists per advisor on WhatsApp or by email
- An AI agent that answers questions about portfolio and inflows with the right rules
Where to activate
AUC, net inflows and revenue by advisor and office, with the reference day and the source of each number in view.
On WhatsApp or by email: securities maturing in 2 days, negative balances, idle balances, sign-ups from the last 7 days and clients without Open Finance.
Answers about portfolio, inflows and revenue by advisor with the effective-date rule and the complete-day rule already applied.
The connectors bring the data ready to use. The work is in deduplication, guarding against partial reports and the advisor history. The detailed view has the business rules, the pitfalls and the acceptance test. Or send everything straight to your agent with the Nekt MCP.
Each broker delivers the portfolio in pieces: position by market, custody by product, inflow transactions, commission by category, a monthly positivador (account activity report). Account and advisor records are versioned and the keys change with every version, the daily report sometimes arrives with only a few rows and the account balance is overwritten at every load. Summing directly attributes old inflows to today's advisor, shows assets collapsing on a partial day and loses the balance history.
How it is usually done, and the rule
Each row is a mistake that already happened in practice.
Inflows, custody and revenue stay with the advisor who served the account on the transaction or position date. Join against the client base history where effective start <= event date and (effective end is null or > event date). Today's advisor only applies to today's snapshot.
In XP's versioned records (account, advisor, office, product), dimAccountCode, dimAdvisorCode and dimOfficeChannelCode change with every version. The custody fact already points to the version in effect on the position date: join by that key and never filter by 'current today'. For identity over time, use accountCode, advisorCode and officeCode.
Custody: one row per account, day and product, the one with the latest lastupdate. Inflows: one per account, day, transaction code, amount and quantity. Position by partner: one per account and day. Positivador: first sum the complementary rows that share the same lastupdate (flow metrics), then deduplicate reprocessing runs and remove weekends.
The latest report may bring the current day half complete. Within the latest report, choose the most recent reference date whose row volume is at least 50% of the largest volume in that report. The partial day is discarded and the last good day stays.
Weekends and holidays without positions are expected. A trading day with no custody rows for any account is a source failure: flag it, do not fill it with zero and do not let the dashboard show zero assets.
Investment account and digital account balances come as full loads with no date partition: each load erases the previous one. On every run, append the snapshot to a history table stamped with the processing date. The reference date is the run date in America/Sao_Paulo minus one day when the extraction runs right after midnight.
When the source changes (old base up to a date, API from then on), combine the two with a source column and a cutoff date that does not overlap. Convert legacy dates and numbers ('dd/mm/yyyy', '1.234,56') before the union. Fields that exist in only one source stay null in the other.
Daily revenue per account = first filled value among net revenue, revenue and commission, or zero. Commissions that arrive in separate files (by product, FX, credit, international markets) are projected into a common schema: client, advisor, gross revenue, net revenue, commission, product and source currency. Dollar revenue is converted to reais at the closing PTAX (official BRL/USD rate). The accrual month comes from the file name (YYYYMM_source) when there is no column.
When advisors check and correct commissions for closed years, the corrected spreadsheet replaces the original report for that period. The broker's report applies from the cutoff onward. Write with a hash key so reprocessing does not duplicate.
Compare and group advisors in uppercase, without accents and with no leading or trailing spaces. Null, empty and '-' values are accounts without an advisor and appear as such in the dashboard, never disappearing.
Where each number comes from
Typical BTG and XP sources. Each one deduplicated by its own key.
Definitions
Pitfalls that already happened
The broker sent the current day with only a few rows, against thousands on a normal day. The MAX of the date picked that day and the dashboard showed the fixed income portfolio near zero.
Use the most recent date with at least 50% of the largest volume.
The table relating accounts to advisors covered only one office, and about a third of custody ended up without an advisor in the join.
Take the advisor from the advisor record as of the position date and use the relationship only as a check.
Some accounts and advisors had no version flagged as current in the broker's records, even with a validity date covering today. A 'current today' filter made those accounts disappear.
Join by the dated key and, with no current version, use the one with the latest validity start, flagged.
From a certain report date on, the date of birth started arriving with day and month swapped whenever the day was 12 or less, and the birthday list came out wrong.
Correct by report date and validate against a known sample.
A small fraction of positions came negative and another part came at zero. Filtering all of them as errors removed short positions and legitimate history.
Keep and flag them; exclude only with a written business rule.
The daily list was generated in one table per advisor, with the name hardcoded. A new advisor had no list until someone edited the notebook.
A single table partitioned by advisor, with the recipient coming from the base.
Acceptance test
The case is done when every item passes.
- The cleaned custody table has the same number of distinct rows per account, day and product as the source: the joins neither lose nor duplicate rows.
- For a complete day, total AUC by account matches the broker's report (difference below 0.5%).
- Every inflow row has the advisor as of its date or appears as an account without an advisor; none uses the current advisor for a past date.
- Every business day without custody is flagged as a load failure, and no partial day becomes the latest snapshot.
- Monthly revenue by advisor equals the sum of the commission sources for that accrual month, already converted to reais.
Agent package
Paste into Claude, ChatGPT or any client with the Nekt MCP connected.
AUM, net inflows and revenue by advisor - Broker: <BTG/XP>. Custody in <table>, inflows in <table>, commission in <table>, positivador (monthly account activity report) in <table>. - Deduplication: custody by account, day and product (latest lastupdate); inflows by account, day, transaction, amount and quantity; position by account and day. - Daily snapshot: within the latest report, the most recent date with volume >= 50% of the largest volume. A business day without data is a load failure, never zero assets. - Advisor: the one in effect on the event date, from the client history (start <= date and end null or > date). Never today's advisor for a past date. - XP records are versioned: join by the dated surrogate key; identity by accountCode, advisorCode and officeCode. - Daily revenue = net revenue, else revenue, else commission, else zero. Dollars converted at the closing PTAX (official BRL/USD rate). - Up to <cutoff date>, commission comes from the spreadsheet corrected by the advisors; after that, from the report. - Account balance comes from snapshots accumulated by processing date, in the America/Sao_Paulo time zone. - Advisor in uppercase and without accents. Null, empty or '-' = no advisor. - Never show a full CPF (individual tax ID) or contact details outside the advisor's own list. Per-client exceptions: - <client>: legacy data up to <date> in base <table>, API from <date>; the source column shows the origin. - <client>: desk <desk> has a fixed list of accounts in <table>. - <client>: date of birth with day and month swapped from <date>; correct it when the day is 12 or less.
Build the "AUM and net inflows by advisor" case in my Nekt workspace following the rules at https://academy.nekt.com/en/industrias/financeiros/patrimonio-captacao-assessor.md. 1) Find the source tables and confirm the columns the rules use. 2) Create a transformation at the stated grain applying every rule. 3) Run the acceptance test and show me the result of each item. 4) Create the case's context document in the workspace, leaving my clients' exceptions open for me to fill in.
Variations
Insurance brokers: pass-through percentage by line of business on each policy's commission, by franchisee, matching production by CNPJ (company tax ID) and policy.
Investments entered by hand and via Open Finance, deduplicated by external ids and checked against the institution's aggregate balance.
A cut of the last day's custody by class (real estate funds, fixed income, equities, pension plans), with product, account and advisor.