Order table

Table Name: Order
Supports: SELECT, INSERT, UPDATE, DELETE
Permissions (SELECT): Zenith/Trading
Permissions (INSERT/UPDATE/DELETE): Zenith/OrderPad\

Provides access to the Order Book and Order Management operations for the user.

SELECT

Allows viewing of the current Orders for the user.

Columns

Name Type Allows Description
Account String IS, IN The Trading Account of the Order.
BrokerageSchedule String The Brokerage Schedule associated with this Order.
Class String The class of Order, which should correspond to the Class for the associated Symbol. One of the following values:
Market.
ManagedFund.
CreatedDate DateTime The date and time the Order was created.
Currency String The currency the Order is traded in.
CurrentBrokerage Number The current brokerage that has been charged for this Order.
CurrentTax Number The current tax that has been charged for this Order.
CurrentValue Number The current executed value of this Order.
DepthOrderID String The unique identifier of the Order in the Full Market Depth for the corresponding Symbol.
EstimatedBrokerage Number The estimated brokerage of this Order when processed.
EstimatedTax Number The estimated tax on this Order when processed.
EstimatedValue Number The estimated total value of this Order.
Exchange String IS, IN The Exchange the Symbol was issued by.
ExternalID String An identifier provided by the Exchange for this Order. May differ from OrderID, and may change.
Instructions Array An array of Execution Instruction codes for this Order.
OnExchange String The Exchange the Order is currently placed on.
OrderID String IS, IN The unique identifier of the Order. Will not change for the life of the Order.
Route String The routing algorithm for this Order.
Side String The side of the market the Order belongs to. One of the following values:
Bid – Buy Order.
Ask – Sell Order.
Status String The status code of the Order. See the OrderStatus table to retrieve the valid Order Status codes.
StopPrice Number The current Stop Loss price for this Order.
StopDirection String The direction in which the Stop Loss price will trigger.
StopReference String The reference price for triggering the Stop Loss.
Symbol String IS, BEGINS, CONTAINS The code assigned by the Symbol Issuer.
SymbolCode String IS, IN The combined Symbol and Exchange codes, eg: Symbol.Exchange. Not included in *.
TradingMarket String The Trading Market the order is currently placed in.
UpdatedDate DateTime The date and time the Order was last updated.

The following columns apply to Orders with the Market Style:

Name Type Allows Description
AveragePrice Number The average price of the executed shares. Null if the order has yet to trade.
ExecutedQuantity Number The number of shares that have been executed.
ExpiryDate DateTime The expiry date of the Order. Omit to last until cancelled.
HiddenQuantity Number The number of hidden shares involved in the Order.
LimitPrice Number The price to place the Order at. Valid for Limit only.
MinimumQuantity Number The minimum quantity to shares for this Order to execute. Only supported on some markets
Type String The Order Type of the Order. One of the following values:
Limit.
Market.
MarketToLimit
Validity String The validity criteria for the Order. One of the following values:
UntilCancel – Order exists until cancelled or the Expiry date is hit.
FillAndKill – Trades as much as possible then cancels. Also known as Immediate-or-Cancel.
FillOrKill – Trades the entire quantity immediately, or cancels.
AllOrNone – Only executes when it can trade the entire quantity. Exists until cancelled or the Expiry date is hit.
VisibleQuantity Number The number of visible shares involved in the Order.

Examples

Select all Orders for a Trading Account:

SELECT OrderID FROM Order WHERE Account = '123[Demo]'

Select a specific Order:

SELECT * FROM Order WHERE OrderID = 'ABCD4'

Select three specific Orders:

SELECT * FROM Order WHERE OrderID IN ['ABCD4', 'ABCD5', 'ABCD6']

INSERT/UPDATE/DELETE

Allows placement, amendment, movement, or cancellation of Orders.

All operations only manipulate a single order at a time.

  • Account is required in the SET statement for INSERT, and the WHERE statement for all other operations.
  • OrderID is required in the WHERE statement for all operations except INSERT.
  • Either SymbolCode, or both Exchange and Symbol, are required during INSERT.
  • Side is required during INSERT.

Columns

Name Type Set Where Description
Account String I/U U/D The Trading Account of the Order.
BrokerageSchedule String I/U The Brokerage Schedule associated with this Order.
Class String I The style of Order, which should correspond to the Class for the associated Symbol. If omitted, defaults to Market. One of the following values:
Market.
ManagedFund.
Exchange String I The Exchange the Symbol was issued by.
Flags Array I/U/D An array of Flags for this Request.
Instructions Array I/U An array of Execution Instruction codes for this Order.
OrderID String U/D The unique identifier of the Order. Will not change for the life of the Order.
RequestID String I/U/D The unique identifier used by this Request. If omitted, a random ID will be assigned.
Route String I/U The routing algorithm for this Order.
Side String I The side of the market the Order belongs to. One of the following values:
Bid – Buy Order.
Ask – Sell Order.
StopPrice Decimal I/U The current Stop Loss price for this Order.
StopDirection String I/U The direction in which the Stop Loss price will trigger.
StopReference String I/U The reference price for triggering the Stop Loss.
Symbol String I The code assigned by the Symbol Issuer.
SymbolCode String I The combined Symbol and Exchange codes, eg: Symbol.Exchange. Not included in *.
TradingMarket String I/U The Trading Market the order is to be routed to.

The following columns apply to Orders with the Market Style:

Name Type Set Where Description
ExpiryDate DateTime I/U The expiry date of the Order. Omit to last until cancelled.
HiddenQuantity Integer I/U The number of hidden shares involved in the Order.
LimitPrice Decimal I/U The price to place the Order at. Valid for Limit only.
MinimumQuantity Integer I/U The minimum quantity to shares for this Order to execute. Only supported on some markets
Type String I The Order Type of the Order. One of the following values:
Limit.
Market.
MarketToLimit
Validity String I/U The validity criteria for the Order. One of the following values:
UntilCancel – Order exists until cancelled or the Expiry date is hit. Default if none supplied.
FillAndKill – Trades as much as possible then cancels. Also known as Immediate-or-Cancel.
FillOrKill – Trades the entire quantity immediately, or cancels.
AllOrNone – Only executes when it can trade the entire quantity. Exists until cancelled or the Expiry date is hit.
VisibleQuantity Integer I/U The number of visible shares involved in the Order.

Result Columns

Name Type Description
Result String The result of the operation. One of the following values:
Success – Request successful.
Incomplete – Required fields are missing.
Invalid – The supplied fields are invalid.
Rejected – The order was rejected by the Exchange.
OrderID String If the request was successful, supplies the unique identifer of the new Order.
Errors Array If execution failed, supplies an array of string codes identifying the errors encountered.
EstimatedBrokerage Decimal If able to be calculated, provides the estimated brokerage this Order would incur.
EstimatedTax Decimal If able to be calculated, provides the estimated tax this Order would incur.
EstimatedValue Decimal If able to be calculated, provides the estimated value of this Order, not including Brokerage or Tax (ie: Net Consideration).

Examples

Place a new Order:

INSERT INTO Order SET Account = '123ABC', Symbol = 'BHP', Exchange = 'ASX', TradingMarket = 'CXA::LI', Type = 'Limit', Quantity = 100, LimitPrice = 5.01

Amend an existing Order:

UPDATE Order SET Quantity = 200 WHERE Account = '123ABC' AND OrderID = 'XYZ'

Move an Order to a different Trading Account:

UPDATE Order SET Account = '456DEF' WHERE Account = '123ABC' AND OrderID = 'XYZ'

Cancel an Order:

DELETE FROM Order WHERE Account = '123ABC' AND OrderID = 'XYZ'