CreateOrder

Attributes

ObjectId

See ‘object-id’ in object-type: order.

Optional

Action
See ‘action’ in object-type: order.
OrderType
See ‘order-type’ in object-type: order.
FirmId
See ‘firm-id’ in object-type: order.
Cusip

See ‘cusip’ in object-type: order.

Optional

Isin

See ‘isin’ in object-type: order.

Optional

Quantity
See ‘quantity’ in object-type: order.
Status
See ‘status’ in object-type: order.
LimitPrice
See ‘limit-price’ in object-type: order.
LimitYield
See ‘limit-yield’ in object-type: order.

JSON Examples

Example 1:

{
    "UpdateType": "CreateOrder",
    "Action": "Buy",
    "OrderType": "Limit",
    "FirmId": "OBJECT_ID",
    "Isin": "US00206RDA77",
    "Quantity": 1000,
    "LimitPrice": "98-05.875",
    "LimitYield": 0.015
}

Example 2:

{
    "UpdateType": "CreateOrder",
    "Action": "Sell",
    "OrderType": "Market",
    "FirmId": "OBJECT_ID",
    "Isin": "US00206RDA77",
    "Quantity": 1000
}

check_valid()

The following checks are performed:

  • Check that all required attributes have been provided.
  • Check that all provided unique attributes do not exist in the store.
  • Check that FirmId is a valid object-id of type organization.
  • Check that one of Cusip or Isin is provided, and points to a valid bond. If both are provided, they must point to the same bond.

apply()

Create a new object in the store with object-type of ‘order’. The default for status should be set to ‘Open’.

Increment the ref-count of the corresponding organization and bonds.