Skip to main content

Markets

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

import datetime

import requests
import pydantic

class Tag(pydantic.BaseModel):
kind: str
values: list[str]

class Market(pydantic.BaseModel):
ticker: str
name: str
tags: list[Tag]

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

Which will return data in the format:

[
{
"ticker": "BONDSGP",
"name": "Govt Bonds Singapore",
"tags": [
{
"kind": "investment_category_name",
"values": [
"Govt Bonds"
],
"sub_tags": null
},
{
"kind": "country_iso",
"values": [
"SGP"
],
"sub_tags": null
},
{
"kind": "investment_style_name",
"values": [
"Vanilla"
],
"sub_tags": null
}
]
},
{
"ticker": "CORPUSIG",
"name": "US Investment Grade Credit",
"tags": [
{
"kind": "investment_style_name",
"values": [
"Investment Grade"
],
"sub_tags": null
},
{
"kind": "country_iso",
"values": [
"USA"
],
"sub_tags": null
},
{
"kind": "investment_category_name",
"values": [
"Corporate Bond"
],
"sub_tags": null
}
]
},
...
]