Place an order (at best)

Goal

Place an at-best order and query its progress through the order workflow.

This guide uses the at-best order type: you submit the order to get done at the best rate available. Your priority is trade execution over price.

Prerequisites

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

Steps

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" }
Response
application/json
{ "status": "OK", "errorCode": null, "responseTuples": null, "expiryTime": 1665490480729, "serverUTCTime": 1665490420730 }

Step 2: Place order

Use the Place order endpoint.

You must send the following with your order:

  • type=AtBest
  • timeInForce=FOK
  • valueDate

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

Response
application/json

Successful limit order

{ "coId": "8932452311944", "type": "Limit", "timeInForce": "IOC", "side": "Buy", "currency": "EUR", "symbol": "EUR/USD", "size": 1000000, "org": "BrokerOrg1", "price": 1.0971678, "orderId": "4820276016", "userFullName": "User1@pfOrg", "action": "place", "status": "RECEIVED" }

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
HTTP code 202
Status = NEW
(Intermediate state)
HTTP code 200
Status = FILLED
HTTP code 200
Status = EXPIRED
HTTP code 200
Status = REJECTED
HTTP code 200
Order status transition (failure)
Place order
Error object
HTTP code 400/5xx
Response
application/json

Successful limit order

{ "coId": "8932452311944", "type": "Limit", "timeInForce": "IOC", "side": "Buy", "currency": "EUR", "symbol": "EUR/USD", "size": 1000000, "org": "BrokerOrg1", "price": 1.0971678, "orderId": "4820276016", "userFullName": "User1@pfOrg", "action": "place", "status": "RECEIVED" }