Skip to content

Place an order (limit)

Goal

Place a limit order and query its progress through the order workflow.

This guide uses the limit order type: you submit the order with a limit price to be done at that price or better.

Prerequisites

  • Your REST API app.
  • Integral API login with trading permission.
  • Your organization provisioned with at least one provider who streams ESP spot prices.

Steps

Step 1: Login

Step 2: Place order

Step 3: Query order

Step 1: Login

Step 2: Place order

Step 3: Query order

Step 1: Login

Use the Login and get token endpoint.

See the related Login tutorial.

Your access token is in SSO_TOKEN of the response header. Your token is valid for limited time.

Pass the SSO_TOKEN cookie value with all of your subsequent API requests.

application/json
{ "user": "apiUserId", "pass": "This is a long password!", "org": "apiOrganizationId" }

Step 2: Place order

Use the Place order endpoint.

You must send the following with your order:

  • type=Limit
  • timeInForce
  • price

To get your order status, you must query your order. After the initial success/fail response, status updates are not pushed to you.

application/json
{ "coId": "8932452311944", "type": "Limit", "side": "Buy", "symbol": "EUR/USD", "currency": "EUR", "size": 1000000, "price": 1.0971678, "timeInForce": "IOC" }

Step 3: Query order

To get your order status, you must query your order. After the initial success/fail response, status updates are not pushed to you.

Use one of the following endpoints:

The diagram shows the values returned in the status field in the response and their context in the order workflow.

Order status transition (at best order, success)

Place order

Query order

Query order

Query order

Query order

Query order

Status = RECEIVED\nHTTP code 202

Status = NEW\n(Intermediate state)\nHTTP code 200

Status = FILLED\nHTTP code 200

Status = EXPIRED\nHTTP code 200

Status = REJECTED\nHTTP code 200

Place order

Query order

Query order

Query order

Query order

Query order

Status = RECEIVED\nHTTP code 202

Status = NEW\n(Intermediate state)\nHTTP code 200

Status = FILLED\nHTTP code 200

Status = EXPIRED\nHTTP code 200

Status = REJECTED\nHTTP code 200

Order status transition (failure)

Place order

Error object\nHTTP code 400/5xx

Place order

Error object\nHTTP code 400/5xx

const id = '4820276016';
const resp = await fetch(
  `https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/v2/orders/${id}`,
  {
    method: 'GET',
    headers: {
      SSO_TOKEN: 'YOUR_API_KEY_HERE'
    }
  }
);

const data = await resp.text();
console.log(data);