Skip to content

Cancellations and Corrections

This page explains how to apply cancellations and corrections data.

Cancellations and corrections data is stored in a date partitioned table. Each transaction data table can have its own corresponding table to store its cancellations and corrections data. This is configured in .api.cfg.cancorSettings, in the api.cancor.config.q file.

  • The columns used to match CanCor data to any type of transaction data are defined in .api.cfg.cancorSettings, in the api.cancor.config.q file. For example:

    table canCorTable columnsToMatchCancelsTo columnsToMatchCorrectionsTo columnsToCorrectWith
    Trade CanCor `eventTimestamp`instrumentID`price`volume `eventTimestamp`instrumentID`price`volume `newPrice`newVolume
  • The match columns in the example above are `eventTimestamp, `instrumentID, `price, and `volume. You can change them to suit your needs. Columns are matched on their exact name.

  • To match cancels, we find the rows with equal match column values using the ? (search) function, and remove those rows from the aggregated results from the Data Access Processes (DAPs).

  • To match corrections, in addition to the match columns, you set the columns to correct in .api.cfg.cancorSettings. We then left join the CanCor data to the main transaction data using the match columns, and overwrite the columns to correct. If `newPrice and/or `newVolume are used to correct, they overwrite price and/or volume, respectively. The same convention applies to any column whose name begins with new: it overwrites the column with the same name without the new prefix.

  • The canCorTable in the example above is CanCor. You can configure any other table as the canCorTable for a queried table in .api.cfg.cancorSettings. A canCorTable must have all the columns listed in .api.cfg.cancorSettings to match and correct with.

Note

Any table configured as a canCorTable in .api.cfg.cancorSettings must have either a canCorType or tick_status column to identify a cancellation or correction. If the column used is canCorType, it must be a symbol column with the values Cancellation and Correction. If the column used is tick_status, its values are mapped to a cancellation or correction according to .api.cfg.cancorMap, which you can adjust in the api.cancor.config.q file. The default value is:

.api.cfg.cancorMap:(10i;11i)!(`cancel`correction)
  • In .fsi.getTicks, the CanCor data is selected in the DAPs alongside the main transaction data being queried (the table argument to getTicks), and applied to that data only in the aggregator. The CanCor data is subject to the same startTS and endTS restrictions as the main transaction data, expanded backwards by a configurable number of days, .api.cfg.cancorLookupBackscanPeriod. This defaults to 7 days. You can change it by setting the FSI_CANCOR_LOOKUP_PERIOD environment variable, or by setting .api.cfg.cancorLookupBackscanPeriod directly in the api.cancor.config.q file. The DAPs select the CanCor data by calling .api.cancor.getCancor inside getTicks, and temporarily store it in the args parameter.

  • In the aggregator, the CanCor data is extracted from the args parameter by calling .api.join.extractRefTabs inside .api.join.apis. It is then applied to the main transaction data by calling .api.join.applyCanCor inside .api.join.apis.

  • The aggregator then drops the CanCor data, along with all values in the args parameter, because only the transaction data is returned from .api.join.apis. To query CanCor data directly, call either getTicks or getData in the gateway with table set to `CanCor.

Example: applying cancellations and corrections in getTicks

The getTicks and getStats APIs can apply cancellation and correction data to an original transaction data table when you pass in the boolean parameter `applyCanCor. For example:

args: (!) . flip (
    (`table;            `bloomberg_trd                  );
    (`startTS;          2026.09.16D09:00:00.000000000   );
    (`endTS;            2026.09.16D21:00:00.000000000   );
    (`idList;           `AMD                            );
    (`applyCanCor;      1b                              )
 );

last gw(`getTicks;args;`callback;()!())

where gw is a handle to the service gateway.

To illustrate how the cancellations and corrections data is applied, consider these raw data subselections from the bloomberg_trd and bloomberg_trd_corrections tables.

bloomberg_trd

time sym price size volume trade_id orig_trade_id tick_status
2026-09-16D10:00:00.000000000 AMD 710.1 5500 8250679 m:N-t:3485 m:N-t:3485 0
2026-09-16D10:05:00.000000000 AMD 710.5 22000 8250685 m:N-t:3012 m:N-t:3012 0
2026-09-16D10:10:00.000000000 AMD 711.25 67000 8526495 m:N-t:3665 m:N-t:3665 0
2026-09-16D10:15:00.000000000 AMD 713.25 5000 8526535 m:N-t:4010 m:N-t:4010 0
2026-09-16D10:20:00.000000000 AMD 711.05 5230 8607869 m:N-t:3706 m:N-t:3706 0
2026-09-16D10:30:00.000000000 AMD 714.88 66000 9029444 m:N-t:4001 m:N-t:4001 0
2026-09-16D10:35:00.000000000 AMD 704.72 10000 34733898 m:Q-t:348778 m:Q-t:348778 0
2026-09-16D10:40:00.000000000 AMD 710.43 65500 9029776 m:N-t:4019 m:N-t:4019 0
2026-09-16D10:45:00.000000000 AMD 704.72 10000 34736425 m:Q-t:348779 m:Q-t:348779 0

bloomberg_trd_corrections

time sym price size volume trade_id orig_trade_id tick_status
2026-09-16D15:28:32.080689000 AMD 711.12 5000 8250679 m:N-t:4020 m:N-t:3485 11
2026-09-16D15:40:31.162825000 AMD 710.63 66000 9526495 m:N-t:4022 m:N-t:3665 11
2026-09-16D20:15:11.026393000 AMD 704.72 1 34733898 m:Q-t:348778 m:Q-t:348778 10
2026-09-16D20:15:27.657328000 AMD 704.72 1 34736425 m:Q-t:348779 m:Q-t:348779 10

For this example, the tables are configured in .api.cfg.cancorSettings to match on sym and orig_trade_id:

table canCorTable columnsToMatchCancelsTo columnsToMatchCorrectionsTo columnsToCorrectWith
bloomberg_trd bloomberg_trd_corrections `sym`orig_trade_id `sym`orig_trade_id `price`size`trade_id

The default mapping of tick_status to canCorType in .api.cfg.cancorMap is being used. A tick_status of 11i is a correction, a tick_status of 10i is a cancellation.

There are two corrections. getTicks overwrites the price, size and trade_id of the raw bloomberg_trd data with the price, size and trade_id values in the bloomberg_trd_corrections data, and returns the amended data to the caller. There are two cancellations. getTicks removes the matching rows before returning the amended data to the caller.

The returned result is:

time sym price size volume trade_id orig_trade_id tick_status
2026-09-16D10:00:00.000000000 AMD 711.12 5000 8250679 m:N-t:4020 m:N-t:3485 0
2026-09-16D10:05:00.000000000 AMD 710.5 22000 8250685 m:N-t:3012 m:N-t:3012 0
2026-09-16D10:10:00.000000000 AMD 710.63 66000 8526495 m:N-t:4022 m:N-t:3665 0
2026-09-16D10:15:00.000000000 AMD 713.25 5000 8526535 m:N-t:4010 m:N-t:4010 0
2026-09-16D10:20:00.000000000 AMD 711.05 5230 8607869 m:N-t:3706 m:N-t:3706 0
2026-09-16D10:30:00.000000000 AMD 714.88 66000 9029444 m:N-t:4001 m:N-t:4001 0
2026-09-16D10:40:00.000000000 AMD 710.43 65500 9029776 m:N-t:4019 m:N-t:4019 0

The two trades at 10:35 and 10:45 have been removed, and the price, size and trade_id values for the two trades at 10:00 and 10:10 have been updated.

Cancellations and corrections in .fsi.getStats

.fsi.getStats selects and applies CanCor data to the queried data in the DAPs. This allows the DAPs to perform the required aggregations before passing the results to the aggregator, instead of passing raw data to the aggregator and applying the CanCor data there.

Note

Using the applyCanCor argument in .fsi.getStats reduces API performance. The DAPs must apply cancellations and corrections to the queried data before performing any aggregations.

Non-historical data

To use applyCanCor in .fsi.getStats for non-historical data, you must configure the canCorTable table and create a corresponding *_today table.

If the corresponding *_today table doesn't exist, .fsi.getStats might not apply cancellations and corrections to data ingested on the current day.

Configuring a *_today table

The *_today table must meet the following requirements:

  • Its name must match the canCorTable table name with a _today suffix. For example, if the canCorTable table is named CanCor, name the corresponding table CanCor_today.
  • It must contain the same columns as the canCorTable table.
  • Its table type must be splayed. This ensures that the table is held in memory with the same data on every DAP tier, giving every DAP access to the latest cancellation and correction data.

Populating *_today tables

When data is ingested into any of the configured canCorTable tables, any data for today's date is automatically ingested into the corresponding *_today tables, if they exist. No additional action or intervention is required. The *_today tables are automatically cleared at the end of each day.

Back to top