s↗sanforex.
CSV DATA QUALITY

Duplicate source IDs in a CSV: retain rejection counts

Understand why duplicate source IDs are rejected together and how to reconcile totals from accepted rows.

Why all matching IDs are rejected

A declared mapping counts valid source IDs before validating rows. If the same valid ID occurs more than once, each correctly shaped row with that ID is rejected as DUPLICATE_ID; the mapper does not choose a winner. This avoids silently deciding which repeated record represents the source data. Field-count errors are checked first, and invalid IDs are rejected before duplicate handling, so those errors can take precedence.

Reconcile the accepted-only totals

Compare input rows with accepted and rejected row counts, then reconcile the reported totals using accepted rows only. For a gross-before-costs mapping, accepted source amount equals accepted gross and accepted net equals gross minus costs. For a net-after-costs mapping, accepted source amount equals net and gross is reconstructed by adding costs. All totals use integer USD cents. Rejected rows do not contribute to totals or the normalized export; accepted-only totals do not prove the original file is complete.

An invented duplicate-ID reconciliation

Three invented closed USD rows have IDs DUP, DUP and UNIQUE. Both DUP rows are rejected; no winner is selected. The UNIQUE row has gross USD 100.00 and costs USD 2.50, so accepted net is USD 97.50: 10000 - 250 = 9750 integer cents. Record 3 input = 1 accepted + 2 rejected. Accepted-only totals do not prove that the original file is complete.

In three invented rows, both occurrences of ID DUP are rejected and ID UNIQUE is accepted; 3 input rows equal 1 accepted plus 2 rejected, with accepted net $97.50.

In three invented rows, both occurrences of ID DUP are rejected and ID UNIQUE is accepted; 3 input rows equal 1 accepted plus 2 rejected, with accepted net $97.50.

Open full-size diagram ↗
No first-row or last-row winner is chosen for duplicate source IDs.

Check what the fixed checker accepts

The fixed checker expects exactly date,pair,gross,costs,notes in that order, with real YYYY-MM-DD dates, uppercase AAA/BBB pairs, nonnegative costs, and amounts already in USD. Rows must already be closed and aggregated. Confirm the currency yourself: the checker cannot infer currency from numeric amounts. It does no currency conversion or fill matching.

A declared mapping is a separate workflow

A declared custom mapping specifies the source columns, date order, pair format, whether amount is gross or net, fee sign, and closed status. The mapping behavior is USD-only and supports already closed and aggregated rows; it does not convert currency or match fills. A separately declared mapping is distinct from the fixed checker format. Asking about a format does not promise that a custom mapping is available, establish an order, or set pricing.

Next steps

For the fixed format, open the CSV journal checker. For a different layout, download the CSV format request checklist, then use the contact link to describe column names and desired output with invented examples only. Do not send trading files, records, identifiers, or credentials.

Sources and conventions

Examples are hypothetical. Arithmetic follows the formulas documented in our methodology. Broker contract specifications determine actual lot, margin and execution conditions. These sources document definitions and data; a source link does not imply endorsement of SanForex or a trading service.

These materials are prepared with AI assistance and checked against worked examples and deterministic calculation tests where applicable. They are not an expert suitability assessment or investment advice.

Open trade csv checker tool ↗