Skip to content

Backfill historic OneTick US Comp data

This page describes how the otdatabackfill pipeline ingests specific dates of historic OneTick US Comp data from an Amazon Web Services (AWS) S3 bucket into kdb Insights Enterprise.

Use otdatabackfill to re-ingest dates that the otdataloader pipeline has already ingested. Unlike otdataloader, which monitors the bucket continuously, otdatabackfill runs once for the dates you request and does not poll for new data.

Use the TABLES option to overwrite only the tables specified, leaving the other tables for the date untouched.

Note

Dates before the otdataloader START_DATE are expected to already exist in the S3 historical database (HDB) object storage tier. Do not use otdatabackfill to ingest these dates. Attempting to ingest dates that exist in the S3 HDB storage tier will result in an error:

"time":"2026-10-26T16:38:39.105z","component":"SPWRITE","level":"FATAL","message":"[fsi-app-ot-uscomp-otdatabackfill-1-spwork] Received failed persistence message for dbwrite: [error=\"batch ingest dates in object store tier date range nyi\"]"

Prerequisites

The otdatabackfill pipeline reads from the same AWS S3 bucket as the otdataloader pipeline, which is managed by KX and OneTick. Confirm that your environment can access this bucket before running the pipeline. For the bucket structure and the status/, hdb/, and sym contents, see the otdataloader prerequisites.

A date is only eligible for backfill when the bucket contains a matching status file, status/finished_YYYY_MM_DD.txt. The pipeline ignores requested dates that have no status file.

Pipeline options

Several environment variables control the behavior of the otdatabackfill pipeline. Set these at runtime using the command-line interface (CLI). For details, see Inject environment variables.

You must specify the dates to ingest using either DATES, or both START_DATE and END_DATE.

Environment Variable Required Purpose Notes
OT_DATA_LOADER_S3_URI yes Path to bucket containing OneTick data which is managed by KX and OneTick. Format: s3://<BUCKET_NAME>/<PREFIX>/
Use the full uniform resource identifier (URI) as described in the prerequisites section
OT_DATA_LOADER_REGION yes AWS_REGION of OT_DATA_LOADER_S3_URI.
AWS_ACCESS_KEY_ID yes Access Key ID which allows otdatabackfill to access OT_DATA_LOADER_S3_URI.
AWS_SECRET_ACCESS_KEY yes Secret Access Key which allows otdatabackfill to access OT_DATA_LOADER_S3_URI.
AWS_SESSION_TOKEN no Session token which allows otdatabackfill to access OT_DATA_LOADER_S3_URI. Optional - might not be required if using long-running AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
DATES conditional Semicolon-separated list of dates to ingest. Format = YYYY.MM.DD;YYYY.MM.DD. Required unless START_DATE and END_DATE are both set. Use this option to ingest a single date.
START_DATE conditional First date of a range of dates to ingest. Format = YYYY.MM.DD. Must be set together with END_DATE.
END_DATE conditional Last date of a range of dates to ingest. Format = YYYY.MM.DD. Must be set together with START_DATE, and must be later than START_DATE.
TABLES no Semicolon-separated list of tables to ingest. Defaults to all tables. Format = trade;quote. Table names must match tables in the assembly. Only the listed tables are overwritten for the requested dates.
DATE_LIMIT no Limits how many dates can be ingested in parallel. Defaults to 1. Higher limits require more disk space usage because the data exists in both the staging and HDB directories during ingestion.

Note

If you set both DATES and START_DATE/END_DATE, the date range takes precedence and DATES is ignored.

Note

The date range includes every calendar day between START_DATE and END_DATE. Days with no finished_YYYY_MM_DD.txt status file are skipped automatically.

Warning

The pipeline cannot ingest data for dates that have already moved to the S3 HDB object storage tier. Data stays on the local HDB tier for the configured retention period, 90 days by default (retain.time in fsi-app-ot-uscomp/databases/fsi-core-db/shards/fsi-core-db-shard.yaml), before moving to S3. You can only backfill dates within this period. For information about configuring HDB object storage and the retention period, see the Quickstart guide.

The pipeline fails to start if:

  • Neither DATES nor a date range is provided.
  • Only one of START_DATE and END_DATE is provided.
  • START_DATE is not earlier than END_DATE.

Examples

Backfill a range of dates

The following command starts the otdatabackfill pipeline to re-ingest the TRD and QTE tables for all available dates between START_DATE and END_DATE, with all options set:

# First Set Environment Variables to be used by pipeline
OT_DATA_LOADER_S3_URI='s3://<BUCKET_NAME>/<PREFIX>/'
OT_DATA_LOADER_REGION=<INSERT_REGION>
START_DATE=2026.06.01
END_DATE=2026.06.12
TABLES='TRD;QTE'
DATE_LIMIT=2
AWS_ACCESS_KEY_ID=<INSERT_AWS_ACCESS_KEY_ID>
AWS_SECRET_ACCESS_KEY=<INSERT_AWS_SECRET_ACCESS_KEY>
AWS_SESSION_TOKEN=<INSERT_AWS_SESSION_TOKEN>
# Note: Variables `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` and `AWS_SESSION_TOKEN` can be quickly set using the command `eval $(aws configure export-credentials --format env)`

# Command to deploy the SP pipeline
kxi pm deploy fsi-app-ot-uscomp --pipeline otdatabackfill --env otdatabackfill:OT_DATA_LOADER_S3_URI=$OT_DATA_LOADER_S3_URI --env otdatabackfill:OT_DATA_LOADER_REGION=$OT_DATA_LOADER_REGION --env otdatabackfill:AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env otdatabackfill:AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --env otdatabackfill:AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN --env otdatabackfill:START_DATE=$START_DATE --env otdatabackfill:END_DATE=$END_DATE --env otdatabackfill:TABLES="$TABLES" --env otdatabackfill:DATE_LIMIT=$DATE_LIMIT

Omit any --env flags for variables you do not need.

Backfill specific dates

To ingest a specific list of dates, or a single date, set DATES instead of START_DATE and END_DATE:

DATES='2026.06.02;2026.06.05;2026.06.09'

kxi pm deploy fsi-app-ot-uscomp --pipeline otdatabackfill --env otdatabackfill:OT_DATA_LOADER_S3_URI=$OT_DATA_LOADER_S3_URI --env otdatabackfill:OT_DATA_LOADER_REGION=$OT_DATA_LOADER_REGION --env otdatabackfill:AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID --env otdatabackfill:AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY --env otdatabackfill:AWS_SESSION_TOKEN=$AWS_SESSION_TOKEN --env otdatabackfill:DATES="$DATES"

Quote the DATES value so that the shell does not interpret the semicolons.

Next steps

Back to top