# Place order

Place a new order. You can place various types of order such as limit, market, at best, previously quoted, stop, algo, pegged, and more. Under algo orders you can execute various strategies such as TWAP.

Returns status code 202 if your order is accepted by the system for processing. Use the query order endpoints to get the current status of your order Query order (client ID or all active orders) or Query order (server ID).

You can get all trades associated with an order using Query all trades on an order by ID. Trades contain information like counterparty, settlement date, and amount.

### Required request attributes for all order types

All place-order requests must have the following attributes:
- coId
- type
- side
- symbol
- size
- currency

### Conditionally required request attributes and values

Your request may require additional attributes based on the order type or attribute values.

For example, if you place an order with timeInForce=GTT (good-til-canceled) you must also specify expiryTime. 

| Order type | Required attributes and values |
|-|-|
| Limit(IOC) | type=Limit, timeInForce=IOC, price |
| Limit(GTC) | type=Limit, timeInForce=GTC, price |
| Limit(GTT) | type=Limit, timeInForce=GTT, expiryTime, price |
| Market(IOC) | type=Market, timeInForce=IOC, price |
| At best | type=AtBest, timeInForce=FOK, valueDate |
| Stop | type=Stop, price, stopPrice, execFlags=BidTrigger&vert;OfferTrigger&vert;MidTrigger |
| Previously quoted | type=PQ, timeInForce=FOK, price, rateId |
| Algo (TWAP) | type=Algo, timeInForce=GTC, targetStrategy |
| On behalf of | price, org, account |

Endpoint: POST /v2/orders
Version: 1.0.1
Security: SSO_TOKEN

## Request fields (application/json):

  - `coId` (string, required)
    Client order ID assigned by the API user.

  - `rateId` (string)
    Unique identifier for rate. Required for Previously Quoted Orders.

  - `type` (string, required)
    - Limit
- AtBest
- Market
- Stop
- StopLimit
- Pegged
- Algo
- PQ (previously quoted)

  - `side` (string, required)
    Buy or Sell from the order placer’s perspective and always for the dealt currency.

  - `symbol` (string, required)
    Base and term currency separated by a slash / (for example EUR/USD).

  - `size` (number, required)
    Order amount.

  - `currency` (string, required)
    Dealt currency.

  - `price` (number)
    Order’s requested limit price.

  - `priceType` (string)
    Optional for At Best orders.
* Spot
* Outright
* NDF

  - `timeInForce` (string)
    - GTC
- IOC
- FOK (required for at-best orders)
- GTT (must specify expiryTime)
- DAY

  - `org` (string)
    Organization ID in Integral's system. If the order iss placed on behalf of another organization, this parameter contains the other organization's ID.

  - `account` (string)
    The ID of the account (legal entity) for which the order iss placed. Required when placing orders on behalf of another organization.

  - `expiryTime` (integer)
    Expiry time when timeInForce=GTT. In seconds. Max value is one day (86399 seconds).

  - `valueDate` (string)
    Value date in the format YYYY-MM-DD. Required for at-best orders.

  - `stopPrice` (number)
    Order’s stop price (if any).

  - `execFlags` (array)
    Execution strategy requested with order:
- BidTrigger: Stay on bid side
- MidTrigger: Mid price
- OfferTrigger: Stay on offer side

  - `minQty` (number)
    Minimum fill size (if any) in dealt currency.

  - `maxShow` (number)
    Amount of the order visible to other market participants:
- 0 (zero) or undefined: Hidden: Order is not visible to other customers.
- Equal to size: Display: Full order amount visible to other customers.
- Less than size: Iceberg: Only the value of maxShow visible.

  - `targetStrategy` (string)
    (Algo) The algo or strategy of the order:
- Mid
- Fixing
- Twap
- LitSwitch
- DarkSwitch

  - `executionStartTime` (string)
    (Algo) Relative time at which the strategy should start execution specified in the format HH:MM:SS.sss. If not specified, the strategy starts executing immediately.

  - `executionEndTime` (string)
    (Algo) Absolute time in GMT at which the strategy should stop executing. If not specified, the order expires based on the value of its time in force.

  - `pegPriceType` (string)
    The rate the order is pegged to:
- Mid: Pegged to mid rate.

  - `pegOffsetValue` (number)
    The amount in pips that is added to the price of the peg. Can be positive or negative.

  - `actionOnExpiry` (string)
    (Algo) Action taken at the end of the algo’s duration if there is an unfilled amount remaining. If not specified, the order is cancelled at expiration. NoAction, FillAtMarket, Twap

  - `sliceSize` (number)
    (Algo) The fixed size of each slice.

  - `passiveTime` (integer)
    (Algo) Time for which each slice rests in OCX RiskNet. Specified in milliseconds. Overrides passiveTimeFactor.

  - `passiveTimeFactorPercentage` (number)
    (Algo) Determines how long each slice rests in OCX RiskNet, calculated as a percent of the actual slice interval. Required if passiveTime is not set

  - `sliceInterval` (integer)
    (Algo) Interval between slices in milliseconds. If the interval is fixed, this value is the interval duration. If the interval is randomized, this value is the upper boundary of random values.

  - `randomizeSliceSizePercentage` (number)
    (Algo) The percentage range that the sliceSize is randomized.

  - `randomizeSliceIntervalPercentage` (number)
    (Algo) The percentage range that the sliceInterval is randomized.

  - `tobRange` (number)
    (Algo) If sliceSize undefined, the slice size is this percentage of the top-of-book price size.

  - `customParameters` (object)
    Collection of parameters that are unique to your organization. The number of parameters, their keynames, and values are defined by you.

Contact your Integral Technical Account Manager to enable and configure custom parameters.

Your custom parameters are included in API responses and in STP trade download.

Custom parameters sent to Integral via API are stored in the database directly. No validation is performed.

The maximum size of the customParameter property is 3500 characters, including all keys, values, and JSON syntax characters.

  - `customParameters.keyName` (string)
    The keyname of a custom parameter key/value pair as defined by your organization. Contact your Integral Technical Account Manager to enable and configure custom parameters.

  - `customParameters.value` (string)
    The value of a custom parameter key/value pair as defined by your organization. Contact your Integral Technical Account Manager to enable and configure custom parameters.

## Response 202 fields (application/json):

  - `coId` (string, required)
    Client order ID assigned by the API user.

  - `type` (string, required)
    - Limit
- AtBest
- Market
- Stop
- StopLimit
- Pegged
- Algo
- PQ (previously quoted)

  - `timeInForce` (string, required)
    - GTC
- IOC
- FOK
- GTT
- DAY

  - `side` (string, required)
    Buy or Sell from the order placer’s perspective and always for the dealt currency.

  - `currency` (string, required)
    Dealt currency.

  - `symbol` (string, required)
    Base and term currency separated by a slash / (for example EUR/USD).

  - `size` (number, required)
    Order amount.

  - `rateId` (string)
    Unique identifier for rate. Required for Previously Quoted Orders.

  - `org` (string)
    Organization ID in Integral's system. If the order was placed on behalf of another organization, this parameter contains the other organization's ID.

  - `account` (string)
    The ID of the account (legal entity) for which the order was placed. Required when placing orders on behalf of another organization.

  - `price` (number)
    Order’s limit price, if any.

  - `priceType` (string)
    Optional for At Best orders.
* Spot
* Outright
* NDF

  - `expiryTime` (integer)
    Expiry time when timeInForce=GTT. In seconds. Max value is one day (86399 seconds).

  - `clientOrderTime` (string)
    Time the order was submitted in the format yyyy-MM-dd HH:mm:ss,SSS Z.

  - `tradeChannel` (string)
    The app or workflow that originated the order.

  - `targetStrategy` (string)
    Algo: The algo or strategy of the order:
- Mid
- Fixing
- Twap
- LitSwitch
- DarkSwitch

  - `originalCoId` (string)
    The original client order ID of the order to be cancelled or replaced by this request.

  - `stopPrice` (number)
    Order’s stop price (if any).

  - `execFlags` (array)
    Execution strategy requested with order:
- BidTrigger: Stay on bid side
- MidTrigger: Mid price
- OfferTrigger: Stay on offer side

  - `minQty` (number)
    Minimum fill size (if any) in dealt currency.

  - `maxShow` (number)
    Amount of the order visible to other market participants:
- 0 (zero) or undefined: Hidden: Order is not visible to other customers.
- Equal to size: Display: Full order amount visible to other customers.
- Less than size: Iceberg: Only the value of maxShow visible.

  - `averagePrice` (number)
    Average price of all fills so far. For orders and order types with timeInForce=FOK such as at-best orders, this is the filled price.

  - `cumQty` (number)
    Total cumulative amount filled so far.

  - `orderId` (string)
    Order ID assigned by Integral.

  - `valueDate` (string)
    Value date in the format YYYY-MM-DD.

  - `tradeDate` (string)
    Trade date of fill.

  - `executionType` (string)
    - CANCELED
- NEW
- PARTIAL_FILL
- PENDING_NEW
- TRADE

  - `leavesQty` (number)
    Unfilled amount as of the most recent fill.

  - `counterparty` (string)
    Counterparty organization ID.

  - `counterPartyAccount` (string)
    Counterparty legal entity ID.

  - `transactTime` (integer)
    UTC time of last event on the order in milliseconds.

  - `userFullName` (string)
    Fully qualified user name of order submitting user, including namespace and organization ID in the format userName@namespace.orgID.

  - `action` (string)
    - place
- cancel
- cancelAll

  - `status` (string)
    - RECEIVED: Order received.
- NEW: Order has been entered and is working according to the order type and specified execution strategy.
- PARTIALLY_FILLED: Trade done that does not completely fill the order.
- FILLED: Trade done that completely fills the order.
- PENDING_CANCEL: Cancel order request has been received and is in process.
- CANCELED:  Order has been canceled.
- REPLACED:  Order has been replaced with a new order.
- STOPPED: Price matching has been paused for the order.
- REJECTED: Order has been rejected.
- EXPIRED: Order expired.
- FAILED: Order failed.

  - `reason` (string)
    Orders with status=FAILED or status=REJECTED, the reason for failure or rejection. INTERNAL_SERVER_ERROR indicates a serious error. Stop trading immediately and contact Business Support to resolve the issue.

  - `customerId` (string)
    Customer ID on whose behalf the order is placed.

  - `executionStartTime` (string)
    Relative time at which the strategy should start execution specified in the format HH:MM:SS.sss. If not specified, the strategy starts executing immediately.

  - `executionEndTime` (string)
    Absolute time in GMT at which the strategy should stop executing. If not specified, the order expires based on the value of its time in force.

  - `pegPriceType` (string)
    The rate the order is pegged to:
- Mid: Pegged to mid rate.

  - `pegOffsetValue` (number)
    The amount in pips that is added to the price of the peg. Can be positive or negative.

  - `actionOnExpiry` (string)
    Action taken at the end of the algo’s duration if there is an unfilled amount remaining. If not specified, the order is cancelled at expiration. NoAction, FillAtMarket, Twap

  - `sliceSize` (number)
    The fixed size of each slice.

  - `passiveTime` (integer)
    Time for which each slice rests in OCX RiskNet. Specified in milliseconds. Overrides passiveTimeFactor.

  - `passiveTimeFactorPercentage` (number)
    Determines how long each slice rests in OCX RiskNet, calculated as a percent of the actual slice interval. Required if passiveTime is not set

  - `sliceInterval` (integer)
    Interval between slices in milliseconds. If the interval is fixed, this value is the interval duration. If the interval is randomized, this value is the upper boundary of random values.

  - `randomizeSliceSizePercentage` (number)
    The percentage range that the sliceSize is randomized.

  - `randomizeSliceIntervalPercentage` (number)
    The percentage range that the sliceInterval is randomized.

  - `tobRange` (number)
    If sliceSize undefined, the slice size is this percentage of the top-of-book price size.

  - `customParameters` (object)
    Collection of parameters that are unique to your organization. The number of parameters, their keynames, and values are defined by you.

Contact your Integral Technical Account Manager to enable and configure custom parameters.

Your custom parameters are included in API responses and in STP trade download.

Custom parameters sent to Integral via API are stored in the database directly. No validation is performed.

The maximum size of the customParameter property is 3500 characters, including all keys, values, and JSON syntax characters.

  - `customParameters.keyName` (string)
    The keyname of a custom parameter key/value pair as defined by your organization. Contact your Integral Technical Account Manager to enable and configure custom parameters.

  - `customParameters.value` (string)
    The value of a custom parameter key/value pair as defined by your organization. Contact your Integral Technical Account Manager to enable and configure custom parameters.


## Response 400 fields

## Response 401 fields
