Skip to content

Fidelity

Fidelity is a self-hosted file-based integration that imports investment accounts and holdings from Fidelity’s custodian platform into RightCapital. Fidelity pushes daily fixed-width text files (compressed as .DAT.ZIP) to RightCapital’s SFTP server.

AttributeValue
Integration TypeFile-based (Self-hosted)
File FormatFixed-width text (NAM, POS, TAX), delivered as .DAT.ZIP
Data FlowFidelity SFTP Push → RightCapital
Data SyncDaily batch sync
OwnerQianwei Hao
IntegrationTypeIntegrationType::FIDELITY
Default Account TypeINVESTMENT
Fidelity FTP Server
↓ (SFTP Push, *.DAT.ZIP)
ftp.rightcapital.com (vendor inbound)
Collector (Download → Process → Upload to S3)
Finalizer (group by ria_id / rep_code)
Retail-API Sync (Reader → Extractor → Mapper → DB)

Fidelity sends configurable file streams (typically 3 core, plus optional ones):

FileType EnumFilename PatternPurposeFrequency
NAM*NABASE*Account names, types, owner first/last nameDaily
POS*POSITD*Positions: CUSIP, quantity, price, market valueDaily
TAX*_TLAOPENDELTA_*Cost basis delta (aggregated per CUSIP)Daily
(n/a)*_ACCTBALD_*Account balance summaryDaily (not actively used by Reader)
(n/a)*_TLAOPENFULL_*Full tax lots (complete snapshot)Weekly (not actively used by Reader)

File naming pattern: ###_*_FILENAME_DATE.DAT, where ### = firm ID (570), DATE = CCYYMMDD.

Each file uses single-character prefixes to mark line types:

PrefixMeaning
HFile header (e.g., transmission date for POS at offset 62, format MMDDYYYY)
DDetail data row
CHClient header — contains client_id at offset 3 (length 20)
CTClient tailer — must match the preceding CH client_id

The Reader streams header (H) lines and only D lines belonging to the target client (matched between CH/CT boundaries).

IdentifierDescriptionSource
IBD Code570 (Fidelity’s broker code)Hard-coded prefix
client_idFidelity client identifier inside fileRead from CH line
account_referenceBRANCH(3) + ACCOUNT_NUMBER(6) (e.g., X46629715)NAM file, offset 8, length 9

integrations.reference is stored as:

570:{client_id}

See TriggerSyncController.php:145 for the routing logic.

The 570:{client_id} reference is converted to 570/{client_id} for S3 directory lookup:

// IntegrationType.php:306
FIDELITY => Str::replace(':', '/', $integration_reference)

See IntegrationType.php:306.

The admin-api validates Fidelity reference format with regex /^\w+:\w+$/:

See ValidateFidelityReference.php.

If the format is invalid, the error message is: “Firm ID and Client ID are required.”

The frontend fidelity.component.tsx presents this step-by-step process to advisors:

  1. Email Fidelity technical support — request Fidelity Integration Xchange enrollment
  2. Register — complete the Integration Xchange registration process
  3. Submit client header — provide the client_id that identifies their accounts in the files
  4. Wait 3-5 business days — for setup to take effect
Record #OffsetLengthField
1014010Short name (first byte & → account closed)
101712Account type code
102 (B at offset 190)19250Business / trust name
102 (else)19212First name
102 (else)21425Last name

Closed account filter: any account whose short name starts with & is excluded from sync.

Account number masking: stored as BRANCH(3) + XXX + LAST(3), e.g., X46XXX715.

OffsetLengthField
69account_reference
189CUSIP
282Security type + modifier
499Symbol
589.9 (signed)Market price
10413.5 (signed)Settlement-date quantity
334–4536 × 20Security description lines 1–6 (concatenated)
56815.2 (signed)Position market value
86815ISIN

Numeric fields use trailing-sign convention: integer + fraction + +/- sign character.

OffsetLengthField
29account_reference
129CUSIP
20915.2 (signed)Cost basis amount (summed per CUSIP)
Fidelity CodeRC Account Subtype
00taxable
01taxable
02taxable
03taxable
04taxable
05taxable
06taxable
07traditional_ira
08roth_ira
09sep_ira
10simple_ira
11taxable
12rollover_ira
13inherited_ira
14inherited_roth_ira
15designated_roth_401k
16401k
17trust
18403b
19profit_sharing
20money_purchase
21401k
22401k
23defined_benefit
24employee_stock_ownership
25457
26non_qualified_deferred_comp
27trust
28custodian
29trust
30529
31taxable
32taxable
33traditional_ira
34sep_ira
35simple_ira
36401k
37trust
38roth_ira
39inherited_ira
40inherited_roth_ira
4180taxable (various trust/corp subtypes)
Vendor CodeSecurity Type
00equity
01equity
10fixed_income
20fund
21fund
50fund
51fund
52fund
60fund
61fund
70fund
71fund
72fund
90cd
93fund
94fund
9Tfixed_income
C0fixed_income
FFfund
FRfund
FSfund
FTfund

backend/packages/libs/integrations-file-based/src/Fidelity/

ComponentFile
IntegratorIntegrator.php
ReaderReader.php (CH/CT client filtering)
ExtractorExtractor.php (offset-based field extraction)
ConfigConfig.php (default INVESTMENT account type)
SyncSync.php
FileType enumFileType.php (NAM/POS/TAX)
ModelsModels/InvestmentAccount.php, Models/Holding.php

integrations/collector/app/

ComponentFile
VendorVendors/FidelityVendor.php (orchestrates collect/finalize/run)
DownloaderDownloaders/FidelityDownloader.php (filters *.DAT.ZIP)
ProcessorProcessors/FidelityProcessor.php
UploaderUploaders/FidelityUploader.php
FinalizerFinalizers/FidelityFinalizer.php
CommandLocation
php artisan fidelity:collect [--as_of=]collector/app/Console/Commands/Fidelity/Collect.php
php artisan fidelity:finalizecollector/app/Console/Commands/Fidelity/Finalize.php
php artisan fidelity:runcollector/app/Console/Commands/Fidelity/Run.php
php artisan integrations:fidelity:syncretail-api/app/Console/Commands/Integrations/Fidelity/Sync.php

The Reader throws if a CH client header is encountered before its matching CT tailer, or if the file ends with an unclosed header. This usually indicates a truncated upload — re-pull from the source.

The first H line in a POS file is required (offset 62, format MMDDYYYY). If a D row appears before any H, extraction throws “POS file has wrong format”.

Note: Fidelity’s documentation incorrectly states the date format is MMDDYY. Actual format is MMDDYYYY.

Accounts where the NAM short name starts with & are filtered out. If an advisor expects an account but it’s missing, check the raw NAM file for the & prefix.

Both POS and TAX may have multiple rows per (account_reference, CUSIP). The Extractor sums quantity, market value (POS), and cost basis (TAX). If totals look off, inspect the raw file for duplicate CUSIPs.

If a NAM data value starts with “T” (e.g. a first/last name like “TAYLOR”), the parser mistakes it for the Trailer record and stops mid-file, blocking all subsequent advisor sections. This is a Fidelity producer-side formatting bug. The corrective action is requesting Fidelity reissue the file with “T” only in the final trailer at EOF.

NABASE files can reach 4 GB+ decompressed. Always use funzip for streaming (sandbox /tmp is only ~10 GB). Never decompress fully to disk.

When an advisor reports a missing account:

  1. rg (global search) the raw file for the account number
  2. Find the nearest ^CH line above it — that determines which client_id header it belongs to
  3. If under a subscribed header but not parsed → RC bug (escalate to engineering)
  4. If under an unsubscribed/wrong advisor header → vendor header misassignment (Fidelity assigned the wrong client_id)
  5. If not found in any header → vendor data missing (Fidelity didn’t include it)
PurposeEmail
Technical supportnftransmissioninstalls@fmr.com
Integration supportintegrationsupport@fmr.com
Transmission platformtransmissionplatform@fmr.com
Business inquiriesavdf@fmr.com