Get open positions by value date. All query parameters are optional. If no parameters are specified, all open positions for the logged-in user and specified value date are returned.
- Mock serverhttps://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/v2/positions/{valueDate}
const query = new URLSearchParams({
symbol: 'EUR/USD',
level: 'USER',
value: 'pfOrg'
}).toString();
const valueDate = '2022-03-11';
const resp = await fetch(
`https://docs.fxinside.net/_mock/openapi/integral-api-reference/rest/v2/positions/${valueDate}?${query}`,
{
method: 'GET',
headers: {
SSO_TOKEN: 'YOUR_API_KEY_HERE'
}
}
);
const data = await resp.text();
console.log(data);A list of positions for the given parameters.
The value date of the trades that make up the position in the format YYYY=MM-DD.
No default value. The level at which the position is calculated:
USER: userLE: legal entityORG: organization
The ID of either the user or organization based on the value of level.
Net open amount in term currency. Note the property name is not a typo ("term" is lowercase).
The profit or loss in the base currency determined by taking all trades (or portions thereof) that are closed and computing the profit for each pair of opposing buy/sell trades.
The profit or loss in the base currency determined by taking the position's currency pair rate against the current market rate at the position amount. Essentially, the unrealized P/L is the profit or loss if the position was closed at the current close rate.
One object per position. level and levelValue name what the position is grouped by, and the P&L is split into realizedPnL and unrealizedPnL in pnlCurrency.
[ { "side": "Long", "symbol": "EUR/USD", "valueDate": "2022-03-11", "level": "ORG", "levelValue": "pfOrg", "netOpenBase": 200000, "netOpenterm": 237278, "rate": 1.18639, "realizedPnL": 0, "unrealizedPnL": -22, "pnlCurrency": "USD" }, { "side": "Short", "symbol": "EUR/USD", "valueDate": "2022-03-18", "level": "ORG", "levelValue": "pfOrg", "netOpenBase": 5000000, "netOpenterm": 5933600, "rate": 1.18672, "realizedPnL": 0, "unrealizedPnL": 1600, "pnlCurrency": "USD" }, { "side": "Long", "symbol": "EUR/USD", "valueDate": "2022-03-25", "level": "ORG", "levelValue": "pfOrg", "netOpenBase": 10000000, "netOpenterm": 11865200, "rate": 1.18652, "realizedPnL": 0, "unrealizedPnL": -2400, "pnlCurrency": "USD" }, { "symbol": "EUR/USD", "valueDate": "2022-03-23", "level": "ORG", "levelValue": "pfOrg", "netOpenBase": 0, "netOpenterm": 0, "realizedPnL": -280, "unrealizedPnL": 0, "pnlCurrency": "USD" } ]