From dece6999f01a0c8b35296b73d0896c3c3eb6d7cd Mon Sep 17 00:00:00 2001 From: Brandon Li Date: Thu, 3 Sep 2026 13:13:32 -0500 Subject: [PATCH] Quick resolve account types --- lib/account-type-resolver.ts | 18 ++++++++++++++++++ lib/clients.ts | Bin 7672 -> 7732 bytes 2 files changed, 18 insertions(+) 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 8804fc9f406fef03eb262caaaed52402c297e4e3..ec7864aa169ad771f963d6e03e9cca7ce8cf3858 100644 GIT binary patch delta 150 zcmYj}F$%&!6hyI!U}s~KW_rOKAeLTa{QE-!>#qD=qgEaw7ZFV5o$M`DNa1u3-kWzl zZtu_HCJdlArMtp3Mc*qLdg)O7JGUI(Hc`3gC?BW dWi-)#I+7k~%=-UjI=qVYY%`S0^0Awbs}IqBGDiRa delta 76 zcmdmD^TT?>E;g0Y;?l&NoJxhF)Z+Y{veaUQy!?`k%)E3Rg{0Kv#M0tag_4ZPTI^Or g3Pq)P#R|o#1&Kw8C8;@;dR&wBgrzn&ux}9q0DS5k4FCWD