Skip to main content
Developing with Position Attributes

Integrate position attributes via the API for custom group analytics

Edgar Nuñez avatar
Written by Edgar Nuñez
Updated over a year ago

Attributes are a way to help customers group securities together through semantic categories. For example, some common categories are: strategy, analyst, theme — where each of these categories would contain a list of attributes that are applied to positions.

To find out if attributes is best suited for your needs please take a look at the different grouping and custom category tools available.

Attributes overview

Position attributes are provided on a per-position, per-upload basis, and matched on securities with matching attributes. Attribute data only lives within the portfolio (not able to be used in another portfolio). Attributes have been optimized to load very quickly, handle large portfolios, and are more aligned with the data structure that customers maintain (excel files with attributes listed in the same row as the corresponding position).

Matching data
Providing attributes with position set or PNL data is used to match positions together, only if both pieces of data include the same category:value pair. This means that the selected group will provide the matching function — currently OP can only match against one group at a time.

Example

Day 1 - position set
MSFT - analyst: bob, theme: cloud
MSFT — analyst: bob, theme: tech

Day 1 - pnl
MSFT - analyst: bob, theme: tech
MSFT - null, theme: cloud

Day 2 - position set
MSFT — analyst: bob, theme: cloud
MSFT — analyst: bob, null


In this case, when grouping by analyst, MSFT will be aggregated since both positions contain the same group, “bob”.

Getting familiar with attributes data structures

Understanding the above distinction for position attributes enables in-depth portfolio analysis. The following data structures demonstrate how Omega Point handles uploading positions with attributes:

Position Attributes (as a property in the position set)

{
date:"2020-01-02"
equities:[{
id:{
ticker:"AAPL"
mic:"XNAS"
}
economicExposure: 1000000
attributes: [{
category: "theme"
value: "cloud"
},{
category: "analyst"
value: "SC"
}]
},{
id:{
ticker:"GOOG"
mic:"XNAS"
}
lotId:"A1"
economicExposure: 1000000
attributes: [{
category: "theme"
value: "cloud"
},{
category: "analyst"
value: "SC"
}]
}]
}

Attributes are an additional property for each position in the position set. It allows for a list of category:value pairs, and can be provided daily. The category or value do not need to be defined ahead of time to upload, but the category does need to be registered to make use of it within the API and application.

Note that LotId acts independently of attributes and can be provided if its available. LotIds will help act as a manually provided position uniqueness identifier. All positions are treated as unique even if they have no matching attributes, however, current functionality defaults to aggregating similar securities, which doesn’t support requesting data on individual (fractionalized) positions. There are plans that would allow retrieving individual positions back.

Position Attributes: Attribute Categories & Assigning Attributes to a Position
Position Attributes are a combination of category: [value1, value2, ...], where values exist with each position.

Attribute categories offer a way to organize mutually-exclusive attributes together, which then allows positions to be grouped / segmented. Attribute categories can be created at any time, and could be thought of as a container of attribute values. These are the associated API endpoints for managing attribute categories:

  • mutation.createPositionAttributeCategory

    mutation{
    createPositionAttributeCategory(
    resourceId:"pattr" resourceType:PORTFOLIO
    category:{
    id:"theme"
    name:"My themes"
    description:"Grouping positions by their theme"
    }
    ){
    id
    description
    }
    }
  • mutation.updatePositionAttributeCategory

  • mutation.deletePositionAttributeCategory


Providing Position Attributes

Note: attribute categories do not need to be created ahead of time, but attributes will not be used for queries without first registering the category.

Once the attribute category has been created, then assigning each position with its respective attribute can be achieved through the position set upload mutation, which includes additional fields for case-insensitive attributes

  • mutation.uploadPositionSetDate

    mutation{
    uploadPositionSetDate(
    portfolioId:"pattr",
    data:{
    date:"2020-01-02"
    equities:[
    {
    id:{ticker:"AMZN", mic:"XNAS"},
    economicExposure:5000
    attributes:[
    {category:"theme" value:"cloud"},
    {category:"manager" value:"SC"}
    ]
    }
    {id:{ticker:"AAPL", mic:"XNAS"}, economicExposure:5000, attributes:[{category:"theme", value:"CLouD"},{category:"manager", value:"jojo"}]}
    {id:{ticker:"AMZN", mic:"XNAS"}, economicExposure:1000, attributes:[{category:"theme", value:"tech"},{category:"manager", value:"SC"}]}
    {id:{ticker:"AAPL", mic:"XNAS"}, economicExposure:1000, attributes:[{category:"theme", value:"tech"},{category:"manager", value:"SC"}]}
    {id:{ticker:"GOOG", mic:"XNAS"}, economicExposure:1000, attributes:[{category:"theme", value:"TECH"},{category:"manager", value:"SC"}]}
    ]
    }
    ){
    ok
    }


We see a similar structure for pnl with attributes:

mutation{
uploadPnlDate(
portfolioId:"pattr"
data: {
date:"2020-01-02"
equities:[
{
id:{ticker:"AAPL" mic:"XNAS"}
amount: 100,
attributes:[
{ category:"Manager", value:"Jojo"},
{ category:"theme", value:"cloud"}
]
},{
id:{ticker:"AAPL" mic:"XNAS"}
amount: 100,
attributes:[
{ category:"Manager", value:"SC"},
{ category:"theme", value:"tech"}
]
}
]
}
){
ok
}
}


Once the position has been populated with its respective attribution data, you can use this query to check the results of your attribution assignment:

{
portfolio(id: "pattr") {
positionAttributeCategories {
id
name
description
}
dates(from: "2020-01-02", to: "2021-01-02") {
date
equities {
id {
ticker
}
economicExposure
attributes {
value
category
}
}
}
}
}


Portfolio Analysis with Attributes

Once the above Attributes CRUD and Attributes assignment workflows have been completed, we can now make use of this data through the API and the UI.

API
In the API, all grouped* endpoints (groupedPerformanceContributors, groupedRiskContributors, composition.compositionBy, etc) can be configured to request the portfolio with attributes.


UI
Now that the data has been updated through the API, position attributes can be utilized within the UI through group dropdown feature (analyze trends contributors & asset groups)


Sample grouped performance contribution simulation with attribution

query ($modelId: String!, $portfolioId: String!, $from: Date!, $to: Date!, $groupBy: ContributorGroupType!, $groupById: String, $segment: Segment, $includeNotHeld: Boolean) {
model(id: $modelId) {
simulation(
positionSet: {type: PORTFOLIO, id: $portfolioId, segment: $segment}
from: $from
to: $to
) {
groupedPerformanceContributors(
groupBy: $groupBy
groupById: $groupById
includeNotHeld: $includeNotHeld
) {
name
id
total
averagePercentEquity
attribution {
summary {
factors
specific
trading
}
factors {
id
category
value
}
}
contributors {
id
bloombergTicker
notHeld
averagePercentEquity
total
attribution {
summary {
factors
specific
trading
}
}
}
}
}
}
}

Variables

{
"modelId": "QES-US",
"portfolioId": "pattr",
"from": "2020-01-02",
"to": "2021-01-02",
"segment": null,
"groupBy": "POSITION_ATTRIBUTE",
"groupById": "theme"
}
Did this answer your question?