The finance developer workbenchSearch the reference Development · 0.1.4 · unpublished

trade / wire operation

Submit an authorized plan to the paper broker

totalfinance.trade.submit

Verify the grant against the plan, the portfolio and market hashes, the market instant, the account, and the idempotency key; journal submitted and acknowledged; return the content-addressed receipt — the SAME receipt for a retry with the same key and plan (no second order), trade.idempotency_conflict for the same key with another plan, trade.grant_expired for an expired grant. With `observations`, the open orders meet the market through the engines' own fill path. Top-level fills/events are only this call’s new deltas; the submission receipt is immutable. `currentOrders` is the authoritative journal-derived current state and cumulative filled/remaining quantities for this receipt. `recovery: { fills, events }` contains all persisted normalized fills and reproducible ledger envelopes for this receipt’s orders, including this call’s fills. Retry after a lost response and apply recovery.events with portfolio.record_events; identical events fold once. Recovery grows with later fills without replaying the fill engine. The journal continues transactionally from the required journal store under `<sourceId>:journal`; retries must retain that store and source. A grant atomically records its exact prepared submission before journal commit: a retry with the same key into the same store/journal recovers those events and reads the same receipt; any other submission of the grant is trade.grant_consumed. Every journal write recovers earlier pending submissions before allocating new identities. Inline history must match persisted history exactly. Inline grants must exist unchanged in the trusted authorization store. Paper only; requires trade:paper. Opt-in (tradePack).

Pack / profilestrade / full
Default discoveryOpt-in
Required capabilitiestrade:paper
Effects / authorizationexternal-order / policy
Cost / cancellationsmall / Do not assume inline interruption
Handle-eligible inputsNone
Idempotencyrequired
Input schema
{
  "type": "object",
  "properties": {
    "plan": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "totalfinance.execution-plan",
          "type": "string"
        },
        "schemaVersion": {
          "const": 1,
          "type": "number"
        },
        "accountId": {
          "type": "string",
          "minLength": 1
        },
        "asOf": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "baseCurrency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "portfolioId": {
          "type": "string",
          "minLength": 1
        },
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Orders"
          },
          "minItems": 1,
          "maxItems": 1000
        },
        "combos": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "comboId": {
                "type": "string",
                "minLength": 1
              },
              "orderIds": {
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                },
                "minItems": 2,
                "description": "The legs, in plan order (at least two)"
              },
              "netLimitPrice": {
                "type": "number"
              }
            },
            "additionalProperties": false,
            "required": [
              "comboId",
              "orderIds"
            ]
          }
        },
        "trades": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "accountId": {
                "type": "string",
                "minLength": 1
              },
              "instrumentId": {
                "type": "string",
                "minLength": 1
              },
              "side": {
                "type": "string",
                "enum": [
                  "buy",
                  "sell"
                ]
              },
              "quantity": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "currency": {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              "referencePricePerUnit": {
                "type": "number"
              },
              "contractMultiplier": {
                "type": "number",
                "exclusiveMinimum": 0
              },
              "estimatedNotional": {
                "type": "number"
              }
            },
            "additionalProperties": false,
            "required": [
              "accountId",
              "instrumentId",
              "side",
              "quantity",
              "currency",
              "referencePricePerUnit",
              "contractMultiplier",
              "estimatedNotional"
            ]
          }
        },
        "source": {
          "anyOf": [
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "intent",
                  "type": "string"
                },
                "intentHash": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "additionalProperties": false,
              "required": [
                "kind",
                "intentHash"
              ]
            },
            {
              "type": "object",
              "properties": {
                "kind": {
                  "const": "rebalance-proposal",
                  "type": "string"
                },
                "planHash": {
                  "type": "string",
                  "minLength": 1
                },
                "policyContentHash": {
                  "type": "string",
                  "minLength": 1
                }
              },
              "additionalProperties": false,
              "required": [
                "kind",
                "planHash",
                "policyContentHash"
              ]
            }
          ]
        },
        "rationale": {
          "type": "string"
        },
        "evidence": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "contentHash": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "schemaVersion",
        "accountId",
        "asOf",
        "baseCurrency",
        "orders",
        "combos",
        "trades",
        "source",
        "evidence",
        "contentHash"
      ]
    },
    "grant": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "totalfinance.authorization-grant",
          "type": "string"
        },
        "schemaVersion": {
          "const": 1,
          "type": "number"
        },
        "grantId": {
          "type": "string",
          "minLength": 1
        },
        "planHash": {
          "type": "string",
          "minLength": 1
        },
        "preflightHash": {
          "type": "string",
          "minLength": 1
        },
        "portfolioHash": {
          "type": "string",
          "minLength": 1
        },
        "marketHash": {
          "type": "string",
          "minLength": 1
        },
        "marketAsOf": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "marketMaximumAgeMs": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "mode": {
          "const": "paper",
          "type": "string"
        },
        "accountId": {
          "type": "string",
          "minLength": 1
        },
        "baseCurrency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "orderIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "comboIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "variance": {
          "type": "object",
          "properties": {
            "maximumQuantityRatio": {
              "type": "number",
              "minimum": 0
            },
            "maximumNotionalRatio": {
              "type": "number",
              "minimum": 0
            },
            "maximumSlippageBps": {
              "type": "number",
              "minimum": 0
            }
          },
          "additionalProperties": false,
          "required": [
            "maximumQuantityRatio",
            "maximumNotionalRatio",
            "maximumSlippageBps"
          ]
        },
        "issuedAt": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "expiresAt": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "approvedBy": {
          "type": "string",
          "minLength": 1
        },
        "requiredScope": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "idempotencyKeys": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          },
          "minItems": 1,
          "maxItems": 1000
        },
        "contentHash": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "schemaVersion",
        "grantId",
        "planHash",
        "preflightHash",
        "portfolioHash",
        "marketHash",
        "marketAsOf",
        "marketMaximumAgeMs",
        "mode",
        "accountId",
        "baseCurrency",
        "orderIds",
        "comboIds",
        "variance",
        "issuedAt",
        "expiresAt",
        "approvedBy",
        "requiredScope",
        "idempotencyKeys",
        "contentHash"
      ]
    },
    "grantHash": {
      "type": "string"
    },
    "idempotencyKey": {
      "type": "string",
      "minLength": 1
    },
    "now": {
      "type": "number",
      "description": "Epoch ms — the submission instant"
    },
    "portfolioHash": {
      "type": "string"
    },
    "marketHash": {
      "type": "string"
    },
    "marketAsOf": {
      "type": "number"
    },
    "sourceId": {
      "type": "string",
      "minLength": 1,
      "description": "The execution source (`paper:<account>` by convention); the journal id derives from it"
    },
    "accountId": {
      "type": "string",
      "minLength": 1
    },
    "baseCurrency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "instruments": {
      "type": "object",
      "additionalProperties": {
        "$ref": "#/$defs/Instruments"
      }
    },
    "orders": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Orders"
      }
    },
    "journal": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "eventId": {
                "type": "string",
                "minLength": 1
              },
              "journalId": {
                "type": "string",
                "minLength": 1
              },
              "timestampMs": {
                "type": "number",
                "description": "Epoch milliseconds"
              },
              "orderId": {
                "type": "string",
                "minLength": 1
              },
              "planHash": {
                "type": "string",
                "minLength": 1
              },
              "idempotencyKey": {
                "type": "string",
                "minLength": 1
              },
              "sourceId": {
                "type": "string",
                "minLength": 1
              },
              "provenance": {
                "type": "object",
                "properties": {
                  "provider": {
                    "type": "string"
                  },
                  "dataset": {
                    "type": "string"
                  },
                  "asOf": {
                    "type": "number",
                    "description": "Epoch milliseconds"
                  },
                  "receivedAt": {
                    "type": "number",
                    "description": "Epoch milliseconds"
                  },
                  "sourceVersion": {
                    "type": "string"
                  },
                  "requestId": {
                    "type": "string"
                  },
                  "warnings": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "minLength": 1
                        },
                        "message": {
                          "type": "string"
                        },
                        "severity": {
                          "type": "string",
                          "enum": [
                            "info",
                            "warn",
                            "error"
                          ]
                        },
                        "context": {
                          "type": "object",
                          "additionalProperties": {}
                        }
                      },
                      "additionalProperties": false,
                      "required": [
                        "code",
                        "message",
                        "severity"
                      ]
                    }
                  }
                },
                "additionalProperties": false
              },
              "eventType": {},
              "detail": {}
            },
            "additionalProperties": false,
            "required": [
              "eventId",
              "journalId",
              "timestampMs",
              "orderId",
              "planHash",
              "sourceId",
              "provenance",
              "eventType",
              "detail"
            ]
          },
          {
            "anyOf": [
              {
                "properties": {
                  "eventType": {
                    "const": "proposed",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "preflighted",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "authorized",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "submitted",
                    "type": "string"
                  },
                  "detail": {
                    "type": "object",
                    "properties": {
                      "quantity": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "fillId": {
                        "type": "string"
                      },
                      "pricePerUnit": {
                        "type": "number"
                      },
                      "reason": {
                        "type": "string"
                      },
                      "replacementOrderId": {
                        "type": "string"
                      },
                      "artifactHash": {
                        "type": "string"
                      },
                      "note": {
                        "type": "string"
                      },
                      "order": {
                        "$ref": "#/$defs/Orders"
                      },
                      "instrument": {
                        "$ref": "#/$defs/Instruments"
                      },
                      "accountId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "baseCurrency": {
                        "type": "string",
                        "pattern": "^[A-Z]{3}$"
                      },
                      "executionPolicyHash": {
                        "type": "string",
                        "minLength": 1
                      },
                      "comboId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "netLimitPrice": {
                        "type": "number"
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "quantity"
                    ]
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "acknowledged",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "partially-filled",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail2"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "filled",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail2"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "rejected",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "cancel-requested",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "cancelled",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "replaced",
                    "type": "string"
                  },
                  "detail": {
                    "type": "object",
                    "properties": {
                      "quantity": {
                        "type": "number"
                      },
                      "fillId": {
                        "type": "string"
                      },
                      "pricePerUnit": {
                        "type": "number"
                      },
                      "reason": {
                        "type": "string"
                      },
                      "replacementOrderId": {
                        "type": "string",
                        "minLength": 1
                      },
                      "artifactHash": {
                        "type": "string"
                      },
                      "note": {
                        "type": "string"
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "replacementOrderId"
                    ]
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "expired",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "reconciled",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              },
              {
                "properties": {
                  "eventType": {
                    "const": "unresolved",
                    "type": "string"
                  },
                  "detail": {
                    "$ref": "#/$defs/Detail"
                  }
                }
              }
            ]
          }
        ]
      },
      "description": "Optional exact canonical snapshot of the persisted journal; checked inside the transaction. Never imports or replaces history. An execution-journal store is required."
    },
    "observations": {
      "type": "object",
      "additionalProperties": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "bar",
                "type": "string"
              },
              "bar": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string",
                    "minLength": 1
                  },
                  "timestampMs": {
                    "type": "number"
                  },
                  "open": {
                    "type": "number"
                  },
                  "high": {
                    "type": "number"
                  },
                  "low": {
                    "type": "number"
                  },
                  "close": {
                    "type": "number"
                  },
                  "volume": {
                    "type": "number",
                    "minimum": 0
                  },
                  "vwap": {
                    "type": "number"
                  },
                  "adjusted": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "symbol",
                  "timestampMs",
                  "open",
                  "high",
                  "low",
                  "close"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "kind",
              "bar"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "quote",
                "type": "string"
              },
              "quote": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string",
                    "minLength": 1
                  },
                  "timestampMs": {
                    "type": "number"
                  },
                  "bid": {
                    "type": "number"
                  },
                  "ask": {
                    "type": "number"
                  },
                  "bidSize": {
                    "type": "number",
                    "minimum": 0
                  },
                  "askSize": {
                    "type": "number",
                    "minimum": 0
                  },
                  "exchange": {
                    "type": "string"
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                },
                "additionalProperties": false,
                "required": [
                  "symbol",
                  "timestampMs",
                  "bid",
                  "ask"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "kind",
              "quote"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "trade",
                "type": "string"
              },
              "trade": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string",
                    "minLength": 1
                  },
                  "timestampMs": {
                    "type": "number"
                  },
                  "price": {
                    "type": "number"
                  },
                  "size": {
                    "type": "number"
                  },
                  "exchange": {
                    "type": "string"
                  },
                  "conditions": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "sequence": {
                    "type": "number"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "symbol",
                  "timestampMs",
                  "price",
                  "size"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "kind",
              "trade"
            ]
          },
          {
            "type": "object",
            "properties": {
              "kind": {
                "const": "order-book",
                "type": "string"
              },
              "book": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string",
                    "minLength": 1
                  },
                  "timestampMs": {
                    "type": "number"
                  },
                  "bids": {
                    "$ref": "#/$defs/Bids"
                  },
                  "asks": {
                    "$ref": "#/$defs/Bids"
                  }
                },
                "additionalProperties": false,
                "required": [
                  "symbol",
                  "timestampMs",
                  "bids",
                  "asks"
                ]
              }
            },
            "additionalProperties": false,
            "required": [
              "kind",
              "book"
            ]
          }
        ]
      }
    },
    "asOf": {
      "type": "number",
      "description": "Epoch ms — the instant the open orders meet the observations (default `now`)"
    }
  },
  "additionalProperties": false,
  "required": [
    "plan",
    "idempotencyKey",
    "now",
    "portfolioHash",
    "marketHash",
    "marketAsOf",
    "sourceId",
    "accountId",
    "baseCurrency"
  ],
  "anyOf": [
    {
      "required": [
        "grant"
      ]
    },
    {
      "required": [
        "grantHash"
      ]
    }
  ],
  "$id": "https://totalfinance.dev/schemas/trade.submit.input",
  "$defs": {
    "Orders": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "instrumentId": {
              "type": "string",
              "minLength": 1
            },
            "side": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ]
            },
            "timeInForce": {
              "type": "string",
              "enum": [
                "day",
                "gtc"
              ],
              "description": "Default: the paper execution policy’s day time-in-force"
            },
            "comboId": {
              "type": "string",
              "minLength": 1,
              "description": "The multi-leg order this is a leg of (B5)"
            },
            "orderId": {
              "type": "string",
              "minLength": 1
            },
            "quantity": {
              "type": "number",
              "exclusiveMinimum": 0,
              "description": "Units/contracts, strictly positive; side carries direction"
            },
            "plannedTimestampMs": {
              "type": "number",
              "description": "When the plan was made — never when a broker saw the order"
            },
            "submittedTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            },
            "type": {},
            "limitPrice": {},
            "stopPrice": {}
          },
          "additionalProperties": false,
          "required": [
            "instrumentId",
            "side",
            "orderId",
            "quantity",
            "plannedTimestampMs",
            "type"
          ]
        },
        {
          "anyOf": [
            {
              "properties": {
                "type": {
                  "const": "market",
                  "type": "string"
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "limitPrice"
                    ]
                  },
                  {
                    "required": [
                      "stopPrice"
                    ]
                  }
                ]
              }
            },
            {
              "properties": {
                "type": {
                  "const": "market-on-open",
                  "type": "string"
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "limitPrice"
                    ]
                  },
                  {
                    "required": [
                      "stopPrice"
                    ]
                  }
                ]
              }
            },
            {
              "properties": {
                "type": {
                  "const": "market-on-close",
                  "type": "string"
                }
              },
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "limitPrice"
                    ]
                  },
                  {
                    "required": [
                      "stopPrice"
                    ]
                  }
                ]
              }
            },
            {
              "properties": {
                "type": {
                  "const": "limit",
                  "type": "string"
                },
                "limitPrice": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              },
              "required": [
                "limitPrice"
              ],
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "stopPrice"
                    ]
                  }
                ]
              }
            },
            {
              "properties": {
                "type": {
                  "const": "stop",
                  "type": "string"
                },
                "stopPrice": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              },
              "required": [
                "stopPrice"
              ],
              "not": {
                "anyOf": [
                  {
                    "required": [
                      "limitPrice"
                    ]
                  }
                ]
              }
            },
            {
              "properties": {
                "type": {
                  "const": "stop-limit",
                  "type": "string"
                },
                "limitPrice": {
                  "type": "number",
                  "exclusiveMinimum": 0
                },
                "stopPrice": {
                  "type": "number",
                  "exclusiveMinimum": 0
                }
              },
              "required": [
                "limitPrice",
                "stopPrice"
              ]
            }
          ]
        }
      ]
    },
    "Instruments": {
      "type": "object",
      "properties": {
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "contractMultiplier": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "contract": {
          "$ref": "#/$defs/Contract"
        },
        "settlementStyle": {
          "type": "string",
          "enum": [
            "cash-on-trade",
            "variation-margin"
          ]
        },
        "settlementLag": {
          "anyOf": [
            {
              "const": 0,
              "type": "number"
            },
            {
              "const": 1,
              "type": "number"
            },
            {
              "const": 2,
              "type": "number"
            }
          ],
          "description": "T+n 24-hour days in the paper broker; default 0"
        }
      },
      "additionalProperties": false,
      "required": [
        "currency"
      ]
    },
    "Contract": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "option",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            },
            "type": {
              "type": "string",
              "enum": [
                "call",
                "put"
              ]
            },
            "strikePricePerUnit": {
              "type": "number"
            },
            "expiryTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId",
            "type",
            "strikePricePerUnit",
            "expiryTimestampMs"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "future",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            },
            "expiryTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId",
            "expiryTimestampMs"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "perpetual",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId"
          ]
        }
      ]
    },
    "Detail": {
      "type": "object",
      "properties": {
        "quantity": {
          "type": "number"
        },
        "fillId": {
          "type": "string"
        },
        "pricePerUnit": {
          "type": "number"
        },
        "reason": {
          "type": "string"
        },
        "replacementOrderId": {
          "type": "string"
        },
        "artifactHash": {
          "type": "string"
        },
        "note": {
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "Detail2": {
      "type": "object",
      "properties": {
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "fillId": {
          "type": "string",
          "minLength": 1
        },
        "pricePerUnit": {
          "type": "number"
        },
        "reason": {
          "type": "string"
        },
        "replacementOrderId": {
          "type": "string"
        },
        "artifactHash": {
          "type": "string"
        },
        "note": {
          "type": "string"
        },
        "observationTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "fill": {
          "type": "object",
          "properties": {
            "fillId": {
              "type": "string",
              "minLength": 1
            },
            "accountId": {
              "type": "string",
              "minLength": 1
            },
            "instrumentId": {
              "type": "string",
              "minLength": 1
            },
            "side": {
              "type": "string",
              "enum": [
                "buy",
                "sell"
              ]
            },
            "quantity": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "pricePerUnit": {
              "type": "number"
            },
            "currency": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "filledTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            },
            "settleTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            },
            "contractMultiplier": {
              "type": "number",
              "exclusiveMinimum": 0
            },
            "settlementStyle": {
              "type": "string",
              "enum": [
                "cash-on-trade",
                "variation-margin"
              ]
            },
            "contract": {
              "$ref": "#/$defs/Contract"
            },
            "accruedInterest": {
              "type": "number"
            },
            "executionPriceAdjustment": {
              "type": "number",
              "minimum": 0
            },
            "costs": {
              "type": "object",
              "properties": {
                "commission": {
                  "type": "number",
                  "minimum": 0
                },
                "exchangeFees": {
                  "type": "number",
                  "minimum": 0
                },
                "regulatoryFees": {
                  "type": "number",
                  "minimum": 0
                },
                "slippageAdjustment": {
                  "type": "number",
                  "minimum": 0
                }
              },
              "additionalProperties": false
            },
            "orderId": {
              "type": "string",
              "minLength": 1
            },
            "venue": {
              "type": "string"
            },
            "liquidity": {
              "type": "string",
              "enum": [
                "maker",
                "taker",
                "unknown"
              ]
            }
          },
          "additionalProperties": false,
          "required": [
            "fillId",
            "accountId",
            "instrumentId",
            "side",
            "quantity",
            "pricePerUnit",
            "currency",
            "filledTimestampMs"
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "quantity",
        "fillId"
      ]
    },
    "Bids": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "price": {
            "type": "number"
          },
          "size": {
            "type": "number",
            "minimum": 0
          },
          "exchange": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "price",
          "size"
        ]
      }
    }
  }
}
Output schema
{
  "type": "object",
  "properties": {
    "receipt": {
      "type": "object",
      "properties": {
        "kind": {
          "const": "totalfinance.execution-receipt",
          "type": "string"
        },
        "schemaVersion": {
          "const": 1,
          "type": "number"
        },
        "receiptId": {
          "type": "string",
          "minLength": 1
        },
        "planHash": {
          "type": "string",
          "minLength": 1
        },
        "grantHash": {
          "type": "string",
          "minLength": 1
        },
        "idempotencyKey": {
          "type": "string",
          "minLength": 1
        },
        "adapter": {
          "const": "paper",
          "type": "string"
        },
        "accountId": {
          "type": "string",
          "minLength": 1
        },
        "sourceId": {
          "type": "string",
          "minLength": 1
        },
        "submittedAt": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "orders": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Orders"
          }
        },
        "fills": {
          "$ref": "#/$defs/Fills"
        },
        "journalEventIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "assumptions": {
          "type": "object",
          "properties": {
            "conventionsVersion": {
              "type": "string"
            },
            "mode": {
              "const": "paper",
              "type": "string"
            },
            "execution": {
              "type": "object",
              "properties": {
                "label": {
                  "type": "string"
                },
                "realism": {
                  "type": "string",
                  "enum": [
                    "simplified",
                    "declared"
                  ]
                },
                "observation": {
                  "type": "string",
                  "enum": [
                    "bar",
                    "quote",
                    "trade",
                    "order-book"
                  ]
                },
                "fill": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "version": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "label",
                    "version"
                  ]
                },
                "ambiguity": {
                  "type": "string",
                  "enum": [
                    "optimistic",
                    "pessimistic",
                    "deterministic-path",
                    "reject"
                  ]
                },
                "costs": {
                  "type": "object",
                  "properties": {
                    "commission": {
                      "type": "string"
                    },
                    "slippage": {
                      "type": "string"
                    },
                    "spread": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "marketImpact": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "latencySessions": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "participation": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "borrow": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "commission",
                    "slippage",
                    "spread",
                    "marketImpact",
                    "latencySessions",
                    "participation",
                    "borrow"
                  ]
                },
                "staleQuotes": {
                  "type": "object",
                  "properties": {
                    "maximumAgeMs": {
                      "anyOf": [
                        {
                          "type": "number"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "behavior": {
                      "type": "string",
                      "enum": [
                        "reject",
                        "fill-at-last"
                      ]
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "maximumAgeMs",
                    "behavior"
                  ]
                },
                "lockedCrossed": {
                  "type": "string",
                  "enum": [
                    "reject",
                    "fill-at-mid"
                  ]
                },
                "sessions": {
                  "type": "object",
                  "properties": {
                    "halts": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "priceLimits": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "auction": {
                      "anyOf": [
                        {
                          "type": "string",
                          "enum": [
                            "ignore",
                            "open-close-only"
                          ]
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "halts",
                    "priceLimits",
                    "auction"
                  ]
                },
                "partialFills": {
                  "type": "string",
                  "enum": [
                    "allow",
                    "reject"
                  ]
                },
                "queue": {
                  "type": "string",
                  "enum": [
                    "none",
                    "depth-approximation"
                  ]
                },
                "timeInForce": {
                  "type": "object",
                  "properties": {
                    "default": {
                      "type": "string",
                      "enum": [
                        "day",
                        "gtc"
                      ],
                      "description": "Default: the paper execution policy’s day time-in-force"
                    },
                    "expireAtSessionClose": {
                      "type": "boolean"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "default",
                    "expireAtSessionClose"
                  ]
                },
                "margin": {
                  "type": "object",
                  "properties": {
                    "buyingPowerMultiplier": {
                      "type": "number"
                    },
                    "initialMarginRate": {
                      "type": "number"
                    },
                    "maintenanceMarginRate": {
                      "type": "number"
                    },
                    "forcedLiquidation": {
                      "type": "string",
                      "enum": [
                        "none",
                        "close-largest-loss",
                        "pro-rata"
                      ]
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "buyingPowerMultiplier",
                    "initialMarginRate",
                    "maintenanceMarginRate",
                    "forcedLiquidation"
                  ]
                }
              },
              "additionalProperties": false,
              "required": [
                "label",
                "realism",
                "observation",
                "fill",
                "ambiguity",
                "costs",
                "staleQuotes",
                "lockedCrossed",
                "sessions",
                "partialFills",
                "queue",
                "timeInForce",
                "margin"
              ]
            },
            "idempotencyConvention": {
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "conventionsVersion",
            "mode",
            "execution",
            "idempotencyConvention"
          ]
        },
        "diagnostics": {
          "type": "object",
          "properties": {
            "engine": {
              "const": "paper-broker",
              "type": "string"
            },
            "warnings": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "orderCount": {
              "type": "integer",
              "minimum": 0
            },
            "retried": {
              "type": "boolean"
            }
          },
          "additionalProperties": false,
          "required": [
            "engine",
            "warnings",
            "orderCount",
            "retried"
          ]
        },
        "contentHash": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "kind",
        "schemaVersion",
        "receiptId",
        "planHash",
        "grantHash",
        "idempotencyKey",
        "adapter",
        "accountId",
        "sourceId",
        "submittedAt",
        "orders",
        "fills",
        "journalEventIds",
        "assumptions",
        "diagnostics",
        "contentHash"
      ]
    },
    "currentOrders": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Orders"
      },
      "description": "Authoritative journal-derived state and cumulative fills for this receipt, distinct from the immutable submission receipt"
    },
    "retried": {
      "type": "boolean"
    },
    "fills": {
      "$ref": "#/$defs/Fills"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/PortfolioEventEnvelope"
      }
    },
    "recovery": {
      "type": "object",
      "properties": {
        "fills": {
          "$ref": "#/$defs/Fills"
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PortfolioEventEnvelope"
          }
        }
      },
      "additionalProperties": false,
      "required": [
        "fills",
        "events"
      ],
      "description": "Cumulative persisted fills and reproducible ledger events for this receipt; safe to apply idempotently after a lost response. Top-level fills/events remain new deltas."
    },
    "journal": {
      "type": "object",
      "properties": {
        "journalId": {
          "type": "string",
          "minLength": 1
        },
        "appended": {
          "type": "integer",
          "minimum": 0
        },
        "total": {
          "type": "integer",
          "minimum": 0
        }
      },
      "additionalProperties": false,
      "required": [
        "journalId",
        "appended",
        "total"
      ]
    },
    "open": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "expired": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "unfilled": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "orderId": {
            "type": "string",
            "minLength": 1
          },
          "reason": {
            "type": "string",
            "enum": [
              "not-triggered",
              "no-observation",
              "wrong-observation-kind",
              "stale-quote",
              "locked-crossed",
              "halted",
              "zero-quantity",
              "insufficient-depth",
              "already-observed"
            ]
          },
          "detail": {
            "type": "string"
          }
        },
        "additionalProperties": false,
        "required": [
          "orderId",
          "reason",
          "detail"
        ]
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "receipt",
    "currentOrders",
    "retried",
    "fills",
    "events",
    "recovery",
    "journal",
    "open",
    "expired",
    "unfilled"
  ],
  "$id": "https://totalfinance.dev/schemas/trade.submit.output",
  "$defs": {
    "PortfolioEventEnvelope": {
      "allOf": [
        {
          "type": "object",
          "properties": {
            "eventId": {
              "type": "string",
              "minLength": 1
            },
            "schemaVersion": {
              "const": 1,
              "type": "number"
            },
            "sourceId": {
              "type": "string",
              "minLength": 1
            },
            "accountId": {
              "type": "string",
              "minLength": 1
            },
            "effectiveTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            },
            "recordedTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            },
            "correlationId": {
              "type": "string",
              "minLength": 1
            },
            "causationId": {
              "type": "string",
              "minLength": 1
            },
            "reversesEventId": {
              "type": "string",
              "minLength": 1
            },
            "provenance": {
              "type": "object",
              "properties": {
                "provider": {
                  "type": "string"
                },
                "dataset": {
                  "type": "string"
                },
                "asOf": {
                  "type": "number",
                  "description": "Epoch milliseconds"
                },
                "receivedAt": {
                  "type": "number",
                  "description": "Epoch milliseconds"
                },
                "sourceVersion": {
                  "type": "string"
                },
                "requestId": {
                  "type": "string"
                },
                "warnings": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "code": {
                        "type": "string",
                        "minLength": 1
                      },
                      "message": {
                        "type": "string"
                      },
                      "severity": {
                        "type": "string",
                        "enum": [
                          "info",
                          "warn",
                          "error"
                        ]
                      },
                      "context": {
                        "type": "object",
                        "additionalProperties": {}
                      }
                    },
                    "additionalProperties": false,
                    "required": [
                      "code",
                      "message",
                      "severity"
                    ]
                  }
                }
              },
              "additionalProperties": false
            },
            "eventType": {},
            "event": {}
          },
          "additionalProperties": false,
          "required": [
            "eventId",
            "schemaVersion",
            "sourceId",
            "accountId",
            "effectiveTimestampMs",
            "recordedTimestampMs",
            "provenance",
            "eventType",
            "event"
          ]
        },
        {
          "anyOf": [
            {
              "properties": {
                "eventType": {
                  "const": "cash.deposit",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CashDeposit"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "cash.withdrawal",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CashWithdrawal"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "cash.transfer",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CashTransfer"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "cash.conversion",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CashConversion"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "trade.fill",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/TradeFill"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "cost.charge",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CostCharge"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "income.received",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/IncomeReceived"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "financing.charge",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/FinancingCharge"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.split",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateSplit"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.exercise",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeExercise"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.assignment",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeAssignment"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.expiration",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeExpiration"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.multiplier-change",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeMultiplierChange"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.variation-margin",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeVariationMargin"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "derivative.roll",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/DerivativeRoll"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "fixed-income.redemption",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/FixedIncomeRedemption"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.symbol-change",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateSymbolChange"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.merger",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateMerger"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.spin-off",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateSpinOff"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.return-of-capital",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateReturnOfCapital"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "corporate.cash-in-lieu",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/CorporateCashInLieu"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "position.transfer",
                  "type": "string"
                },
                "event": {
                  "$ref": "#/$defs/PositionTransfer"
                }
              }
            },
            {
              "properties": {
                "eventType": {
                  "const": "admin.reversal",
                  "type": "string"
                },
                "event": {
                  "type": "object",
                  "properties": {
                    "eventType": {
                      "const": "admin.reversal",
                      "type": "string"
                    },
                    "original": {
                      "$ref": "#/$defs/PortfolioEventEnvelope"
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "eventType",
                    "original"
                  ]
                }
              },
              "required": [
                "reversesEventId"
              ]
            },
            {
              "properties": {
                "eventType": {
                  "const": "admin.correction",
                  "type": "string"
                },
                "event": {
                  "type": "object",
                  "properties": {
                    "eventType": {
                      "const": "admin.correction",
                      "type": "string"
                    },
                    "original": {
                      "$ref": "#/$defs/PortfolioEventEnvelope"
                    },
                    "replacement": {
                      "anyOf": [
                        {
                          "$ref": "#/$defs/CashDeposit"
                        },
                        {
                          "$ref": "#/$defs/CashWithdrawal"
                        },
                        {
                          "$ref": "#/$defs/CashTransfer"
                        },
                        {
                          "$ref": "#/$defs/CashConversion"
                        },
                        {
                          "$ref": "#/$defs/TradeFill"
                        },
                        {
                          "$ref": "#/$defs/CostCharge"
                        },
                        {
                          "$ref": "#/$defs/IncomeReceived"
                        },
                        {
                          "$ref": "#/$defs/FinancingCharge"
                        },
                        {
                          "$ref": "#/$defs/CorporateSplit"
                        },
                        {
                          "$ref": "#/$defs/DerivativeExercise"
                        },
                        {
                          "$ref": "#/$defs/DerivativeAssignment"
                        },
                        {
                          "$ref": "#/$defs/DerivativeExpiration"
                        },
                        {
                          "$ref": "#/$defs/DerivativeMultiplierChange"
                        },
                        {
                          "$ref": "#/$defs/DerivativeVariationMargin"
                        },
                        {
                          "$ref": "#/$defs/DerivativeRoll"
                        },
                        {
                          "$ref": "#/$defs/FixedIncomeRedemption"
                        },
                        {
                          "$ref": "#/$defs/CorporateSymbolChange"
                        },
                        {
                          "$ref": "#/$defs/CorporateMerger"
                        },
                        {
                          "$ref": "#/$defs/CorporateSpinOff"
                        },
                        {
                          "$ref": "#/$defs/CorporateReturnOfCapital"
                        },
                        {
                          "$ref": "#/$defs/CorporateCashInLieu"
                        },
                        {
                          "$ref": "#/$defs/PositionTransfer"
                        }
                      ]
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "eventType",
                    "original",
                    "replacement"
                  ]
                }
              },
              "required": [
                "reversesEventId"
              ]
            },
            {
              "properties": {
                "eventType": {
                  "const": "admin.account-migration",
                  "type": "string"
                },
                "event": {
                  "type": "object",
                  "properties": {
                    "eventType": {
                      "const": "admin.account-migration",
                      "type": "string"
                    },
                    "fromAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "toAccountId": {
                      "type": "string",
                      "minLength": 1
                    },
                    "reason": {
                      "type": "string"
                    }
                  },
                  "additionalProperties": false,
                  "required": [
                    "eventType",
                    "fromAccountId",
                    "toAccountId"
                  ]
                }
              }
            }
          ]
        }
      ]
    },
    "Orders": {
      "type": "object",
      "properties": {
        "orderId": {
          "type": "string",
          "minLength": 1
        },
        "planHash": {
          "type": "string",
          "minLength": 1
        },
        "state": {
          "type": "string",
          "enum": [
            "submitted",
            "acknowledged",
            "partially-filled",
            "filled",
            "cancelled",
            "rejected",
            "expired",
            "unresolved"
          ]
        },
        "submittedQuantity": {
          "type": "number",
          "minimum": 0
        },
        "filledQuantity": {
          "type": "number",
          "minimum": 0
        },
        "remainingQuantity": {
          "type": "number",
          "minimum": 0
        },
        "averageFillPrice": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "fillIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "lateFillIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "lastEventId": {
          "type": "string",
          "minLength": 1
        },
        "lastTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "terminal": {
          "type": "boolean"
        },
        "cancelRequested": {
          "type": "boolean"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "replacedBy": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "reconciledEventId": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "additionalProperties": false,
      "required": [
        "orderId",
        "planHash",
        "state",
        "submittedQuantity",
        "filledQuantity",
        "remainingQuantity",
        "averageFillPrice",
        "fillIds",
        "lateFillIds",
        "lastEventId",
        "lastTimestampMs",
        "terminal",
        "cancelRequested",
        "reason",
        "replacedBy",
        "reconciledEventId"
      ]
    },
    "Fills": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fillId": {
            "type": "string",
            "minLength": 1
          },
          "accountId": {
            "type": "string",
            "minLength": 1
          },
          "instrumentId": {
            "type": "string",
            "minLength": 1
          },
          "side": {
            "type": "string",
            "enum": [
              "buy",
              "sell"
            ]
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "pricePerUnit": {
            "type": "number"
          },
          "currency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "filledTimestampMs": {
            "type": "number",
            "description": "Epoch milliseconds"
          },
          "settleTimestampMs": {
            "type": "number",
            "description": "Epoch milliseconds"
          },
          "contractMultiplier": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "settlementStyle": {
            "type": "string",
            "enum": [
              "cash-on-trade",
              "variation-margin"
            ]
          },
          "contract": {
            "$ref": "#/$defs/Contract"
          },
          "accruedInterest": {
            "type": "number"
          },
          "executionPriceAdjustment": {
            "type": "number",
            "minimum": 0
          },
          "costs": {
            "type": "object",
            "properties": {
              "commission": {
                "type": "number",
                "minimum": 0
              },
              "exchangeFees": {
                "type": "number",
                "minimum": 0
              },
              "regulatoryFees": {
                "type": "number",
                "minimum": 0
              },
              "slippageAdjustment": {
                "type": "number",
                "minimum": 0
              }
            },
            "additionalProperties": false
          },
          "orderId": {
            "type": "string",
            "minLength": 1
          },
          "venue": {
            "type": "string"
          },
          "liquidity": {
            "type": "string",
            "enum": [
              "maker",
              "taker",
              "unknown"
            ]
          }
        },
        "additionalProperties": false,
        "required": [
          "fillId",
          "accountId",
          "instrumentId",
          "side",
          "quantity",
          "pricePerUnit",
          "currency",
          "filledTimestampMs"
        ]
      }
    },
    "Contract": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "option",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            },
            "type": {
              "type": "string",
              "enum": [
                "call",
                "put"
              ]
            },
            "strikePricePerUnit": {
              "type": "number"
            },
            "expiryTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId",
            "type",
            "strikePricePerUnit",
            "expiryTimestampMs"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "future",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            },
            "expiryTimestampMs": {
              "type": "number",
              "description": "Epoch milliseconds"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId",
            "expiryTimestampMs"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "perpetual",
              "type": "string"
            },
            "underlyingInstrumentId": {
              "type": "string",
              "minLength": 1
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "underlyingInstrumentId"
          ]
        }
      ]
    },
    "CashDeposit": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "cash.deposit",
          "type": "string"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "amount",
        "currency"
      ]
    },
    "CashWithdrawal": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "cash.withdrawal",
          "type": "string"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "amount",
        "currency"
      ]
    },
    "CashTransfer": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "cash.transfer",
          "type": "string"
        },
        "amount": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "fromAccountId": {
          "type": "string",
          "minLength": 1
        },
        "toAccountId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "amount",
        "currency",
        "fromAccountId",
        "toAccountId"
      ]
    },
    "CashConversion": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "cash.conversion",
          "type": "string"
        },
        "fromCurrency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "toCurrency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "fromAmount": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "toAmount": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "fromCurrency",
        "toCurrency",
        "fromAmount",
        "toAmount"
      ]
    },
    "TradeFill": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "trade.fill",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "side": {
          "type": "string",
          "enum": [
            "buy",
            "sell"
          ]
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "pricePerUnit": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        },
        "contractMultiplier": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "settlementStyle": {
          "type": "string",
          "enum": [
            "cash-on-trade",
            "variation-margin"
          ]
        },
        "contract": {
          "$ref": "#/$defs/Contract"
        },
        "accruedInterest": {
          "type": "number"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "side",
        "quantity",
        "pricePerUnit",
        "currency"
      ]
    },
    "LotSelections": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "lotId": {
            "type": "string",
            "minLength": 1
          },
          "quantity": {
            "type": "number",
            "exclusiveMinimum": 0
          }
        },
        "additionalProperties": false,
        "required": [
          "lotId",
          "quantity"
        ]
      },
      "minItems": 1
    },
    "CostCharge": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "cost.charge",
          "type": "string"
        },
        "costType": {
          "type": "string",
          "enum": [
            "commission",
            "exchange-fee",
            "regulatory-fee",
            "slippage-adjustment"
          ]
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "relatesToEventId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "costType",
        "amount",
        "currency"
      ]
    },
    "IncomeReceived": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "income.received",
          "type": "string"
        },
        "incomeType": {
          "type": "string",
          "enum": [
            "dividend",
            "coupon",
            "interest",
            "staking-reward",
            "funding-receipt"
          ]
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "incomeType",
        "amount",
        "currency"
      ]
    },
    "FinancingCharge": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "financing.charge",
          "type": "string"
        },
        "financingType": {
          "type": "string",
          "enum": [
            "margin-interest",
            "borrow-charge",
            "funding-payment"
          ]
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "financingType",
        "amount",
        "currency"
      ]
    },
    "CorporateSplit": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.split",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "sharesAfterSplit": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "sharesBeforeSplit": {
          "type": "number",
          "exclusiveMinimum": 0
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "sharesAfterSplit",
        "sharesBeforeSplit"
      ]
    },
    "DerivativeExercise": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.exercise",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "settlement": {
          "$ref": "#/$defs/Settlement"
        },
        "premiumTreatment": {
          "type": "string",
          "enum": [
            "fold-into-underlying-basis",
            "realize"
          ]
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "quantity",
        "settlement",
        "premiumTreatment"
      ]
    },
    "Settlement": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "physical",
              "type": "string"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind"
          ]
        },
        {
          "type": "object",
          "properties": {
            "kind": {
              "const": "cash",
              "type": "string"
            },
            "settlementPricePerUnit": {
              "type": "number"
            }
          },
          "additionalProperties": false,
          "required": [
            "kind",
            "settlementPricePerUnit"
          ]
        }
      ]
    },
    "DerivativeAssignment": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.assignment",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "settlement": {
          "$ref": "#/$defs/Settlement"
        },
        "premiumTreatment": {
          "type": "string",
          "enum": [
            "fold-into-underlying-basis",
            "realize"
          ]
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "quantity",
        "settlement",
        "premiumTreatment"
      ]
    },
    "DerivativeExpiration": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.expiration",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "quantity"
      ]
    },
    "DerivativeMultiplierChange": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.multiplier-change",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "contractMultiplierAfter": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "strikePricePerUnitAfter": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "reason": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "contractMultiplierAfter"
      ]
    },
    "DerivativeVariationMargin": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.variation-margin",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "settlementPricePerUnit": {
          "type": "number"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "settlementPricePerUnit"
      ]
    },
    "DerivativeRoll": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "derivative.roll",
          "type": "string"
        },
        "fromInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "toInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "closePricePerUnit": {
          "type": "number"
        },
        "openPricePerUnit": {
          "type": "number"
        },
        "contract": {
          "$ref": "#/$defs/Contract"
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "fromInstrumentId",
        "toInstrumentId",
        "quantity",
        "closePricePerUnit",
        "openPricePerUnit"
      ]
    },
    "FixedIncomeRedemption": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "fixed-income.redemption",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "redemptionType": {
          "type": "string",
          "enum": [
            "maturity",
            "call",
            "principal-paydown",
            "sinking-fund"
          ]
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "pricePerUnit": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "redemptionType",
        "quantity",
        "pricePerUnit",
        "currency"
      ]
    },
    "CorporateSymbolChange": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.symbol-change",
          "type": "string"
        },
        "fromInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "toInstrumentId": {
          "type": "string",
          "minLength": 1
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "fromInstrumentId",
        "toInstrumentId"
      ]
    },
    "CorporateMerger": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.merger",
          "type": "string"
        },
        "fromInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "toInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "sharesPerShare": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "cashPerShare": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "fromInstrumentId"
      ]
    },
    "CorporateSpinOff": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.spin-off",
          "type": "string"
        },
        "parentInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "childInstrumentId": {
          "type": "string",
          "minLength": 1
        },
        "sharesPerParentShare": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "basisAllocationFraction": {
          "type": "number"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "parentInstrumentId",
        "childInstrumentId",
        "sharesPerParentShare",
        "basisAllocationFraction"
      ]
    },
    "CorporateReturnOfCapital": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.return-of-capital",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "amountPerShare": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "amountPerShare",
        "currency"
      ]
    },
    "CorporateCashInLieu": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "corporate.cash-in-lieu",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "amount": {
          "type": "number"
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3}$"
        },
        "relatesToEventId": {
          "type": "string",
          "minLength": 1
        },
        "settleTimestampMs": {
          "type": "number",
          "description": "Epoch milliseconds"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "quantity",
        "amount",
        "currency"
      ]
    },
    "PositionTransfer": {
      "type": "object",
      "properties": {
        "eventType": {
          "const": "position.transfer",
          "type": "string"
        },
        "instrumentId": {
          "type": "string",
          "minLength": 1
        },
        "quantity": {
          "type": "number",
          "exclusiveMinimum": 0
        },
        "fromAccountId": {
          "type": "string",
          "minLength": 1
        },
        "toAccountId": {
          "type": "string",
          "minLength": 1
        },
        "lotSelections": {
          "$ref": "#/$defs/LotSelections"
        }
      },
      "additionalProperties": false,
      "required": [
        "eventType",
        "instrumentId",
        "quantity",
        "fromAccountId",
        "toAccountId"
      ]
    }
  }
}

All operations · Setup, handles, jobs & permissions