Blogcomposition

When macro meets markets

Compose official macro prints with market quotes and indicators in one client workflow.

ShareXLinkedInFacebookTelegramRedditEmailCopy linkMarkdown
When macro meets markets - Sugra API blog

Composition: Macro + Finance desk

Series: compositions (1 of 4)
Prerequisites: Platform intro, Finance, Macro
Directions: Macro + Finance only
Auth: x-api-key

This article does not re-explain each direction. It shows how to compose official macro prints with market surfaces in one client workflow.

Not investment advice.


Goal

Answer in one scheduled job:

  1. What is the official US growth / inflation / curve / policy stance?
  2. How are equities (or a sector leader) printing against that backdrop?

You keep logic client-side. Sugra does not return a blackbox “regime score” for trading.


Call sequence

[Macro]  FRED GDPC1?units=pc1
[Macro]  FRED CPIAUCSL?units=pc1
[Macro]  FRED UNRATE
[Macro]  FRED T10Y2Y
[Macro]  BIS cb-rates/US
[Macro]  Treasury yield-curve
[Finance] quote for benchmark (e.g. SPY or sector leader)
[Finance] optional RSI or historical window
         -> client reduce to {regime, market_snapshot}

1-6 Macro (see Macro article / macro-regime-monitor recipe)

H="x-api-key: $SUGRA_API_KEY"
B=https://sugra.ai

curl -H "$H" "$B/api/v1/fred/series/GDPC1?limit=2&units=pc1"
curl -H "$H" "$B/api/v1/fred/series/CPIAUCSL?limit=2&units=pc1"
curl -H "$H" "$B/api/v1/fred/series/UNRATE?limit=2"
curl -H "$H" "$B/api/v1/fred/series/T10Y2Y?limit=2"
curl -H "$H" "$B/api/v1/bis/cb-rates/US?last_n=2"
curl -H "$H" "$B/api/v2/fixed-income/treasury/yield-curve"

7-8 Finance

curl -H "$H" "$B/api/v2/quotes/SPY/price"
curl -H "$H" "$B/api/v1/indicators/rsi?symbol=SPY&time_period=14&interval=1d&outputsize=5"

Client reduce (example)

def compose(macro, finance):
    gdp = macro["gdp_yoy"]
    cpi = macro["cpi_yoy"]
    t10y2y = macro["t10y2y"]
    policy = macro["policy_rate"]
    px = finance["price"]
    chg = finance["change_pct"]
    return {
        "as_of": {
            "macro_sources": ["fred", "bis", "us_treasury"],
            "market_source": "sugra_finance",
        },
        "regime": {
            "growth": "expansion" if gdp > 0 else "contraction",
            "inflation": "above_target" if cpi > 2 else "at_or_below_target",
            "curve": "inverted" if t10y2y < 0 else "normal",
            "real_policy_approx": round(policy - cpi, 2),
        },
        "market": {
            "symbol": finance["symbol"],
            "price": px,
            "change_pct": chg,
            "rsi_14": finance.get("rsi_14"),
        },
        "disclaimer": "Data composition only. Not investment advice.",
    }

Persist meta.data_time / meta.source from each leg into your output for audit.


Why this composition works

Leg Strength carried in
Macro Official record, transforms, multi-institution cross-check
Finance Fat quote + platform RSI under same key

You get context + market print without a second vendor auth stack.


Cadence and quota

Leg Natural refresh
GDP quarterly
CPI / UNRATE monthly
T10Y2Y / curve daily
Equity quote / RSI session / daily bar

Do not poll all six macro series every minute. Cache macro until release calendars move; refresh market more often if your product needs it. Count against one daily plan quota.

Rough cost: 8 calls per full refresh (or fewer if you cache macro).


Failure modes

Failure Handling
FRED or BIS 503 Keep last good macro JSON; mark macro_stale: true
Quote fails Return regime without market; do not invent prices
429 Stop job; wait for UTC reset
Partial curve holiday Document last curve date from response

What not to claim in product copy

  • “Sugra says buy/sell”
  • “Real-time macro nowcast”
  • That client thresholds are official Fed communications

Integrate with one key across every product direction.

Get API keyDocsFamily