Separate order instructions from executions, then group executions by the intended trade or position episode. Keep exchange, account, contract, side, order identifier, execution identifier, time, quantity and price. One order may have several executions. Bybit's official history documentation exposes those separate identifiers and fields.
Do not deduplicate solely by timestamp: different executions can share a time. Do not add an order's cumulative quantity to its individual executions as if they were different fills. Check ending position quantity against entries minus exits, with direction and account mode handled consistently. Partial fills covers exposure while execution is incomplete.