| Actor | Fragment | Worker | State |
|---|---|---|---|
| 741602 | 64457 | 51 | running |
| 741603 | 64457 | 51 | running |
| 741773 | 64458 | 51 | running |
| 746419 | 64454 | 51 | running |
| 746420 | 64454 | 51 | running |
| 747589 | 64462 | 51 | running |
| 747590 | 64462 | 51 | running |
| 747647 | 64449 | 51 | running |
| 747648 | 64449 | 51 | running |
| 747649 | 64455 | 51 | running |
| 747650 | 64455 | 51 | running |
| 747698 | 64451 | 51 | running |
CREATE MATERIALIZED VIEW opportunity.portfolio_fx_exposure_delta_mv AS
SELECT
pag.portfolio_id,
c.dim_balance_date,
p.base_currency_code AS currency_code,
SUM(c.weight) AS fx_exposure_pct
FROM insights.position_by_currency_mv AS c
JOIN insights.portfolio_to_account_groups_mv AS pag
ON pag.account_group_id = c.account_group_id AND pag.type = 'all'
JOIN olap.portfolios_dm AS p
ON p.portfolio_id = pag.portfolio_id
LEFT JOIN asset_service.currencies_dm AS cur
ON cur.code = p.base_currency_code
WHERE
c.position_type = 'POSITION'
AND c.source_entity_type = 'portfolio'
AND NOT c.item_id IS NULL
AND (
p.base_currency_code IS NULL OR c.item_id <> p.base_currency_code
)
AND (
cur.anchor_currency_code IS NULL OR c.item_id <> cur.anchor_currency_code
)
AND CAST(c.dim_balance_date AS TIMESTAMPTZ) >= CURRENT_TIMESTAMP - INTERVAL '30 DAYS'
GROUP BY
pag.portfolio_id,
c.dim_balance_date,
p.base_currency_code