curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_ticker": "<string>",
"p_from": null,
"p_to": null,
"p_sector": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose"
payload = {
"p_ticker": "<string>",
"p_from": None,
"p_to": None,
"p_sector": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({p_ticker: '<string>', p_from: null, p_to: null, p_sector: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"ticker": "<string>",
"isin": "<string>",
"setor_current": "<string>",
"status": "<string>",
"window_from": "2023-12-25",
"window_to": "2023-12-25",
"window_sessions": 123,
"n_returns": 123,
"stock_series": "<string>",
"sector_leg": "<string>",
"sector_leg_basis": "<string>",
"market_share": 123,
"sector_share": 123,
"residual_share": 123,
"vol_total": 123,
"vol_market": 123,
"vol_sector": 123,
"vol_residual": 123,
"beta_market": 123,
"beta_sector": 123,
"gamma": 123,
"hedge_ibov": 123,
"hedge_sector": 123,
"ex_shock_n_returns": 123,
"ex_shock_market_share": 123,
"ex_shock_sector_share": 123,
"ex_shock_residual_share": 123,
"ex_shock_vol_total": 123,
"ex_shock_beta_market": 123,
"ex_shock_beta_sector": 123,
"ex_shock_hedge_ibov": 123,
"ex_shock_hedge_sector": 123,
"shock_dates": [
"2023-12-25"
],
"shock_sensitive": true,
"null_sessions": 123,
"null_reasons": {},
"no_trade_sessions": 123,
"zero_returns": 123,
"illiquid": true,
"beta_dimson": 123,
"flags": [
"<string>"
],
"method": "<string>",
"data_revision": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}risk_decompose
Where the daily return variance of one B3 share or unit lives, over a window: market (IBOV), sector (a B3 sector index, made orthogonal to IBOV) and residual (the part specific to the stock). One row. market_share, sector_share and residual_share add to 1; vol_* are annualized volatilities; beta_market, beta_sector, gamma (the sector index’s beta to IBOV) and hedge ratios per R$ 1 long (hedge_ibov = -(beta_market - beta_sector x gamma), hedge_sector = -beta_sector). The ex_shock_* columns are the same split without the shock sessions (shock_dates: |IBOV return - median| > 4 x 1.4826 x MAD), NULL when there is none; shock_sensitive when a share moves more than 0.10. Method: OLS cascade on daily simple returns computed from the inner join of the stock’s close_total_return (dividends reinvested) and the total-return index levels on trade_date, so every series spans the same sessions. Sessions with no total return are dropped and counted (null_reasons); above 10% of the window the stock leg is close_adj for the whole window (stock_series price_only, no dividends). Sector leg (p_sector NULL): SILO’s map from today’s CVM setor: IFNC banks and insurers, IMAT steel, mining, pulp, petrochemicals and packaging, IEEX electric power, UTIL sanitation and gas, IMOB construction, ICON retail, food, beverages, textiles, education, travel and leisure; any other setor has no sector leg (two parts, flag no_sector_index). The map is not index membership. p_sector = an index code held other than IBOV, or none. Window: p_to defaults to today (moved to the last IBOV session), p_from to 252 returns back, clamped to the ticker’s first session (flag window_clamped); more than 1000 sessions RAISES 22023. Fewer than 120 returns: status insufficient_sample, the split columns NULL. illiquid when no-trade sessions or zero returns exceed 5% of the window (stale prices bias betas to 0; beta_dimson is the check). Realized and historical only, not investment advice. Refusals from quote_history (unknown_ticker, …) pass through.
curl --request POST \
--url https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose \
--header 'Content-Type: application/json' \
--header 'apikey: <api-key>' \
--data '
{
"p_ticker": "<string>",
"p_from": null,
"p_to": null,
"p_sector": null
}
'import requests
url = "https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose"
payload = {
"p_ticker": "<string>",
"p_from": None,
"p_to": None,
"p_sector": None
}
headers = {
"apikey": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {apikey: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({p_ticker: '<string>', p_from: null, p_to: null, p_sector: null})
};
fetch('https://zcjbtpxuhdekpwcxmepn.supabase.co/rest/v1/rpc/risk_decompose', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));[
{
"ticker": "<string>",
"isin": "<string>",
"setor_current": "<string>",
"status": "<string>",
"window_from": "2023-12-25",
"window_to": "2023-12-25",
"window_sessions": 123,
"n_returns": 123,
"stock_series": "<string>",
"sector_leg": "<string>",
"sector_leg_basis": "<string>",
"market_share": 123,
"sector_share": 123,
"residual_share": 123,
"vol_total": 123,
"vol_market": 123,
"vol_sector": 123,
"vol_residual": 123,
"beta_market": 123,
"beta_sector": 123,
"gamma": 123,
"hedge_ibov": 123,
"hedge_sector": 123,
"ex_shock_n_returns": 123,
"ex_shock_market_share": 123,
"ex_shock_sector_share": 123,
"ex_shock_residual_share": 123,
"ex_shock_vol_total": 123,
"ex_shock_beta_market": 123,
"ex_shock_beta_sector": 123,
"ex_shock_hedge_ibov": 123,
"ex_shock_hedge_sector": 123,
"shock_dates": [
"2023-12-25"
],
"shock_sensitive": true,
"null_sessions": 123,
"null_reasons": {},
"no_trade_sessions": 123,
"zero_returns": 123,
"illiquid": true,
"beta_dimson": 123,
"flags": [
"<string>"
],
"method": "<string>",
"data_revision": "<string>"
}
]{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}{
"code": "22023",
"message": "<string>",
"details": "<string>",
"hint": "<string>"
}Authorizations
Body
Response
The result set, oldest first. An unknown id is an empty array, not a 404 and never a guessed value.
Was this page helpful?