Skip to main content
Premium

FX Trade Report API

Version

Introduction

The FX Trade Report API offers users the capability to retrieve detailed reports on both open and historical foreign exchange trades. This functionality allows for effective tracking and analysis of trading activities.

Use Cases and Features

calendar-schedule

Access to Historical FX Trades:
Retrieve historical trades within a specific date range by providing startDate and endDate. This feature enables detailed analysis and reporting on past trading activities.

stopwatch

Real-Time Open Trade Data:
Fetch details of all open trades in real time, allowing for up-to-the-minute insights into current market positions.

test-tubes-chemical

Detailed Trade Information:
Allows users to fetch detailed information about a specific trade using its unique trade ID, ensuring quick access to relevant data for analysis or verification.

clipboard-test-tube

Pagination and Filtering:
Efficiently manage data retrieval through pagination parameters and filter trades based on counterparts, ensuring you access only the relevant data.



Markets

This API is designed to cater to a global platform, offering essential data for diverse financial markets. It primarily focuses on providing detailed records of FX trades executed across varied jurisdictions. Currently, the API is in the pilot phase, being tested with selected customers to ensure its robustness and effectiveness before a broader rollout.

Getting Started

To begin using the FX Trade Report API, you must first complete the onboarding process through the External API Platform. Once you have successfully onboarded, you will gain access to all Premium APIs provided by Danske Bank.

For detailed onboarding instructions, please visit the Danske Bank Open Banking Developer Portal

Environment Description

As described in the API Platform onboarding guidelines, the FX Trade Report API will be available in two environments:

Sandbox: This environment is intended for initial integration tests and will provide mocked data. Users can test the API with simulated trade reports, allowing for the exploration of various functionalities without affecting real data.

Production: This environment provides access to real trade data. Users can retrieve actual historical and open trade reports based on t heir requests, with results determined by the parameters specified in the API calls.

Sandbox URLs

Token Endpoint: https://sandbox-api.danskebank.com/sandbox-corporate/api/dk/business/oauth2/token
FX Trade Report API: https://sandbox-api.danskebank.com/sandbox-corporate/api/v1/open-trades-service

Production URLs

Token Endpoint: https://api.danskebank.com/corporate/api/dk/business/oauth2/token
FX Trade Report API: https://api.danskebank.com/corporate/api/v1/open-trades-service

Authentication

To access a resource, the client must first request a Client Credentials Grant token by calling the token endpoint specified in the OpenId configuration (token_endpoint). The request should be an x-www-form-urlencoded POST with the following parameters:

  • grant_type - client_credentials (read more).

  • scope - should include a scope the client has access to; for the FX Trade Report API, it MUST contain the "accounts" keyword ( read more).

  • client_id - the ID received after onboarding (read more).

Example Request:

curl --location --request POST 'https://example.com/oauth2/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id=1233456' \
--data-urlencode 'scope=accounts'

Example Response:

{
  "token_type":"Bearer",
  "access_token":"A****",
  "metadata":"m:",
  "expires_in":3600,
  "consented_on":1588933990,
  "scope":"accounts"
}

Using the Access Token:

The access_token received is valid for 1 hour and must be included in the request header on all subsequent API requests:

Authorization: Bearer <access_token>

Supported Endpoints

FX Trade Report API includes the following key endpoints to interact with:

EndpointHTTP MethodDescriptionPagination
/trade-reportsGETFetches historical trades based on date rangeYes
/trade-reports/openGETRetrieves current open tradesYes
/trade-reports/trade/{tradeId}GETProvides details of a specific tradeNo

Implementation Details

Request parameters

GET /trade-reports

Retrieves historical trades for a specified district user ID within a given date range. The results can optionally be filtered by counterparts and are based on the trade execution date. Pagination is supported, allowing you to define the starting point with the offset parameter and specify the number of records per page using the limit parameter. The response includes links for previous and next pages.

ParameterRequiredDescriptionValidations
startdateYesThe start date for the historical trade retrieval.Must be in a valid date format (e.g., YYYY-MM-DD). Cannot be a future date.
enddateNoThe end date for the historical trade retrieval.Must be in a valid date format (e.g., YYYY-MM-DD). Cannot be a future date.
counterPartsNoAn array of counterpart names to filter the results.Each identifier must be a valid string.
offsetNoThe starting point for pagination (default is 0).Must be a non-negative integer.
limitNoThe number of records to return per page (default is 30).Must be a positive integer between 1 and 100.

Example Request

Historical trades cURL request:

curl -X GET https://api.danskebank.com/corporate/api/v1/open-trades-service/trade-reports?startDate=2025-05-20&endDate=2025-05-30&counterparts=DBDEMOITK0,DBDEMO1&offset=0&limit=5 -H "Authorization: Bearer {accessToken}"

GET /trade-reports/open

Retrieves all open trades for a specified district user ID, with optional filtering by counterparts. The results are based on the maturity or settlement date. Pagination is supported similarly to the historical trades endpoint.

ParameterRequiredDescriptionValidations
counterPartsNoAn array of counterpart names to filter the results.Each identifier must be a valid string.
offsetNoThe starting point for pagination (default is 0).Must be a non-negative integer.
limitNoThe number of records to return per page (default is 30).Must be a positive integer between 1 and 100.

Example Request

Open trades cURL request:

curl -X GET https://api.danskebank.com/corporate/api/v1/open-trades-service/trade-reports/open?counterparts=DBDEMO1&offset=0&limit=30
-H "Authorization: Bearer {accessToken}"

GET /trade-reports/trade/{tradeId}

Provides detailed information for a specific trade identified by the provided trade ID.

ParameterRequiredDescriptionValidations
tradeIdYesThe ID of the trade to retrieveMust be a valid trade identifier string, and must be 12 characters long.

Example Request

Specific trade cURL request:

curl -X GET https://api.danskebank.com/corporate/api/v1/open-trades-service/trade-reports/trade/W250429A1139
-H "Authorization: Bearer {accessToken}"

Response Parameters

GET /trade-reports

Returns a paginated list of historical trades.

Response parameters:

- items: An array of historical trade objects, each containing:

ParameterDescription
tradeIdUnique identifier of the trade.
tradeTimeDate and time when the trade was executed.
productType of the FX Trade (Spot, Forward, Swap)
counterpartCounterparties involved in the trade.
allInPriceAll-in price of the trade.
spotPriceSpot price at the time of the trade.
forwardPriceForward price at the time of the trade.
maturityDateMaturity date of the trade.
soldAmount sold (includes amount and currency).
boughtAmount bought (includes amount and currency).
commentAny additional comments related to the trade.

- next: A URL for the next page of results (if available).

- previous: A URL for the previous page of results (if available).

Response body:

{
  "items": [
    {
      "tradeTime": "2025-05-20T06:22:06.955Z",
      "tradeId": "W250520A0013",
      "counterpart": "DBDEMOITK0",
      "counterpartName": "DANSKE BANK DEMO AGREEMENT COMPANY NAME 2",
      "maturityDate": "2025-06-23",
      "bought": {
        "currency": "EUR",
        "amount": 500
      },
      "sold": {
        "currency": "DKK",
        "amount": 3741.1
      },
      "product": "FWD",
      "spotPrice": 7.48256,
      "forwardPrice": -0.0003525,
      "allInPrice": 7.4822075,
      "autoSettle": true,
      "comment": ""
    },
    {
      "tradeTime": "2025-05-20T08:19:55.054Z",
      "tradeId": "W250520A0293",
      "counterpart": "DBDEMO1",
      "counterpartName": "DANSKE BANK DEMO AGREEMENT COMPANY NAME 2",
      "maturityDate": "2026-08-31",
      "bought": {
        "currency": "DKK",
        "amount": 1000000
      },
      "sold": {
        "currency": "EUR",
        "amount": 135447.05
      },
      "product": "FWD",
      "spotPrice": 7.43724,
      "forwardPrice": -0.0542811,
      "allInPrice": 7.3829589,
      "autoSettle": true,
      "comment": "Urgent client request"
    },
    {
      "tradeTime": "2025-05-20T11:20:42.521Z",
      "tradeId": "4250520A0025",
      "counterpart": "DBDEMO1",
      "counterpartName": "DANSKE BANK DEMO AGREEMENT COMPANY NAME 2",
      "maturityDate": "2025-07-25",
      "bought": {
        "currency": "USD",
        "amount": 1126.46
      },
      "sold": {
        "currency": "EUR",
        "amount": 1000
      },
      "product": "FWD",
      "spotPrice": 1.12329,
      "forwardPrice": 0.0031733,
      "allInPrice": 1.1264633,
      "autoSettle": true,
      "comment": ""
    },
    {
      "tradeTime": "2025-05-21T10:56:55.714Z",
      "tradeId": "W250521A0049",
      "counterpart": "DBDEMO1",
      "counterpartName": "DANSKE BANK DEMO AGREEMENT COMPANY NAME 2",
      "maturityDate": "2026-08-31",
      "bought": {
        "currency": "DKK",
        "amount": 1000000
      },
      "sold": {
        "currency": "EUR",
        "amount": 135464.5
      },
      "product": "FWD",
      "spotPrice": 7.43644,
      "forwardPrice": -0.054432,
      "allInPrice": 7.382008,
      "autoSettle": true,
      "comment": "Urgent client request"
    },
    {
      "tradeTime": "2025-05-21T10:57:54.816Z",
      "tradeId": "W250521A0061",
      "counterpart": "DBDEMO1",
      "counterpartName": "DANSKE BANK DEMO AGREEMENT COMPANY NAME 2",
      "maturityDate": "2026-08-31",
      "bought": {
        "currency": "DKK",
        "amount": 1000000
      },
      "sold": {
        "currency": "EUR",
        "amount": 135463.95
      },
      "product": "FWD",
      "spotPrice": 7.43647,
      "forwardPrice": -0.054432,
      "allInPrice": 7.382038,
      "autoSettle": true,
      "comment": "Urgent client request"
    }
  ],
  "next": "/v1/open-trades-service/trade-reports?offset=5&endDate=2025-05-30&counterparts=DBDEMOITK0,DBDEMO1&limit=5&startDate= 2025-05-20",
  "previous": null
}

GET /trade-reports/open

Response format:

Returns a list of open trades for the user.

Response parameters:

  • items: An array of open trade objects, each containing the same structure as the historical trade objects listed above.

  • next: A URL for the next page of results (if available).

  • previous: A URL for the previous page of results (if available).

GET /trade-reports/trade/{tradeId}

Response format:

Returns the details of the specified trade.

Response parameters:

open trade object, containing the same structure as the historical trade object listed above.

Response body:

{
  "tradeTime": "2025-04-29T13:57:59.523Z",
  "tradeId": "W250429A1139",
  "counterpart": "DBDEMO1",
  "counterpartName": "DANSKE BANK DEMOAA",
  "maturityDate": "2025-05-23",
  "bought": {
    "currency": "DKK",
    "amount": 7.46
  },
  "sold": {
    "currency": "EUR",
    "amount": 1
  },
  "product": "FWD",
  "spotPrice": 7.46372,
  "forwardPrice": -0.0066376,
  "allInPrice": 7.4570824,
  "autoSettle": true,
  "comment": null
}

Error Response

FX Trade Report API uses standardized HTTP status codes to indicate the success or failure of API requests. Below is a summary of the error codes you may encounter:

Error CodeDescriptionResolution Steps
200 OKThe request was successful.No action needed.
400 Bad RequestThe request could not be understood or was missing required parameters.Check the request syntax and ensure all required parameters are included.
401 UnauthorizedAuthentication credentials were missing or incorrect.Verify that authentication credentials are correct and included in the request.
403 ForbiddenThe request was understood, but it has been refused or access is not allowed.Ensure that you have the necessary permissions to access the requested resource.
404 Not FoundThe requested resource could not be found.Verify the resource URL and ensure that the resource exists.
500 Internal Server ErrorAn error occurred on the server.Try the request again later and contact support if the issue persists.

Error Response Structure:

{
  "error": {
    "exception": "ExceptionType",
    "message": "Detailed error message",
    "timestamp": "2025-06-23T08:10:38Z"
  }
}

Pricing

During the pilot phase, the API will be offered at no cost to selected customers. Final pricing details will be announced at a later date.

Architectural constraints

State
Active

Technical constraints

Static URL
/premium-apis/fx-trade-report-api
Environment(s)
PROD, SANDBOX