Get fixed-period market data
Goal
Request rates from a provider that supports tradable rates over a fixed period.
Prerequisites
- Your REST API app.
- Integral API login with trading permission.
- A provider that supports fixed-period market data sets (MDS).
Steps
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.
- https://3ac93db9-6290-458d-9482-0dc0a0e9607a.remockly.com/v2/sso/login
- Payload
- JavaScript
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: Get fixed-period MDS
Use the Get market data endpoint.
- Mock server https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/marketdataset
- https://3ac93db9-6290-458d-9482-0dc0a0e9607a.remockly.com/marketdataset
const query = new URLSearchParams({
id: 'string',
org: 'BNK1-4HOrg',
symbol: 'EUR/USD',
symbols: 'EUR/USD,USD/JPY',
date: '2024-10-24',
tenor: 'SPOT',
timeWindow: '1500-1700'
}).toString();
const resp = await fetch(
`https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/marketdataset?${query}`,
{
method: 'GET',
headers: {
SSO_TOKEN: 'YOUR_API_KEY_HERE'
}
}
);
const data = await resp.text();
console.log(data);
Response
application/json
[ { "id": "RealTimeMDS", "date": null, "timeWindow": null, "name": "Real-time market data", "createdTime": null, "activationTime": null, "validUntil": null, "nextCreationTime": null, "expirationTime": null, "rates": [ … ] } ]
Step 3: Handle rates
Use the returned rateId
attribute for trading.
Response
application/json
[ { "id": "RealTimeMDS", "date": null, "timeWindow": null, "name": "Real-time market data", "createdTime": null, "activationTime": null, "validUntil": null, "nextCreationTime": null, "expirationTime": null, "rates": [ … ] } ]