From 342173f8523288e27bf86629c7d4ee64daa1eb1c Mon Sep 17 00:00:00 2001 From: Nathan Emery Date: Thu, 29 Sep 2022 13:12:09 +0100 Subject: [PATCH] #644 | Add Order and OrderLeg Context Types --- CHANGELOG.md | 1 + docs/context/ref/Order.md | 36 ++++ docs/context/ref/OrderLeg.md | 50 ++++++ src/context/schemas.json | 2 + src/context/schemas/order.schema.json | 44 +++++ src/context/schemas/orderLeg.schema.json | 166 ++++++++++++++++++ website/sidebars.json | 2 + website/static/schemas/next/order.schema.json | 44 +++++ .../static/schemas/next/orderLeg.schema.json | 166 ++++++++++++++++++ 9 files changed, 511 insertions(+) create mode 100644 docs/context/ref/Order.md create mode 100644 docs/context/ref/OrderLeg.md create mode 100644 src/context/schemas/order.schema.json create mode 100644 src/context/schemas/orderLeg.schema.json create mode 100644 website/static/schemas/next/order.schema.json create mode 100644 website/static/schemas/next/orderLeg.schema.json diff --git a/CHANGELOG.md b/CHANGELOG.md index 6da619edf..64f32817a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] ### Added +* Added a context type representing an Order (`fdc3.order`). ([]()) ### Changed diff --git a/docs/context/ref/Order.md b/docs/context/ref/Order.md new file mode 100644 index 000000000..55ee20f03 --- /dev/null +++ b/docs/context/ref/Order.md @@ -0,0 +1,36 @@ +--- +id: Order +sidebar_label: Order +title: Order +hide_title: true +--- +# `Order` + +A context type representing the details of an order, which may be used to transmit a new order to a third party or share details of an existing order. + +When the intenet is to create an Order in a downstream system at least one OrderLeg MUST be populated. + +When the intent is to lookup an Order in a downstream system at least one entry MUST be populated in the id field and other fields are not required. + +## Type + +`fdc3.order` + +## Schema + +https://fdc3.finos.org/scehmas/next/order.schema.json + +## Details + +| Property| Type| Required| Example +| -| -| -| - +| `id` | object | Yes | `{'OMS': '123456789'}` +| `id.OMS` | string | No | `'123456789'` +| `id.EMS` | string | No | `'EMSID1234'` +| `id.PMS` | string | No | `'PMS12345'` +| `sendingTime` | string | Yes | `'2022-03-30T15:44:44+00:00'` +| `timeInForce` | fdc3.timeRange| No | `{type: "fdc3.timeRange", startTime: "2020-09-01T08:00:00.000Z", endTime: "2020-10-31T08:00:00.000Z"}` +| `orderLegs` | fdc3.orderLeg[] | Yes | +| `notes` | String | No + + diff --git a/docs/context/ref/OrderLeg.md b/docs/context/ref/OrderLeg.md new file mode 100644 index 000000000..568ae73c2 --- /dev/null +++ b/docs/context/ref/OrderLeg.md @@ -0,0 +1,50 @@ +--- +id: OrderLeg +sidebar_label: OrderLeg +title: OrderLeg +hide_title: true +--- +# `OrderLeg` + +A context type representing the details of an individual order leg, which MAY be used as part of an Order context when creating a new Order and MAY be transmitted separately to look up details of an existing OrderLeg. + +When the OrderLeg is part of an Order context with the intent to CREATE a new Order fields MUST be populated as indicated. + +When the intent is to lookup an OrderLeg in a downstream system at least one entry MUST be populated in the id field and other fields are NOT required. + +## Type + +`fdc3.orderLeg` + +## Schema + +https://fdc3.finos.org/scehmas/next/orderLeg.schema.json + +| Property| Type| Required| Example +| -| -| -| - +| `type` | String | Yes | `fdc3.orderLeg` +| `id` | object | Yes | `{'OMS': '123456789-leg1'}` +| `product` | object | Yes | `{'instrument': {'ticker':'MSFT'}} \| {'productDefinition': '...'}` +| `product.instrument` | fdc3.Instrument | No | `{'instrument': {'ticker':'MSFT'}}` +| `product.productDefinition` | object | No | `{'productDefinition': '...'}` +| `quantity` | object | Yes | `{'units': 100000.00}` +| `quantity.units` | double | No | `1000000.00` +| `quantity.cashValue` | double | No | `5000000.00` +| `quantity.proceedsFrom` | string | No | `{'OMS': '123456789-leg2'}` +| `currency` | fdc3.currency | No | `{type: 'fdc3.currency', name: 'US Dollar', id: {CURRENCY_ISOCODE: "USD"}}` +| `side` | string | Yes | `'B' \| 'S' \| 'P' \| 'R'...` +| `price` | object | Yes | `{'orderType': 'limit', 'limitPrice': 123.45}` +| `price.priceType` | string | No | `'absolute' \| 'percentage' \| 'yield' \| 'spread'...` +| `price.orderType` | string | Yes | `'limit' \| 'market' \| 'stopMarket' \| 'stopLimit'...` +| `price.limitPrice` | double | No | `1.15` +| `price.stopPrice` | double | No | `1.20` +| `settlement` | object | No | `{currency: {type: 'fdc3.currency', name: 'Pound Sterling', id: {CURRENCY_ISOCODE: "GBP"}, 'date': '2022-03-30T15:44:44+00:00'}` +| `settlement.currency` | fdc3.currency | No | `{type: 'fdc3.currency', name: 'Pound Sterling', id: {CURRENCY_ISOCODE: "GBP"}` +| `settlement.date` | string | No | `'2022-03-30T15:44:44+00:00'` +| `allocations` | object[] | No | `[{'account': 'TRADEACCOUNT1', 'quantity': 1000000.00, 'positionEffect': 'O'}]` +| `allocations[i].account` | string | Yes | `TRADEACCOUNT1` +| `allocations[i].quantity` | double | No | `1000000.00` +| `allocations[i].positionEffect` | string | No | `'O' \| 'C'` +| `partyIdentifiers` | object[] | No | `[{'role': 'executingFirm', 'id': {'LEI': '549300UO56I4KIWC0U51'}]` +| `partyIdentifiers[i].role` | string | Yes | `'executingFirm'` +| `partyIdentifiers[i].id` | string | Yes | `{'LEI': '549300UO56I4KIWC0U51'}` diff --git a/src/context/schemas.json b/src/context/schemas.json index 4310f348d..3e2bf1b70 100644 --- a/src/context/schemas.json +++ b/src/context/schemas.json @@ -10,6 +10,8 @@ "Instrument": ["https://fdc3.finos.org/schemas/next/instrument.schema.json"], "InstrumentList": ["https://fdc3.finos.org/schemas/next/instrumentList.schema.json"], "Nothing": ["https://fdc3.finos.org/schemas/next/nothing.schema.json"], + "Order": ["https://fdc3.finos.org/schemas/next/order.schema.json"], + "OrderLeg": ["https://fdc3.finos.org/schemas/next/orderLeg.schema.json"], "Organization": ["https://fdc3.finos.org/schemas/next/organization.schema.json"], "Portfolio": ["https://fdc3.finos.org/schemas/next/portfolio.schema.json"], "Position": ["https://fdc3.finos.org/schemas/next/position.schema.json"], diff --git a/src/context/schemas/order.schema.json b/src/context/schemas/order.schema.json new file mode 100644 index 000000000..ccbf58ad5 --- /dev/null +++ b/src/context/schemas/order.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/order.schema.json", + "type": "object", + "title": "Order", + "allOf": [ + { + "$ref": "context.schema.json#" + } + ], + "properties": { + "type": { + "const": "fdc3.order" + }, + "id": { + "properties": { + "EMS": { + "type": "string" + }, + "OMS": { + "type": "string" + }, + "PMS": { + "type": "string" + } + } + }, + "sendingTime": { + "type": "string" + }, + "timeInForce": { + "$ref": "timerange.schema.json#" + }, + "orderLegs": { + "type": "array", + "items": { + "$ref": "orderLeg.schema.json#" + } + }, + "notes": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/src/context/schemas/orderLeg.schema.json b/src/context/schemas/orderLeg.schema.json new file mode 100644 index 000000000..f4642eba2 --- /dev/null +++ b/src/context/schemas/orderLeg.schema.json @@ -0,0 +1,166 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/orderLeg.schema.json", + "type": "object", + "title": "orderLeg", + "allOf": [ + { + "$ref": "context.schema.json#" + } + ], + "properties": { + "type": { + "const": "fdc3.orderLeg" + }, + "id": { + "properties": { + "EMS": { + "type": "string" + }, + "OMS": { + "type": "string" + }, + "PMS": { + "type": "string" + } + } + }, + "product": { + "type": "object", + "properties": { + "oneof": { + "instrument": { + "$ref": "instrument.schema.json#" + }, + "productDefinition": { + "type": "object" + } + } + } + }, + "quantity": { + "type": "object", + "properties": { + "oneof": { + "units": { + "type": "number" + }, + "cashValue": { + "type": "number" + }, + "proceedsFrom": { + "type": "string" + } + } + } + }, + "currency": { + "$ref": "currency.schema.json#" + }, + "side": { + "type": "string", + "enum": [ + "B", + "S", + "P", + "R", + "BS", + "SS" + ] + }, + "price": { + "type": "object", + "properties": { + "orderType": { + "type": "string", + "enum": [ + "limit", + "market", + "stopMarket", + "stopLimit" + ] + }, + "limitPrice": { + "type": "number" + }, + "stopPrice": { + "type": "number" + }, + "priceType": { + "type": "string", + "enum": [ + "absolute", + "percentage", + "yield", + "spread" + ] + } + }, + "required": [ + "orderType" + ] + }, + "settlement": { + "type": "object", + "properties": { + "currency": { + "$ref": "currency.schema.json#" + }, + "date": { + "type": "string" + } + } + }, + "allocations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "quantity": { + "type": "number" + }, + "positionEffect": { + "type": "string", + "enum": [ + "O", + "C" + ] + } + }, + "required": [ + "account" + ] + } + }, + "partyIdentifiers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "id": { + "type": "object", + "properties": { + "LEI": { + "type": "string" + } + } + } + } + } + } + }, + "required": [ + "type", + "id", + "price", + "side", + "product", + "quantity" + ] +} \ No newline at end of file diff --git a/website/sidebars.json b/website/sidebars.json index 2c0a3395e..970e28a7d 100644 --- a/website/sidebars.json +++ b/website/sidebars.json @@ -70,6 +70,8 @@ "context/ref/Instrument", "context/ref/InstrumentList", "context/ref/Nothing", + "context/ref/Order", + "context/ref/OrderLeg", "context/ref/Organization", "context/ref/Portfolio", "context/ref/Position", diff --git a/website/static/schemas/next/order.schema.json b/website/static/schemas/next/order.schema.json new file mode 100644 index 000000000..ccbf58ad5 --- /dev/null +++ b/website/static/schemas/next/order.schema.json @@ -0,0 +1,44 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/order.schema.json", + "type": "object", + "title": "Order", + "allOf": [ + { + "$ref": "context.schema.json#" + } + ], + "properties": { + "type": { + "const": "fdc3.order" + }, + "id": { + "properties": { + "EMS": { + "type": "string" + }, + "OMS": { + "type": "string" + }, + "PMS": { + "type": "string" + } + } + }, + "sendingTime": { + "type": "string" + }, + "timeInForce": { + "$ref": "timerange.schema.json#" + }, + "orderLegs": { + "type": "array", + "items": { + "$ref": "orderLeg.schema.json#" + } + }, + "notes": { + "type": "string" + } + } +} \ No newline at end of file diff --git a/website/static/schemas/next/orderLeg.schema.json b/website/static/schemas/next/orderLeg.schema.json new file mode 100644 index 000000000..f4642eba2 --- /dev/null +++ b/website/static/schemas/next/orderLeg.schema.json @@ -0,0 +1,166 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "$id": "https://fdc3.finos.org/schemas/next/orderLeg.schema.json", + "type": "object", + "title": "orderLeg", + "allOf": [ + { + "$ref": "context.schema.json#" + } + ], + "properties": { + "type": { + "const": "fdc3.orderLeg" + }, + "id": { + "properties": { + "EMS": { + "type": "string" + }, + "OMS": { + "type": "string" + }, + "PMS": { + "type": "string" + } + } + }, + "product": { + "type": "object", + "properties": { + "oneof": { + "instrument": { + "$ref": "instrument.schema.json#" + }, + "productDefinition": { + "type": "object" + } + } + } + }, + "quantity": { + "type": "object", + "properties": { + "oneof": { + "units": { + "type": "number" + }, + "cashValue": { + "type": "number" + }, + "proceedsFrom": { + "type": "string" + } + } + } + }, + "currency": { + "$ref": "currency.schema.json#" + }, + "side": { + "type": "string", + "enum": [ + "B", + "S", + "P", + "R", + "BS", + "SS" + ] + }, + "price": { + "type": "object", + "properties": { + "orderType": { + "type": "string", + "enum": [ + "limit", + "market", + "stopMarket", + "stopLimit" + ] + }, + "limitPrice": { + "type": "number" + }, + "stopPrice": { + "type": "number" + }, + "priceType": { + "type": "string", + "enum": [ + "absolute", + "percentage", + "yield", + "spread" + ] + } + }, + "required": [ + "orderType" + ] + }, + "settlement": { + "type": "object", + "properties": { + "currency": { + "$ref": "currency.schema.json#" + }, + "date": { + "type": "string" + } + } + }, + "allocations": { + "type": "array", + "items": { + "type": "object", + "properties": { + "account": { + "type": "string" + }, + "quantity": { + "type": "number" + }, + "positionEffect": { + "type": "string", + "enum": [ + "O", + "C" + ] + } + }, + "required": [ + "account" + ] + } + }, + "partyIdentifiers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "role": { + "type": "string" + }, + "id": { + "type": "object", + "properties": { + "LEI": { + "type": "string" + } + } + } + } + } + } + }, + "required": [ + "type", + "id", + "price", + "side", + "product", + "quantity" + ] +} \ No newline at end of file