Get Eurex Trading Holidays — and more — in 5 mins using Python and GraphQL

Mar 14 · 7 min read
Photo by Chris Liverani on Unsplash

As someone working closely on a financial exchange, the trading schedule is one of the many important pieces of information to work with. Most exchanges provide their trading calendars on their websites, with some displayed in a less-than-ideal format. For instance, I’m someone who’s into raw data and numbers, formats like PDF or a front-end user interface (such as below) may not be too useful, since these do not provide me the flexibility to write scripts and automate alerts.

An example of a user interface-based trading calendar: beautiful, but not my cup of tea.

So when I first heard from my colleague that Eurex is putting its T7 Reference Data onto an API, I was thrilled! In this article, I will walk you through this API and some of the information you can grab from it, and how to utilize the API using GraphQL and Python for a seamless experience. Buckle up!

So, what is GraphQL?

According to the formal definition, “GraphQL is a query language for your API, and a server-side runtime for executing queries by using a type system you define for your data… (and it) isn’t tied to any specific database or storage engine and is instead backed by your existing code and data”. Using a GraphQL based API is a good call, as it offers a couple of benefits

  1. GraphQL is a relatively easy language to master, with well-written documentation available online which smoothens the learning curve
  2. It is easily accessible via a Chrome Extension, “GraphQL Playground for Chrome”, which anyone can easily download and access the API without any technical difficulties
  3. It has an ‘introspection’ functionality for end-user to navigate the schema of the API; it is intuitive and fuss-free, one does not need to dig up pages of documentation to understand what’s available
GraphQL Playground for Chrome

So how does one access Eurex’s Reference Data API?

Easy! First of all, one may find the list of API publicly available on the DBG Developer Portal. From there, go to ‘AccessToT7-ReferenceData’ and sign up for an API key. Although the webpage provides a demo key, it is advised that one should apply for one in order to have less restrictive access to the data.

API Key and Host URL are available on the webpage

Next, with the API key and Host URL, go to the GraphQL Playground and insert the host URL on the URL field on the top bar (see below) and the API Key under the ‘HTTP Header’. At this point, your environment should be well set-up, and you may start writing your script on the console on the left.

Once the environment is set up, start with introspection to understand the schema of the API.

When handling APIs, one of the first steps is to understand what data is available to you. Hence, we shall start with introspection. By writing the script above, you are able to explore the data available.

Once you have identified the data you are interested in, you will need to go further into the details. For this example, I’m looking into ‘Holidays’, and I wrote the query to display a description of the data and the fields available. Via introspection, I learned that the data ‘Holidays’ consists of all trading holidays and exchange holidays (when clearing and trading of products are not available) of all products for the next 2 years.

Introspection also allows us to look into the details of data of interest.

With this info, I can now start doing my queries! As an example, I shall start with querying for the trading holidays of EURO STOXX 50 Index Futures (exchange code FESX, Bloomberg code VGA Index) as shown below.

GraphQL and Python — the perfect marriage

While as simple as it seems, using GraphQL Playground itself may not be sufficient, given that it is pretty much an interface-based solution. For some users like myself, it is imperative to retrieve at once the trading holidays for a list of products for easy handling when plugged into another program. It is ideal to establish a connection between GraphQL and the backend, in the format that we require.

So here comes Python! By using the “Request” package, we are able to establish a connection between GraphQL API and Python through a POST request. Simply defining the URL header, the API key, and the query, you are able to retrieve the information within seconds. If you are looking for multiple products, you may apply loops and consolidate them into a data frame for further manipulations. In the example below, I wrote a simple query for the trading holidays of 3 of Eurex’s products, namely

  • Daily Expiring Futures on KOSPI 200 Options (OKS2),
  • Daily Expiring Futures on Mini-KOSPI 200 Futures (FMK2), and
  • Daily Expiring Futures on KOSPI 200 Futures (FBK2)
A simple implementation of a POST request to GraphQL API via Python

A Practical Example — Extracting Trading Holidays for a list of products

With over 1,900 products listed on Eurex, it is difficult — if not impossible — to remember the exchange codes for all of them. Practically, if I’m trading the MSCI product suite and some of the benchmark products, I’d want to extract the codes quickly so that I can work on the next steps, such as retrieving the trading holidays. This can be easily done by utilizing the GraphQL API, with the query as follows:

query {
ProductInfos(filter: { Name: { contains: "MSCI" } }) {
data {

In my example, I have extracted the trading holidays for the benchmark products, the MSCI suite, and the KOSPI suite. To visualize the trading holidays, I chose to use a heatmap provided by the Seaborn package. For ease of demonstration, I picked a sample of 18 products to construct the heatmap as follows.

Trading Holiday Matrix — Dark Blue colored area denotes Trading Holidays.

With the heatmap above, we can easily tell on which day some of the products will not be available for trading. One interesting observation to note is that the KOSPI product suite has more trading holidays than the others. This is because the Eurex KOSPI suite is a cooperation between Eurex and KRX (Eurex-KRX Link), thus the trading is affected by the holidays on both exchanges.

Beyond Trading Holidays…

The T7 Reference Data API provides a huge range of reference data to meet its clients’ needs. Apart from trading holidays, one may also find out the contract specifications of each product listed on the exchange. Another particularly useful piece of information is the trading hours of the products.

Using the query below, one may be able to extract the start and end times of continuous trading. Pairing the query with Python, you may also adjust the time to the timezone of your choice, and even connect the data to a front-end program to visualize the timetable to your liking.

query {
TradingHours(filter: { Product: { eq: "OKS2" } }) {
data {
Extracted trading hours of selected products, converted to Singapore Time (GMT +8)

From above, we can see that the benchmark products are available for trading from 8:15 am T+0 to 5:00 am T+1 Singapore/ Hong Kong Time. Eurex KOSPI products are available for trading much later, after KRX’s closing hours, from 4:50 pm T+0 to 04:00 am T+1.

Conclusion — The ‘ABC’ to Eurex T7 Reference Data API

With this simple walkthrough, we may summarize the approach to using the API as follows:

  1. Download ‘GraphQL Playground for Chrome’ extension
  2. Go to DBG Developer Portal and retrieve the API key and the Host URL
  3. Set up the API Key and Host URL on the Playground
  4. Apply introspection to explore the data available and look into more details of the data of interests, including the available fields
  5. Write test query scripts on Playground to ensure that the query script works
  6. Connect to GraphQL API on Python using POST request to extract the data you require

The API provided by Eurex on its reference data really helps to ease the extraction of key information of its products, which really brings value to the users. I hope this walkthrough helps you in understanding how it works and how you could make use of it for your own benefit.

If you are keen to find out more about the codes I wrote on this project, you may find it on my GitHub as follows:

Happy Coding! :)

Disclaimer: The author is a business analyst working in Eurex, a financial derivatives exchange owned by the Deutsche Boerse Group. This article is written entirely on a personal capacity for the sole purpose of education.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Sign up for Analytics Vidhya News Bytes

By Analytics Vidhya

Latest news from Analytics Vidhya on our Hackathons and some of our best articles! Take a look.

By signing up, you will create a Medium account if you don’t already have one. Review our Privacy Policy for more information about our privacy practices.

Check your inbox
Medium sent you an email at to complete your subscription.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem


Written by


Insinyur (n): refers to ‘Engineer’ in Bahasa Melayu. ‘Finsinyur’ is my take on being an aspiring Financial Engineer rooted in South East Asia.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store