Portfolio allocation by group and security
The sample demonstrates how to get multiple differently grouped Analytics+ result sets with a single request. The steps to achieve this are as follows:
Formulate an
analytics
query with theparameters
argument object.Define grouping parameter sets with unique keys and place them in a list as the value of
paramsSet
field ofparameters
.Under
analytics
, add multiplegrouppedAnalytics
fields, each with a unique alias and an argument matching a parameter set key.
For information about available parameters, see Parameters for analytics request. For grouping options, see Analytics+ grouping options.
Example request
Requests the following:
Portfolio allocation for a given date with grouping options passed as variables.
Portfolio allocation for a given date with grouping by security.
query AllocationByTypeAndSecurity ($ids: [Long], $reportDate: String, $locale:Locale, $groupBy:[GroupBy], $groupCode: String) { analytics( parameters: { pfIds: $ids startDate: $reportDate endDate: $reportDate paramsSet: [{ key:"ALLOCGROUP" timePeriodCodes:"GIVEN" grouppedByProperties: $groupBy groupCode: $groupCode locale: $locale includeData:false includeChildren:true }, { key:"ALLOCSECURITY" timePeriodCodes: "GIVEN" grouppedByProperties: SECURITY locale: $locale includeData: false includeChildren: true }] includeDrilldownPositions:false } ){ allocationGroupTotal:grouppedAnalytics(key:"ALLOCGROUP") { figures:firstAnalysis { marketValue } allocationByGroup:grouppedAnalytics { code name figures:firstAnalysis { marketValue shareOfTotal } } } allocationSecTotal:grouppedAnalytics(key:"ALLOCSECURITY") { figures: firstAnalysis { marketValue } allocationBySecurity: grouppedAnalytics { code name figures: firstAnalysis { marketValue shareOfTotal } } } } }
Variables
{ "reportDate": "2022-07-20", "ids": [214, 215, 233], "groupBy": "GROUP", "groupCode": "ASSET", "locale": "en-US" }
Result
{ "data": { "analytics": { "allocationGroupTotal": { "figures": { "marketValue": 410732441.6700001 }, "allocationByGroup": [ { "code": "EQUITY", "name": "Equity", "figures": { "marketValue": 360722143.10717094, "shareOfTotal": 0.8782411772503484 } }, { "code": "FIXED INCOME", "name": "Fixed Income", "figures": { "marketValue": 13068052.612829065, "shareOfTotal": 0.03181646075896896 } }, { "code": "ALTERNATIVE", "name": "Alternative", "figures": { "marketValue": 10130117.35, "shareOfTotal": 0.02466354327603605 } }, { "code": "OTHER", "name": "Other", "figures": { "marketValue": 26812128.599999998, "shareOfTotal": 0.06527881871464637 } } ] }, "allocationSecTotal": { "figures": { "marketValue": 410732441.67 }, "allocationBySecurity": [ { "code": "SE0000739161_SEK", "name": "AMF Aktiefond Världen", "figures": { "marketValue": 283465.66, "shareOfTotal": 0.0006901467506376046 } }, { "code": "NO0010668106_NOK", "name": "Alfred Berg Nordic High Yield C", "figures": { "marketValue": 3060419.89, "shareOfTotal": 0.00745112774037672 } }, { "code": "GOOGL US", "name": "Alphabet Inc", "figures": { "marketValue": 101572.67, "shareOfTotal": 0.00024729643849659145 } }, { "code": "AMZN US", "name": "Amazon.com Inc", "figures": { "marketValue": 168799.3, "shareOfTotal": 0.0004109714326768971 } }, { "code": "NO0010102866_NOK", "name": "DNB Grønt Norden A", "figures": { "marketValue": 493788.94, "shareOfTotal": 0.0012022155785705651 } }, { "code": "DIJP DC", "name": "Danske Invest-Japan Fund", "figures": { "marketValue": 16892736.72, "shareOfTotal": 0.04112832346847427 } }, { "code": "FAFiXED B", "name": "FA Fixed Income B", "figures": { "marketValue": 32672752.03, "shareOfTotal": 0.0795475319581663 } }, { "code": "FAMIXED C", "name": "FA Mixed + C", "figures": { "marketValue": 468361.82, "shareOfTotal": 0.0011403088056440936 } }, { "code": "FAMIXED A", "name": "FA Mixed+ A Inst", "figures": { "marketValue": 72340263.53, "shareOfTotal": 0.176125029802543 } }, { "code": "PE", "name": "FA Private Equity A", "figures": { "marketValue": 10130117.35, "shareOfTotal": 0.024663543276036055 } }, { "code": "FI0008800438_EUR", "name": "Nordea Nordic Small Cap K EUR", "figures": { "marketValue": 4845594.5, "shareOfTotal": 0.01179744770171614 } }, { "code": "NOK", "name": "Norwegian krone", "figures": { "marketValue": 26812128.599999998, "shareOfTotal": 0.06527881871464637 } }, { "code": "NO0010140502_NOK", "name": "SKAGEN Kon-Tiki A", "figures": { "marketValue": 228318191.4, "shareOfTotal": 0.5558805885205449 } }, { "code": "NO0010936917_NOK", "name": "STBNO Float 02/23/31", "figures": { "marketValue": 10026260.69, "shareOfTotal": 0.02441068606422749 } }, { "code": "NO0010788292_NOK", "name": "Storebrand Global ESG Plus A", "figures": { "marketValue": 1445234.66, "shareOfTotal": 0.003518676669716689 } }, { "code": "ERICA EU", "name": "Telefonaktiebolaget LM Ericsso", "figures": { "marketValue": 1543703.91, "shareOfTotal": 0.0037584172891808668 } }, { "code": "TEL NO", "name": "Telenor ASA", "figures": { "marketValue": 1129050, "shareOfTotal": 0.0027488697883453943 } } ] } } } }