{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raeidsaqur.github.io/fast-vollib/schemas/instrument-v1.schema.json",
  "title": "fast-vollib instrument record",
  "description": "A single fast-vollib instrument, serialized. Records are discriminated by 'instrument_type' and versioned by 'schema_version'. Objects are closed: an unknown field is an error, not ignored input. Generated from the same field table the runtime codec uses; do not edit by hand. Experimental until explicitly declared stable.",
  "oneOf": [
    {
      "$ref": "#/$defs/asset"
    },
    {
      "$ref": "#/$defs/forward"
    },
    {
      "$ref": "#/$defs/future"
    },
    {
      "$ref": "#/$defs/european_option"
    },
    {
      "$ref": "#/$defs/binary_option"
    },
    {
      "$ref": "#/$defs/asian_option"
    },
    {
      "$ref": "#/$defs/barrier_option"
    },
    {
      "$ref": "#/$defs/lookback_option"
    },
    {
      "$ref": "#/$defs/variance_swap"
    },
    {
      "$ref": "#/$defs/fixed_rate_bond"
    },
    {
      "$ref": "#/$defs/zero_coupon_bond"
    }
  ],
  "$defs": {
    "asian_option": {
      "type": "object",
      "title": "AsianOption",
      "description": "Option on an average of the underlier over the contract's life.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "asian_option",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "option_type": {
          "type": "string",
          "enum": [
            "call",
            "put"
          ],
          "description": "Call or put. The short 'c'/'p' flags are not wire format."
        },
        "strike": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0.0,
          "description": "Strike price under a fixed strike convention; null under a floating one, where a level read off the path plays the strike's role."
        },
        "averaging_method": {
          "type": "string",
          "enum": [
            "arithmetic",
            "geometric"
          ],
          "description": "Whether the average is arithmetic or geometric."
        },
        "strike_convention": {
          "type": "string",
          "enum": [
            "fixed",
            "floating"
          ],
          "description": "Whether the strike is agreed at inception or read off the path."
        },
        "maturity": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Strictly positive: a path-dependent payoff needs a path."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "option_type",
        "averaging_method",
        "strike_convention",
        "maturity"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "strike_convention": {
                "const": "fixed"
              }
            }
          },
          "then": {
            "required": [
              "strike"
            ],
            "properties": {
              "strike": {
                "type": "number"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "strike_convention": {
                "const": "floating"
              }
            }
          },
          "then": {
            "properties": {
              "strike": {
                "type": "null"
              }
            }
          }
        }
      ]
    },
    "asset": {
      "type": "object",
      "title": "Asset",
      "description": "An economic underlier: what derivatives are written on.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "asset",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "identifier": {
          "type": "string",
          "minLength": 1,
          "description": "Symbol or ticker."
        },
        "asset_class": {
          "type": "string",
          "enum": [
            "equity",
            "index",
            "fx",
            "commodity",
            "rate",
            "credit",
            "digital_asset",
            "other"
          ],
          "description": "Economic class of the asset. Descriptive; selects nothing."
        },
        "currency": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Upper-cased currency code."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "identifier",
        "asset_class"
      ]
    },
    "barrier_option": {
      "type": "object",
      "title": "BarrierOption",
      "description": "Option that knocks in or out when the underlier touches a barrier.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "barrier_option",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "option_type": {
          "type": "string",
          "enum": [
            "call",
            "put"
          ],
          "description": "Call or put. The short 'c'/'p' flags are not wire format."
        },
        "strike": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Strike price; strictly positive."
        },
        "barrier": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Monitored level; strictly positive. Never compared against spot, which is market state rather than a contract term."
        },
        "barrier_type": {
          "type": "string",
          "enum": [
            "up_and_in",
            "up_and_out",
            "down_and_in",
            "down_and_out"
          ],
          "description": "Barrier direction and knock sense."
        },
        "maturity": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Strictly positive: a path-dependent payoff needs a path."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "option_type",
        "strike",
        "barrier",
        "barrier_type",
        "maturity"
      ]
    },
    "binary_option": {
      "type": "object",
      "title": "BinaryOption",
      "description": "Cash-or-nothing digital paying a fixed amount if it finishes in the money.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "binary_option",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "option_type": {
          "type": "string",
          "enum": [
            "call",
            "put"
          ],
          "description": "Call or put. The short 'c'/'p' flags are not wire format."
        },
        "strike": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Strike price; strictly positive."
        },
        "maturity": {
          "type": "number",
          "minimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Never a date."
        },
        "cash_amount": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Fixed amount paid per contract when in the money."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "option_type",
        "strike",
        "maturity"
      ]
    },
    "european_option": {
      "type": "object",
      "title": "EuropeanOption",
      "description": "Option on a single underlier, exercisable only at maturity.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "european_option",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "option_type": {
          "type": "string",
          "enum": [
            "call",
            "put"
          ],
          "description": "Call or put. The short 'c'/'p' flags are not wire format."
        },
        "strike": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Strike price; strictly positive."
        },
        "maturity": {
          "type": "number",
          "minimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Never a date."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "option_type",
        "strike",
        "maturity"
      ]
    },
    "fixed_rate_bond": {
      "type": "object",
      "title": "FixedRateBond",
      "description": "Periodic fixed coupons with the principal repaid alongside the last.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "fixed_rate_bond",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "face_value": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Principal redeemed at maturity; strictly positive. Distinct from a derivative's notional, whose sign denotes a short position."
        },
        "currency": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Upper-cased currency code. Descriptive; it never selects a curve."
        },
        "payment_times": {
          "type": "array",
          "items": {
            "type": "number",
            "exclusiveMinimum": 0.0
          },
          "minItems": 1,
          "description": "Coupon payment times in years, strictly increasing and strictly positive. Must have the same length as accrual_fractions, which the contract enforces and this schema cannot state."
        },
        "accrual_fractions": {
          "type": "array",
          "items": {
            "type": "number",
            "exclusiveMinimum": 0.0
          },
          "minItems": 1,
          "description": "Year fraction each coupon accrues over, one per payment. Supplied rather than derived, because deriving it from the payment times would impose a day-count convention the contract does not carry."
        },
        "coupon_rate": {
          "type": "number",
          "description": "Annual coupon rate as a decimal. Zero and negative are admissible."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "payment_times",
        "accrual_fractions",
        "coupon_rate"
      ]
    },
    "forward": {
      "type": "object",
      "title": "Forward",
      "description": "Agreement to buy the underlier at maturity for a price fixed now.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "forward",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "delivery_price": {
          "type": "number",
          "description": "Price agreed at inception. Any finite value, negatives included."
        },
        "maturity": {
          "type": "number",
          "minimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Never a date."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "delivery_price",
        "maturity"
      ]
    },
    "future": {
      "type": "object",
      "title": "Future",
      "description": "Exchange-traded contract on the underlier, expiring at maturity.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "future",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "contract_price": {
          "type": "number",
          "description": "Traded futures price. Any finite value, negatives included."
        },
        "maturity": {
          "type": "number",
          "minimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Never a date."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "contract_price",
        "maturity"
      ]
    },
    "instrument_ref": {
      "type": "object",
      "title": "Underlier reference",
      "description": "An immutable pointer to an underlier. Carries identity and descriptive metadata only -- never market data.",
      "additionalProperties": false,
      "properties": {
        "identifier": {
          "type": "string",
          "minLength": 1,
          "description": "Symbol, ticker, or other stable key for the underlier."
        },
        "asset_class": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "equity",
            "index",
            "fx",
            "commodity",
            "rate",
            "credit",
            "digital_asset",
            "other",
            null
          ],
          "description": "Economic class of the underlier. Descriptive; selects nothing."
        },
        "currency": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Upper-cased currency code."
        }
      },
      "required": [
        "identifier"
      ]
    },
    "lookback_option": {
      "type": "object",
      "title": "LookbackOption",
      "description": "Option settled against the highest or lowest level the underlier reached.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "lookback_option",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "option_type": {
          "type": "string",
          "enum": [
            "call",
            "put"
          ],
          "description": "Call or put. The short 'c'/'p' flags are not wire format."
        },
        "strike": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0.0,
          "description": "Strike price under a fixed strike convention; null under a floating one, where a level read off the path plays the strike's role."
        },
        "strike_convention": {
          "type": "string",
          "enum": [
            "fixed",
            "floating"
          ],
          "description": "Whether the strike is agreed at inception or read off the path."
        },
        "maturity": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Strictly positive: a path-dependent payoff needs a path."
        },
        "settlement": {
          "type": "string",
          "enum": [
            "cash",
            "physical"
          ],
          "description": "How the contract settles at maturity."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "option_type",
        "strike_convention",
        "maturity"
      ],
      "allOf": [
        {
          "if": {
            "properties": {
              "strike_convention": {
                "const": "fixed"
              }
            }
          },
          "then": {
            "required": [
              "strike"
            ],
            "properties": {
              "strike": {
                "type": "number"
              }
            }
          }
        },
        {
          "if": {
            "properties": {
              "strike_convention": {
                "const": "floating"
              }
            }
          },
          "then": {
            "properties": {
              "strike": {
                "type": "null"
              }
            }
          }
        }
      ]
    },
    "variance_swap": {
      "type": "object",
      "title": "VarianceSwap",
      "description": "Swap paying realized variance against a level agreed at inception.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "variance_swap",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "underlier": {
          "$ref": "#/$defs/instrument_ref",
          "description": "Reference to the underlier this contract is written on."
        },
        "strike_variance": {
          "type": "number",
          "minimum": 0.0,
          "description": "Agreed variance level, the square of a volatility. Non-negative."
        },
        "maturity": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Strictly positive: a path-dependent payoff needs a path."
        },
        "notional": {
          "type": "number",
          "not": {
            "const": 0
          },
          "description": "Contract multiplier. Non-zero and finite; negative denotes a short position."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "underlier",
        "strike_variance",
        "maturity"
      ]
    },
    "zero_coupon_bond": {
      "type": "object",
      "title": "ZeroCouponBond",
      "description": "Single redemption of face value at maturity; no coupons.",
      "additionalProperties": false,
      "properties": {
        "schema_version": {
          "type": "integer",
          "const": 1,
          "description": "Version of the instrument record format."
        },
        "instrument_type": {
          "type": "string",
          "const": "zero_coupon_bond",
          "description": "Discriminator naming the instrument type."
        },
        "instrument_id": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Caller-chosen identity for the record. No valuation meaning."
        },
        "face_value": {
          "type": "number",
          "exclusiveMinimum": 0.0,
          "description": "Principal redeemed at maturity; strictly positive. Distinct from a derivative's notional, whose sign denotes a short position."
        },
        "currency": {
          "type": [
            "string",
            "null"
          ],
          "minLength": 1,
          "description": "Upper-cased currency code. Descriptive; it never selects a curve."
        },
        "maturity": {
          "type": "number",
          "minimum": 0.0,
          "description": "Time to maturity as a year fraction from valuation. Never a date."
        }
      },
      "required": [
        "schema_version",
        "instrument_type",
        "maturity"
      ]
    }
  }
}
