Add, replace, remove or clone a position using an exact book-version guard.
View input schema
{
"type": "object",
"properties": {
"book_id": {
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$",
"title": "Book Id",
"type": "string"
},
"expected_version": {
"minimum": 1,
"title": "Expected Version",
"type": "integer"
},
"action": {
"enum": [
"add",
"replace",
"remove",
"clone"
],
"title": "Action",
"type": "string"
},
"trade_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Trade Id",
"type": "string"
},
"position": {
"anyOf": [
{
"$ref": "#/$defs/Position"
},
{
"type": "null"
}
],
"default": null
},
"new_trade_id": {
"anyOf": [
{
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "New Trade Id"
},
"idempotency_key": {
"pattern": "^[A-Za-z0-9_.:-]{1,128}$",
"title": "Idempotency Key",
"type": "string"
},
"guest_session": {
"type": "string",
"description": "Workspace returned by demo_start_session in this conversation."
}
},
"required": [
"book_id",
"expected_version",
"action",
"trade_id",
"idempotency_key",
"guest_session"
],
"$defs": {
"AsianTrade": {
"additionalProperties": false,
"properties": {
"product": {
"const": "asian",
"title": "Product",
"type": "string"
},
"asset_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Asset Id",
"type": "string"
},
"strike": {
"exclusiveMinimum": 0,
"title": "Strike",
"type": "number"
},
"fixing_dates": {
"items": {
"type": "string"
},
"maxItems": 366,
"minItems": 1,
"title": "Fixing Dates",
"type": "array"
},
"settlement_date": {
"title": "Settlement Date",
"type": "string"
},
"option_type": {
"const": "call",
"title": "Option Type",
"type": "string"
},
"averaging": {
"const": "arithmetic",
"title": "Averaging",
"type": "string"
},
"day_count": {
"const": "ACT/365F",
"title": "Day Count",
"type": "string"
},
"currency": {
"const": "USD",
"title": "Currency",
"type": "string"
}
},
"required": [
"product",
"asset_id",
"strike",
"fixing_dates",
"settlement_date",
"option_type",
"averaging",
"day_count",
"currency"
],
"title": "AsianTrade",
"type": "object"
},
"BasketTrade": {
"additionalProperties": false,
"properties": {
"product": {
"const": "basket",
"title": "Product",
"type": "string"
},
"asset_ids": {
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"type": "string"
},
{
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"type": "string"
}
],
"title": "Asset Ids",
"type": "array"
},
"strike": {
"exclusiveMinimum": 0,
"title": "Strike",
"type": "number"
},
"maturity_date": {
"title": "Maturity Date",
"type": "string"
},
"settlement_date": {
"title": "Settlement Date",
"type": "string"
},
"option_type": {
"enum": [
"call",
"put"
],
"title": "Option Type",
"type": "string"
},
"weights": {
"maxItems": 2,
"minItems": 2,
"prefixItems": [
{
"const": 0.5,
"type": "number"
},
{
"const": 0.5,
"type": "number"
}
],
"title": "Weights",
"type": "array"
},
"day_count": {
"const": "ACT/365F",
"title": "Day Count",
"type": "string"
},
"currency": {
"const": "USD",
"title": "Currency",
"type": "string"
}
},
"required": [
"product",
"asset_ids",
"strike",
"maturity_date",
"settlement_date",
"option_type",
"weights",
"day_count",
"currency"
],
"title": "BasketTrade",
"type": "object"
},
"GasTrade": {
"additionalProperties": false,
"properties": {
"product": {
"const": "gas_storage",
"title": "Product",
"type": "string"
},
"facility_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Facility Id",
"type": "string"
},
"policy_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Policy Id",
"type": "string"
},
"policy_sha256": {
"pattern": "^[0-9a-f]{64}$",
"title": "Policy Sha256",
"type": "string"
},
"curve_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Curve Id",
"type": "string"
},
"start_date": {
"title": "Start Date",
"type": "string"
},
"end_date": {
"title": "End Date",
"type": "string"
},
"contract_days": {
"const": 180,
"title": "Contract Days",
"type": "integer"
},
"risk_semantics": {
"const": "fixed_policy_fixed_ou_parameters",
"title": "Risk Semantics",
"type": "string"
},
"currency": {
"const": "USD",
"title": "Currency",
"type": "string"
},
"volume_unit": {
"const": "MMBtu",
"title": "Volume Unit",
"type": "string"
}
},
"required": [
"product",
"facility_id",
"policy_id",
"policy_sha256",
"curve_id",
"start_date",
"end_date",
"contract_days",
"risk_semantics",
"currency",
"volume_unit"
],
"title": "GasTrade",
"type": "object"
},
"Position": {
"additionalProperties": false,
"properties": {
"trade_id": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Trade Id",
"type": "string"
},
"group": {
"pattern": "^[A-Za-z][A-Za-z0-9_.:-]{0,79}$",
"title": "Group",
"type": "string"
},
"quantity": {
"title": "Quantity",
"type": "number"
},
"instrument": {
"discriminator": {
"mapping": {
"asian": "#/$defs/AsianTrade",
"basket": "#/$defs/BasketTrade",
"gas_storage": "#/$defs/GasTrade"
},
"propertyName": "product"
},
"oneOf": [
{
"$ref": "#/$defs/AsianTrade"
},
{
"$ref": "#/$defs/BasketTrade"
},
{
"$ref": "#/$defs/GasTrade"
}
],
"title": "Instrument"
}
},
"required": [
"trade_id",
"group",
"quantity",
"instrument"
],
"title": "Position",
"type": "object"
}
},
"additionalProperties": false,
"title": "EditPosition"
}