🐍 Python Scripts

Access data programmatically using the `requests` library.

Overview

Python is an excellent choice for interacting with the Financial Calendar API due to its powerful data processing capabilities and widespread use in financial analysis. The requests library simplifies making HTTP requests to the API and handling JSON responses.

Make sure you have the requests library installed: pip install requests

Examples

Get Day Status

Fetch the detailed status for a specific date (e.g., `2025-12-24` on `SIFMA-US` calendar):

import requests
import json

base_url = "https://fincalapi.com/v1/day_status"
params = {
    "date": "2025-12-24",
    "calendar": "SIFMA-US"
}

response = requests.get(base_url, params=params)

if response.status_code == 200:
    day_status = response.json()
    print(json.dumps(day_status, indent=2))
else:
    print(f"Error: {response.status_code} - {response.text}")

Calculate Next Business Day

Find the next business day for a given date (e.g., `2025-07-04` on `NYSE` calendar):

import requests
import json

base_url = "https://fincalapi.com/v1/next_business_day"
params = {
    "date": "2025-07-04", # US Independence Day
    "calendar": "NYSE"
}

response = requests.get(base_url, params=params)

if response.status_code == 200:
    next_biz_day = response.json()
    print(json.dumps(next_biz_day, indent=2))
else:
    print(f"Error: {response.status_code} - {response.text}")

Fetch a Range of Holidays

Retrieve all `SIFMA-UK` holidays between two dates (e.g., `2025-01-01` and `2025-06-30`):

import requests
import json

base_url = "https://fincalapi.com/v1/holidays/range"
params = {
    "calendar": "SIFMA-UK",
    "start_date": "2025-01-01",
    "end_date": "2025-06-30"
}

response = requests.get(base_url, params=params)

if response.status_code == 200:
    holidays = response.json()
    print(f"SIFMA-UK Holidays (Jan-Jun 2025):\n{json.dumps(holidays, indent=2)}")
else:
    print(f"Error: {response.status_code} - {response.text}")