Trade RFS

Goal

Execute a trade in the RFS workflow, from login and requesting the stream to downloading the done trade.

Prerequisites

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

Steps

Request status = REQUEST_RECEIVED
Poll request status
202 Success
Step 1: Login
Step 2: Request quotes
Successful request
Step 3: Query request
Step 4: Accept quote
Step 5: Query quote request for trades

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: Request quotes

Use the Request quote endpoint.

application/json
{ "clOrderId": "view1MultiLP5", "symbol": "EUR/USD", "amount": 1000000, "dealtCurrency": "EUR", "expiry": 140, "nearValueDate": "1W", "farDealtAmount": 1000000, "farValueDate": "2W", "side": "TWO_WAY", "priceType": "FwdFwd", "customerAccount": "pfOrgLE", "customerOrg": "pfOrg", "providers": [ "ProvA", "ProvB", "ProvC" ] }
Response
application/json
{ "clOrderId": "view1MultiLP5", "requestId": "G4796976d517b17818a0021e", "event": "REQUEST_RECEIVED" }

Step 3: Query request

You can query by two different IDs:

You must query your quote request for its status and to get quotes. After the initial success/fail response, status updates and quotes are not pushed to you.

Request state

Your request can have any one of the following states:

  • REQUEST_RECEIVED: request for quote is received for processing, quoting has not started.
  • QUOTE: a quote in response to your request for quote.
  • REQUEST_DECLINED: request declined.
  • REQUEST_EXPIRED: request expired and inactive.
  • REQUEST_WITHDRAWN: request was canceled by you.
  • REQUEST_ACCEPTED: request to trade a quote is accepted.
  • TRADE_REJECTED: request to trade a quote rejected by one or more liquidity providers.
  • TRADE_PENDING: trades pending in response to your request to trade a quote.
  • TRADE_VERIFIED: trades executed in response to your request to trade a quote.

Request states progress and relate to each other in the following ways:

Request for quote state transitions
REQUEST_RECEIVED
REQUEST_DECLINED
REQUEST_EXPIRED
QUOTE
REQUEST_WITHDRAWN
REQUEST_ACCEPTED
TRADE_VERIFIED
TRADE_PENDING
TRADE_REJECTED

Query by client ID

No request payload
Response
application/json
{ "clOrderId": "rjv_566", "requestId": "G4796976d5_228bd_19587256c877", "transactionId": "FXI9445344076", "ttl": 7200, "event": "QUOTE", "quotes": [ {} ] }

Query by server ID

No request payload
Response
application/json
{ "clOrderId": "rjv_566", "requestId": "G4796976d5_228bd_19587256c877", "transactionId": "FXI9445344076", "ttl": 7200, "event": "QUOTE", "quotes": [ {} ] }

Step 4: Accept quote

Use the Accept quote endpoint.

The diagram shows the values returned in the status field in the response.

Accept quote state transition
Client appIntegralResponse from Integralwith done tradesalt[Verified trade][Pending trade][Rejected trade]Request to trade quoteState=QUOTEAccept quoteState=REQUEST_ACCEPTEDQuery quote request for trade stateState=TRADE_VERIFIEDState=TRADE_PENDINGQuery quote request for trade stateState=TRADE_REJECTEDClient appIntegral
application/json
{ "quoteId": "G-4796976cf-17b1781b062", "side": "BUY", "symbol": "GBP/USD", "dealtCurrency": "USD", "clOrderId": "view1MultiLP5" }

Step 5: Query quote request for trades

You must query your original quote request to get the done trades. After a success response from your accept quote, status updates and trades are not pushed to you.

You must query your original quote request to get the done trades.

The event attribute value TRADE_VERIFIED on the response indicates that trades were done by your request to trade a quote. The trades array on the response contains the done trades.

You can query by two different IDs:

Query by client ID

No request payload
Response
application/json
{ "clOrderId": "rjv_566", "requestId": "G4796976d5_228bd_19587256c877", "transactionId": "FXI9445344076", "ttl": 7200, "event": "QUOTE", "quotes": [ {} ] }

Query by server ID

No request payload
Response
application/json
{ "clOrderId": "rjv_566", "requestId": "G4796976d5_228bd_19587256c877", "transactionId": "FXI9445344076", "ttl": 7200, "event": "QUOTE", "quotes": [ {} ] }