Skip to content

Buy or sell in a portfolio

POST
/v1/accounts/{id}/orders
curl -X POST "https://api.staging.idealx.com/v1/accounts/acc_01937c4e8a2b7d1f9e0c3b5a6d7e8f90/orders" \
-H "Authorization: Bearer $IDEALX_API_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"portfolioId": "ptf_01937c4e8a2b7d1f9e0c3b5a6d7e8fa1",
"instrumentId": "XASX:EXS",
"side": "buy",
"type": "market",
"quantity": "10"
}'

The cash (buy) or units (sell) are set aside at once. A market buy sets aside 3% above the price; what is not used comes back.

id
required
string
idempotency-key
required

Idempotency-Key: 16-128 chars; repeat it to retry safely

string

Idempotency-Key: 16-128 chars; repeat it to retry safely

Media typeapplication/json
object
portfolioId
required
string
instrumentId
required
string
side
required
string
Allowed values: buy sell
type
required
string
Allowed values: market limit
quantity
required
string

Example

10
limitPrice
string

Example

45.10
linkedTo

An instruction this belongs with, e.g. the currency conversion that funds it

string
reason

A firm’s own trade under a discretionary mandate: why, in one line (required then; kept with the order and audited)

string
<= 200 characters

Filled, working, waiting for approval, or refused by the market

Media typeapplication/json
object
id
required
string
portfolioId
required
string
instrumentId
required
string
side
required
string
Allowed values: buy sell
type
required
string
Allowed values: market limit
quantity
required
string
limitPrice
required
string | null
state
required
string
filledQuantity
required
string
filledValue
required
object
amount
required
string
currency
required
string
setAside
required

Still set aside: cash for buys, units for sells

string
approvalsRequired
required
number
approvals
required
number
approvedByMe
required
boolean
rejectReason
required
string | null
reason
required

Why the firm placed it under its discretionary mandate

string | null
createdAt
required
string

Example

{
"side": "buy",
"type": "market",
"filledValue": {
"amount": "1250.00",
"currency": "AUD"
}
}

Not enough cash or units, or no price

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
requestId
required
string
details
object
key
additional properties

Example

{
"error": {
"code": "validation_failed"
}
}

Invalid quantity or price

Media typeapplication/json
object
error
required
object
code
required
string
message
required
string
requestId
required
string
details
object
key
additional properties

Example

{
"error": {
"code": "validation_failed"
}
}