Overview of Using the TS Report and Market Data API

Created by Elin Stenrud, Modified on Wed, 29 Jan at 4:22 PM by Dag Tyllered

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

  • The Report Data API will fetch a snapshot of a data set 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. 
  • The Market Data API returns data as it is stored in TS. 


Please note: A new API version, v2, will be available as part of TS version 25.1. 


Get Started

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

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 (such as Logic Apps) or tools/scripting (such as Python, PowerShell, cURL, Postman). Please see Use Tools, Scripting or Integration Platforms to access TS Report and Market Data API

Excel and/or Power BI access

Log in to Treasury Systems as a TS User with permission to edit users and grant permission 'Public API Access' to the TS User who wants to access the API via Excel and/or Power BI. The API will now accept requests using the endpoints below. 

Datacenter (API Tool, Customer application(scripting/code)) access

Set up an "Application" in your Identity Provider; see 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 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 is the most basic of the report data endpoints. It will fetch and return a single dataset thatā€™s been saved and created on the specified date. 

Parameters: 

param1 (string): This is the one and only parameter for this endpoint. It specifies the dataset at the date that you wish to fetch. The date is a date code, which is commonplace in Treasury Systems service. At the end of this documentation, we provide a list of the available date codes that are available. The parameter name is 'dateCode'.  


Example 

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

 

/realtime/ 
 
Description: This endpoint returns a data set 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: 

/daterange/ 
 

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

Parameters:  

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

param2 (string): The second parameter is 'toDateCode'. 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, with: 
{ 

    "param1": "20240301", 

    "param2": "20240401" 

} 

daily datasets from the 1st of March to the first of April will be returned. 

Example

https://ts.treasurysystems.com/tenants/CUSTOMERNAME/api/reportdata/daterange/v1?fromDateCode=20241001&toDateCode=20241010



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 at the given date. It will return a JSON containing the Time the rate is valid, the base currency and the price currency, the periods that the rates are valid and lastly, the Bid rate, Ask Rate and FWD points. 

Parameters: 

param1 (string): This endpoint accepts one parameter, a string called 'dateCode'. It functions as the other date code parameters in this document. At the end of this documentation we provide a list of the date codes available. 

Example:

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

 
 

/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 as the FX endpoint. Itā€™s also called 'dateCode'. It functions as the other date code parameters in this document. At the end of this documentation we provide a list of the date codes available. 
 

Example:

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



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

Error Handling 

Errors are handled and logged internally. If any errors occur during use, please contact TS support for further assistance. Any unexpected error is returned as status code 500. Please also see the Response Codes below.
 

API Rate Limits 

Our API adapts a simple rate-limiting policy. Currently, the rate limit is 10 requests per minute and 100 per day. 

 

API Version 

Our API has versioning. When using any of the endpoints, the version needs to be specified. To specify a version, simply add /v[version number] at the end of the URL. The recommended version is listed below. Old versions are kept for six months. 

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

Versions 

  • Realtime 

  • v1 - First implementation of the endpoint. 

  • Atdate 

  • v1 - First implementation of the endpoint. 

  • Daterange 

  • v1 - First implementation of the endpoint. 
     


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 

Generally, date codes are written as ā€œ20240101ā€, which represents 2024-01-01, or ā€œTODAYā€, which will be translated to the date the request was sent. 

Other 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 
  • A combination of an operator (+ or -), a number, and the date code - 5W would result in 28 days backwards, and -7BD would be 7 business days backwards (taking holidays into account)
  • Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday - A specific weekday

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