# Generated by tools/build_contracts.py from tools/algoseek_catalog.py -- do not edit by hand.
# Open Data Contract Standard v3.2.0 (https://bitol-io.github.io/open-data-contract-standard/).
apiVersion: v3.2.0
kind: DataContract
id: urn:alphaswarm:datacontract:algoseek:us-options-open-interest
name: AlgoSeek US Options Open Interest
version: 0.1.0
status: draft
domain: market-data
tags:
- algoseek
- licensed-data
- options
- opra
- us
- event
description:
  purpose: One row per option contract per trading day carrying the open interest figure published through
    OPRA (time-stamped pre-open), i.e. the contract's outstanding positions as of the previous trading
    day.
  usage: Options pricing, volatility, and flow research on US-listed equity and index options.
  limitations: 'Delivered as recorded from the source feed: AlgoSeek does not remove crossed or locked
    quotes, bad prints, or out-of-sequence packets unless contracted to. Consumers own cleaning. Contract
    identity per row = Ticker + CallPut + StrikePrice + ExpirationDate; no OSI/OCC symbol column. StrikePrice
    is a decimal in USD per share written without padding (190, 227.5); Ticker is the ''OPRA symbol name''.
    OpenInterest on TradeDate T is the prior trading day''s (T-1) outstanding contracts, published pre-open
    on T (timestamps about 06:30 ET). For point-in-time use, treat a row as known from its Timestamp on
    TradeDate, describing T-1 close. Schema versioning: v1.x files (initial release 2023-07-23) carried
    EventType, Action, Price, Date and Quantity; v2.0.0 (2026-04-06) delivers only the 7 columns listed
    here. Expect different headers in older history. Timestamp is an event time (ET, ms) with no date
    part; it may be the OPRA publication time for the OI message, but the guide only calls it ''open interest
    event timestamp''.'
  authoritativeDefinitions:
  - type: businessDefinition
    url: https://algoseek.com/dataset/us-options-open-interest/
  - type: implementation
    url: https://algoseek.com/data-docs/options-market-data/algoseek.US.OPRA.Options.Open.Interest.pdf
  - type: implementation
    url: https://algoseek.com/docs/rest-api/reference
context:
  instructions: 'Identify a contract by underlying, expiration, strike and call/put. Most options tick
    files carry no underlying/root column: the underlying comes from the file path or API identifier,
    so keep it alongside every row you land. Strikes and prices are plain decimals (not scaled). EventType
    is a bit field: low 4 bits message type, 16 cancel, 32 call, 64 NBBO, 128 buy/bid side. Check OCC
    special settlements before comparing prices across a corporate action.'
  constraints:
  - id: c1
    constraint: 'Licensed vendor data: never export raw rows to a tenant-local destination or include
      them verbatim in a public artifact; serve only through entitlement-checked platform reads.'
  - id: c3
    constraint: Do not treat the vendor's `Ticker` as a stable identity across time; join on an AlgoSeek
      security key (SecId or ASID, which are distinct) or the platform symbol mapping.
servers:
- server: algoseek-s3
  type: s3
  environment: vendor
  description: AlgoSeek flat-file delivery (the layout the schema below describes).
  location: s3://${ALGOSEEK_S3_BUCKET_OPT_OPEN_INTEREST}/
  format: csv
  encoding: UTF-8
  customProperties:
  - property: layout
    value: Plain-text CSV with fixed header row, gzip-compressed (about 8:1), one file per trading day
      named yyyymmdd.csv.gz. Bucket/path naming not stated.
  - property: compression
    value: gzip
  - property: header
    value: true
  - property: entitlement
    value: Bucket access is granted per subscription; bucket names arrive with license provisioning.
- server: algoseek-rest-api
  type: api
  environment: vendor
  description: AlgoSeek Datasets REST API (X-API-KEY header; JSON, CSV or gzipped CSV). Returns AlgoSeek's
    normalized API layout, which differs from the flat-file columns in this contract's schema.
  location: https://api.algoseek.com/v1/data/us-equity-opt/open-interest/:identifier
  customProperties:
  - property: auth
    value: X-API-KEY header issued by AlgoSeek
  - property: columnsEndpoint
    value: https://api.algoseek.com/v1/meta/datasets/{dataset_id}/columns
  - property: statusEndpoint
    value: https://api.algoseek.com/v1/meta/datasets/{dataset_id}/status
  - property: responseFormats
    value:
    - json
    - csv
    - csv_gzip
  - property: pagination
    value: offset + limit; tick endpoints take trade_date and identifier (Ticker or ASID) in the path
schema:
- name: us_options_open_interest
  physicalName: opt_open_interest
  physicalType: file
  logicalType: object
  businessName: US Options Open Interest
  description: One row per option contract per trading day carrying the open interest figure published
    through OPRA (time-stamped pre-open), i.e. the contract's outstanding positions as of the previous
    trading day.
  dataGranularityDescription: one open interest record (OPRA open interest event) per option contract
    (Ticker x CallPut x StrikePrice x ExpirationDate) per TradeDate
  properties:
  - name: TradeDate
    logicalType: date
    logicalTypeOptions:
      format: yyyymmdd
    physicalType: string (yyyymmdd) (csv text)
    description: Trading date of the open interest record
    primaryKey: true
    primaryKeyPosition: 1
    required: true
    customProperties:
    - property: evidence
      value: guide+sample
  - name: Timestamp
    logicalType: time
    logicalTypeOptions:
      format: HHMMSSmmm (e.g. 063020553 = 06:30:20.553 ET)
    physicalType: string (HHMMSSmmm) (csv text)
    description: Time of the open interest event in milliseconds, ET; import as text because Excel mangles
      it
    customProperties:
    - property: evidence
      value: guide+sample
  - name: Ticker
    logicalType: string
    physicalType: string (csv text)
    description: OPRA symbol name; sample shows the underlying/root (AAPL)
    primaryKey: true
    primaryKeyPosition: 2
    required: true
    customProperties:
    - property: evidence
      value: guide+sample
  - name: CallPut
    logicalType: string
    physicalType: string (csv text)
    description: Option type, C = Call or P = Put
    primaryKey: true
    primaryKeyPosition: 3
    required: true
    enum:
    - value: C
      label: Call
    - value: P
      label: Put
    customProperties:
    - property: evidence
      value: guide+sample
  - name: StrikePrice
    logicalType: number
    physicalType: decimal (csv text)
    description: Fixed price at which the option can be exercised, quoted per share of underlying
    primaryKey: true
    primaryKeyPosition: 4
    required: true
    customProperties:
    - property: unit
      value: USD
    - property: evidence
      value: guide+sample
  - name: ExpirationDate
    logicalType: date
    logicalTypeOptions:
      format: yyyymmdd
    physicalType: string (yyyymmdd) (csv text)
    description: Expiration date of the option contract
    primaryKey: true
    primaryKeyPosition: 5
    required: true
    customProperties:
    - property: evidence
      value: guide+sample
  - name: OpenInterest
    logicalType: integer
    logicalTypeOptions:
      format: i64
    physicalType: integer (csv text)
    description: Total contracts held by market participants as of the previous trading day
    customProperties:
    - property: unit
      value: contracts
    - property: evidence
      value: guide+sample
  quality:
  - id: row_count_positive
    metric: rowCount
    mustBeGreaterThan: 0
    dimension: completeness
    severity: error
    description: Every delivered partition (trade date, or snapshot) carries at least one row.
  - id: primary_key_unique
    metric: duplicateValues
    mustBe: 0
    arguments:
      properties:
      - TradeDate
      - Ticker
      - CallPut
      - StrikePrice
      - ExpirationDate
    dimension: uniqueness
    severity: error
    description: The declared primary key is unique within each delivered partition (one file or table
      snapshot).
  - id: OpenInterest_non_negative
    type: sql
    description: OpenInterest is never negative.
    query: SELECT COUNT(*) FROM {object} WHERE OpenInterest < 0
    mustBe: 0
    dimension: accuracy
    severity: error
support:
- channel: algoseek-support
  tool: email
  url: mailto:support@algoseek.com
  scope: issues
  description: Vendor support for data defects, missing days, and entitlement problems.
team:
  name: AlphaSwarm data engineering
slaProperties:
- id: retention
  property: retention
  value: license-term
  description: Retention of landed copies is bounded by the AlgoSeek license; purge on termination.
  driver: regulatory
customProperties:
- property: vendor
  value: AlgoSeek
- property: vendorDataGroup
  value: us-equity-opt
- property: vendorDatasetTextId
  value: opt_open_interest
- property: vendorSampleUrl
  value: https://as-metadata-services-assets.s3.amazonaws.com/sample_data/cloud_storage/opt_open_interest_v2.csv
- property: assetClass
  value: option
- property: venues
  value:
  - OPRA consolidated feed (16 options exchanges; individual venues not named)
- property: coverage
  value: US options from the OPRA feed (16 options exchanges); guide intro names options on equities,
    ETFs, ETNs and ADRs, page says equity and index options. Open interest is consolidated across exchanges.
    History start is not stated (guide cites an initial release on 2023-07-23; guide sample content dates
    from 2012).
- property: timezone
  value: America/New_York
- property: timestampFormat
  value: HHMMSSmmm (millisecond, no separators), e.g. 063007975
- property: sessionHours
  value: n/a (pre-open publication; sample timestamps fall around 06:30-06:31 ET)
- property: priceAdjustment
  value: n/a
- property: licensedData
  value: true
- property: evidenceGrade
  value: vendor-doc
- property: knownIssues
  value:
  - Primary key is inferred; AlgoSeek's guide does not name one.
  - Update cadence and publication latency are not stated in the guide; confirm with AlgoSeek (or GET
    /v1/meta/datasets/{id}/status).
  - 'Doc discrepancy: Guide TOC lists Calculation Details, Important Notes, Resources and Dataset Location
    Details (pages 9-10) but the PDF text ends on page 6, so those sections are unavailable.'
  - 'Doc discrepancy: Guide Table 2 has no Missing column (other guides do), so null behaviour is unstated.'
  - 'Doc discrepancy: Guide Table 1 sample content is from 2012-01-30 (ticker A) while the published sample
    CSV is 2020-01-28 (ticker AAPL, expiry 20200131); both use the same 7 columns.'
  - 'Doc discrepancy: Guide intro says options on equities, ETFs, ETNs and ADRs; product page says equity
    and index options.'
  - 'Doc discrepancy: Page text says open interest is ''at the end of each trading day'' while the guide
    defines OpenInterest as positions held for the previous trading day.'
  - 'Doc discrepancy: Strike column is named StrikePrice here but Strike in the bar datasets; expiry/date
    naming also differs (TradeDate, ExpirationDate).'
  - 'Doc discrepancy: Guide columns match the 7-column sample header exactly. The guide''s revision summary
    says v1.x had EventType, Action, Price, Date and Quantity columns; v2.0.0 (2026-04-06) removed the
    first three and renamed Date->TradeDate and Quantity->OpenInterest.'
contractCreatedTs: '2026-11-02T00:00:00Z'
