Skip to main content

Horizons

To get an array of all available Horizons in our API with relation to Forecasts you can use the Get Forecast Horizons endpoint.

import datetime

import requests
import pydantic

class Horizon(pydantic.BaseModel):
name: str

url = "https://api.clearmacro.com/api/v3/forecast/horizon/"
headers = {"accept": "application/json", "X-API-KEY": "YOUR_API_KEY"}
response = requests.get(url=url, headers=headers)
horizons = [Horizon(**horizon) for horizon in response.json()]

Which will return data in the format:

[
{
"name": "Week"
},
{
"name": "Month"
},
{
"name": "3 Months"
},
...
]