diff --git a/lib/account-type-resolver.ts b/lib/account-type-resolver.ts index 2f21f44..734130a 100644 --- a/lib/account-type-resolver.ts +++ b/lib/account-type-resolver.ts @@ -163,6 +163,24 @@ export function resolveFirmAssignments( break; } } + + // Fallback while the throttled report fetch hasn't produced fund + // transactions yet: an account that has never traded still sits at + // exactly its opening balance, and balances arrive with the first + // sync. Only a cent-exact match counts — a traded account's balance + // won't equal any type size, so it falls through and waits for the + // reports as before. The matched size is persisted below, so the + // assignment survives once the balance starts moving. + if (!matched.type) { + const balance = client.accountCashBalances[account.id]?.amount; + if (typeof balance === 'number') { + const attempt = matchAccountType(account.name, balance, types); + if (attempt.type) { + matched = attempt; + matchedSize = balance; + } + } + } } if (matched.type) { diff --git a/lib/clients.ts b/lib/clients.ts index 8804fc9..ec7864a 100644 Binary files a/lib/clients.ts and b/lib/clients.ts differ