Overview of Using the TS Report and Market Data API

Created by Elin Stenrud, Modified on Wed, 28 May at 4:14 PM by Dag Tyllered

The TS API provides endpoints for users or data centres to access data sets derived from Report or Market Data.


  • The Report Data API will fetch a snapshot of a system report on a given day. The snapshot is taken daily at 21:00 (CET) based on a System Report that is managed and edited in the TS application. It is possible to update the snapshot via the TS Autopilot; please see the article Set up of Autopilot "Update Transaction API Data" Activity  
  • The Market Data API returns data as it is displayed in TS.



API Versioning 

The API has versioning. When using any of the endpoints below, the version needs to be specified. 

To specify a version, add /v[version number] in the endpoint URL. Old versions are kept for six months. 

Example:  https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/reportdata/realtime/v3  


Current API Versions 

API version v3 is included in release 25.7. TS API v3 contains:

  • Date range for FX and IR market data.
  • FX market data against a currency, please see the FX rates - Overview article.
  • FX market data with YTD and MTD rates as well as bid and ask rates that include applicable forward points. 
  • Parameter "date" (that was named "dateCode" in previous versions).


API version v2 with improved JSON format is available since release 25.1 and onwards.

The /fxfwd/ endpoint was added in release 25.3. Please contact sales if you want to use it.




Get Started

To get started using the API, follow the steps below. 


Authentication

There are two different ways to authenticate to the API:

  1. As yourself with your Entra ID/TS-user - used when connecting Excel or Power BI to the API, please see Use Excel or Power BI to access TS Report and Market data API
  2. Via JWT bearer tokens - used with integration platforms (Logic Apps, etc.) or tools/scripting (Python, PowerShell, cURL, Postman, etc.). Please see Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API.


Entra ID User Organisational Account for Access via Excel and/or Power BI 

Log in to Treasury Systems as a TS User with permission to edit users and grant permission 'Public API Access' to the TS User (forename.surename@customer.com in the picture below) who wants to access the API via Excel and/or Power BI. The API will now accept requests using the endpoints below. See  Use Excel or Power BI to access TS Report and Market data API.


Token for API Tools, Scripting, and/or Code/Customer Application Access

Set up an "Application" in your Identity Provider; see the guideline Register an Application in Microsoft Entra ID to enable TS API Authentication when your organisation is using Entra ID.

Call the API to prompt the system to create a user; see Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API.

Log in to Treasury Systems as a TS User with the permission to edit users and grant permission ('Public API Access') to the new API user. The API will now accept requests using the endpoints below. 


API Consumers

Excel or Power BI

See the article Use Excel or Power BI to access TS Report and Market data API.

cURL

See the example in Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API.

Postman

Add an application and create a token; see the article Register an Application in Microsoft Entra ID to enable TS API Authentication.

Powershell

 See the example in Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API.  

Python

Download the attached file FetchTSData.py (see below).

Update the tenant and customer name (domain) in the file.

Logic Apps

 See the example in Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API.  


Report Data Endpoints

The base URL for this endpoint is: https://ts.treasurysystems.com/tenants/[CUSTOMERNAME]/api/reportdata/ 


Endpoints 

/atdate/  

Description: This endpoint will fetch and return a dataset that’s been saved and created on the specified date; please see the System Report. 

Parameters: 

param1 (string): 'date' in v3 and 'dateCode' in v2. Specifies the date that you wish to fetch a dataset. The date is a date code, which is commonplace in Treasury Systems service. At the end of this documentation, there is a list of the available date codes.

Example v3

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/reportdata/atdate/v3?date=20241001

Example v2

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/reportdata/atdate/v2?dateCode=20241001


/realtime/  

Description: This endpoint returns a dataset as it is now. That means Treasury Systems will run the System Report in real-time and return its data. If anything changes in the system and this is requested again the same day, you might receive differing datasets. 

Parameters: 

This endpoint has no parameters.   

Example v3 (same as v2)
https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/reportdata/realtime/v3


/daterange/  
 

Description: The endpoint works like the 'atdate' endpoint, but has 2 parameters, and it fetches every dataset between two date codes. It will be returned as a JSON collection.  

Parameters:  

param1 (string): fromDate' in v3 and fromDateCode' in v2. The codes that this endpoint accepts are at the end of this document. This date code is the start of the date range. 

param2 (string): 'toDate' in v3 and 'toDateCode' in v2. The codes that this endpoint accepts are at the end of this document. This date code is the end of the date range. 

For example, daily datasets from the 1st of March to the 1st of April will be returned with:  
{ 

    "param1": "20240301", 

    "param2": "20240401" 

} 

Market Data Endpoints

The base URL for this endpoint is: https://ts.treasurysystems.com/tenants/[CUSTOMERNAME]/api/marketdata/ 

Endpoints  

/fx/  
  
Description: This endpoint gets FX rates for a given date. It will return a JSON containing the time the rate is valid, the base currency and the price currency, the mid, bid, ask rates, and the period(s) the rates are valid. YTD and MTD rates are included for the SPOT period. This endpoint accepts three parameters.

Parameters v3 (Only one parameter 'dateCode' in v2): 

param1 (string): 'date' in v3 and 'dateCode' in v2. It functions as the other date code parameters in this document. At the end of this documentation, there is a list of the available date codes. 

param2 (string): 'currency'. It specifies the against currency, please see the FX rates - Overview article.

param3 (string): 'periods'. You can optionally specify one or more periods. The default period is "SPOT". Available periods are ALL, SPOT, 1W, 2W, 3W, 1M, 2M, 3M, 4M, 5M, 6M, 7M, 8M, 9M, 10M, 11M, 1Y, 2Y, 3Y. A semicolon separates two or more periods (SPOT;3M;6M, etc). Period "ALL" returns all periods.

Examples v3:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/fx/v3?date=20240312&currency=SEK


https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/fx/v3?date=20240312&currency=USD&periods=SPOT;3M;6M


Example v2:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/fx/v2?dateCode=20240312

 
 


/fx/daterange/
  
Description: This endpoint gets FX rates for a range of dates with the same JSON content per day as for the above /fx/ endpoint. The parameters are also the same as for /fx/, but a from and to date is used instead of a date.

param1 (string): 'fromDate'. It functions as the other date code parameters in this document. A list of the available date codes is available at the end of this documentation. 

param2 (string): 'toDate'. This parameter functions as the other date code parameters in this document. 

param3 (string): 'currency'. It specifies the against currency, please see the FX rates - Overview article.

param4 (string): 'periods'. You can optionally specify one or more periods.

Example v3:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/fx/daterange/v3?fromDate=20240312&toDate=20240316&currency=USD&periods=SPOT;3M



/ir/
  

Description: Similarly to the FX endpoint, this will return rates but for interest. It will return a JSON containing a collection of interest rates.  

Parameters: 

param1 (string): Accepts the same parameter 'date' as the FX endpoint. It functions as the other date code parameters in this document. A list of the available date codes is available at the end of this documentation.

Examples v3:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/ir/v3?date=20240312


Example v2:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/ir/v2?dateCode=20240312


 
 

/ir/daterange/
  
Description: This endpoint gets IR rates for a range of dates with the same JSON content per day as for the above /ir/ endpoint. Instead of a date parameter, from and to date parameters are used.

param1 (string): 'fromDate'. It functions as the other date code parameters in this document. A list of the available date codes is available at the end of this documentation.

param2 (string): 'toDate'. This parameter functions as the other date code parameters in this document. 

Examples v3:

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/ir/daterange/v3?fromDate=20240312&toDate=20240316



/fxfwd/
  

Please contact sales if you want to use this endpoint.  

Description: This endpoint gets an FX forward rate for a given date. When it is a 'broken date', the interpolated rate for a maturity date between the tenor period start and end will be returned. 

The rate result will depend on the selected deal date, maturity date, currency pair, and whether ask (buy) or bid (sell) rates are specified in the endpoint.

Parameters: 

param1 (string): 'buyOrSell'. Determines whether Buy or Sell rates are returned.

param2 (string): 'currencyPair'. The pair A/B gives the number of currency B units for one unit of currency A. The pair B/A gives the opposite result.

param3 (string): 'maturityDate'. This date code specifies the date up to which a rate should be interpolated.

param4 (string): The fourth parameter is 'dealDate'. This date code specifies the date at which a rate should be interpolated. 

Example v3 (same as v2) :

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/marketdata/fxfwd/v3?buyOrSell=Sell&currencyPair=EUR/SEK&maturityDate=20250311&dealDate=20250307




Errors, Rate Limits, Versions, Response codes and Date codes

Error Handling 

Please contact TS support for further assistance if any errors occur during use. Any unexpected error is returned as a status code 500. Please also see the Response Codes below.
 

API Rate Limits 

Our API has a rate-limiting policy. The standard rate limit is 100 requests per day. Please contact sales if you see a need for a higher rate limit. 


Response Codes 

200 OK - Request successful. 

204 No Content – There were no datasets to return. 

400 Bad Request - Invalid request. 

401 Unauthorized - Authentication failure. 

403 Forbidden - The API User is missing the permission "Public API Access"

404 Not Found - Resource not found. 

405 Parameters not correctly entered. 

500 Internal Server Error - Something went wrong on the server. 

 

Date Codes 

Dates are written like “20240101” or a text like “TODAY”. The date code TODAY will be translated to the date the request is sent. 

Common date codes are: 

  • TODAY – The current date
  • D – The next day compared to today 
  • BD – The next business day 
  • W – A Week from now 
  • M – A Month from now 
  • Q – A Quarter from now 
  • Y – A Year from now 
  • Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday - Next specific weekday after today
  • A combination of an operator (+ or -), a number, and the date code, for example 
    • - 5W, gives a date 35 days backwards from today, and 
    • -7BD would be 7 business days backwards (taking holidays into account)
    • -1Monday would result in the Monday before today

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article