# Analytics

## Fetch analytics data

> The \`analytics\` endpoint returns all analytical data for an entity, position, transaction or asset. This includes market values, exposures, risk, performance, and other metrics.

```json
{"openapi":"3.1.0","info":{"title":"gateway-api","version":"0.0.1"},"servers":[{"url":"https://data.api.landytech.net","description":"Generated server url"}],"security":[{"basicAuth":[]}],"paths":{"/api/v2/analytics":{"post":{"tags":["analytics"],"summary":"Fetch analytics data","description":"The `analytics` endpoint returns all analytical data for an entity, position, transaction or asset. This includes market values, exposures, risk, performance, and other metrics.","operationId":"getAnalyticsData","parameters":[{"name":"X-Result-Limit","in":"header","description":"Maximum number of items to retrieve","required":false,"schema":{"type":"integer","format":"int32"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsDataBody"}}},"required":true},"responses":{"200":{"description":"List of data with selected fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"401":{"description":"Unauthorized, missing or invalid authentication"},"403":{"description":"Forbidden, user does not have permission"}}}}},"components":{"schemas":{"AnalyticsDataBody":{"type":"object","description":"Request body for analytics data","properties":{"fields":{"type":"array","description":"List of analytics fields to request","items":{"$ref":"#/components/schemas/AnalyticsField"}},"ids":{"type":"array","description":"List of entity ids to fetch","items":{"type":"integer","format":"int64"}},"consolidationType":{"type":"string","default":"DIRECT","description":"DIRECT returns the entity's directly held assets. LOOK_THROUGH includes transactions of underlying entities linked through configured look-through relationships. If not provided, DIRECT is used","enum":["DIRECT","LOOK_THROUGH"]},"since":{"type":"string","format":"date","default":"2000-01-01","description":"Start date for the data to fetch"},"until":{"type":"string","format":"date","description":"End date for the data to fetch. If not provided, latest published date is used"},"sort":{"$ref":"#/components/schemas/AnalyticsSort","description":"Choose the field to sort the data by. If using the naming feature, use the custom field name. Default value depends on the data being requested: POSITION.DATE, TRANSACTION.DATE, ENTITY.ID or ASSET.ID"}},"required":["consolidationType","fields","ids","since"]},"AnalyticsField":{"type":"object","description":"List of fields to request","properties":{"code":{"type":"string","description":"Field code"},"name":{"type":"string","description":"Field name. Has the same value as code by default"},"parameters":{"type":"object","additionalProperties":{},"description":"Additional parameters for the field"}},"required":["code"]},"AnalyticsSort":{"type":"object","properties":{"name":{"type":"string","description":"Field code used for sorting. Default value depends on the data being requested: POSITION.DATE, TRANSACTION.DATE, ENTITY.ID or ASSET.ID"},"ascending":{"type":"boolean","default":true,"description":"True if sorting by the chosen field in ascending order, false if descending"}},"required":["ascending","name"]},"AnalyticsResponse":{"type":"object","description":"Analytics data returned by the API","properties":{"content":{"$ref":"#/components/schemas/AnalyticsDetails","description":"Analytics data details"}}},"AnalyticsDetails":{"type":"object","description":"Analytics data details returned by the API","properties":{"ENTITY.ID":{"type":"integer","format":"int64","description":"Unique identifier of the entity the request was made for. This identifier is created by Sesame"},"ENTITY.NAME":{"type":"string","description":"Name of the entity the request was made for"},"ENTITY.TYPE":{"type":"string","description":"Type of the entity","enum":["FUND","HOLDING_COMPANY","TRUST","PORTFOLIO","PERSONAL","BASKET","BENCHMARK","GROUPING","CONSOLIDATION"]},"ENTITY.PORTFOLIO_PARENT_ENTITY_ID":{"type":"integer","format":"int64","description":"Parent entity ID of a portfolio entity"},"ENTITY.REPORTING_CURRENCY":{"type":"string","description":"Reporting currency of the entity, as defined in Sesame"},"ASSET.NAME":{"type":"string","description":"Name of the investment being transacted"},"ASSET.ID":{"type":"integer","format":"int64","description":"ID of the investment being transacted. This identifier is created by Sesame"},"ASSET.TYPE":{"type":"string","description":"Type of the investment being transacted"},"TRANSACTION.SUBTYPE":{"type":"string","description":"Subtype of the transaction. For a full list of supported subtypes, see the list in `FAQ and Troubleshooting`"},"TRANSACTION.CUSTODIAN_TRANSACTION_ID":{"type":"string","description":"Unique identifier of the transaction, as provided in the custodial feed. When not provided by the custodian, a unique transaction Id is generated by Sesame"},"TRANSACTION.DESCRIPTION":{"type":"string","description":"Description of the transaction, as provided in the custodial feed. When not provided by the custodian, a description is generated by Sesame"},"TRANSACTION.DATE":{"type":"string","format":"date","description":"Date of the transaction."},"TRANSACTION.SETTLEMENT_DATE":{"type":"string","format":"date","description":"Settlement date of the transaction."},"TRANSACTION.MOVEMENT_LOCAL":{"type":"number","description":"Net transaction value, in local currency"},"TRANSACTION.GROSS_MOVEMENT_LOCAL":{"type":"number","description":"Gross transaction value, in local currency"},"TRANSACTION.QUANTITY":{"type":"number","description":"Units of the investment transacted"},"TRANSACTION.NET_UNIT_PRICE_LOCAL":{"type":"number","description":"Net unit price of the transaction, in local currency"},"TRANSACTION.GROSS_UNIT_PRICE_LOCAL":{"type":"number","description":"Gross unit price of the transaction, in local currency"},"TRANSACTION.LOCAL_CURRENCY":{"type":"string","description":"Currency that the transaction is denominated in"},"TRANSACTION.LOCAL_CURRENCY2":{"type":"string","description":"The local currency of the incoming cash where the transaction is an internal FX transaction"},"TRANSACTION.MOVEMENT_REPORTING":{"type":"number","description":"Net transaction value, in reporting currency"},"TRANSACTION.GROSS_MOVEMENT_REPORTING":{"type":"number","description":"Gross transaction value, in reporting currency"},"TRANSACTION.GRANULARITY":{"$ref":"#/components/schemas/TransactionGranularityDetails","description":"Granularity of the transaction."},"TRANSACTION.PRIVATE_FUND_GRANULARITY":{"$ref":"#/components/schemas/PrivateFundGranularityDetails","description":"Private fund granularity of the transaction."},"TRANSACTION.REVERSAL":{"type":"boolean","description":"A boolean indicating whether this transaction is reversing a previous transaction"},"TRANSACTION.CUSTODIAN_REVERSED_TRANSACTION_ID":{"type":"string","description":"Where available, the CUSTODIAN_TRANSACTION_ID of the transaction which this transaction is reversing. Only seen for transactions where reversal = `true`. This field helps users connect reversal transactions and the transactions that they are reversing"},"POSITION.DATE":{"type":"string","format":"date","description":"The date of the position in the investment"},"POSITION.QUANTITY":{"type":"number","description":"Quantity of units of the investment held"},"POSITION.MARKET_VALUE_LOCAL":{"type":"number","description":"Market value of the holding, in local currency"},"POSITION.UNIT_PRICE_LOCAL":{"type":"number","description":"Price per unit of the investment held, in local currency"},"POSITION.LOCAL_CURRENCY":{"type":"string","description":"Currency that the position is denominated in"},"ENTITY.RETURN":{"type":"number","description":"Total gain or loss generated by an investment entity over a specific period, expressed as a percentage of the portfolio's value.\nNeeds the period parameter (possible values are: \"DTD\", \"FYTD\", \"ITD\", \"LAST\", \"MTD\", \"QTD\", \"WTD\", \"YTD\")\nOptional parameters are:\n- methodology (possible values are: \"SIMPLE\", \"COMPOUNDED\", \"STDEV\", \"AVG\")\n- entity (possible values are: \"ENTITY\", \"DEFAULT_BENCHMARK\")\n- frequency (possible values are: \"DAILY\", \"WEEKLY\", \"MONTHLY\", \"YEARLY\")\n- start_date: From the given date (\"YYYY-MM-DD\")\n- end_date: To the given date (\"YYYY-MM-DD\")"},"POSITION.RETURN":{"type":"number","description":"The position return is calculated by compounding daily returns from t0 to t, using the daily PnL or the position at t in reporting currency, the previous days market value notional of the position in reporting currency, and the sum of transactions for the position on t. For Trading Pnl (and therefore FX Pnl) we use FX rate as of t when transforming daily PnL from t0 to t into reporting currency.\nNeeds the period parameter (possible values are: \"DTD\", \"FYTD\", \"ITD\", \"LAST\", \"MTD\", \"QTD\", \"WTD\", \"YTD\")\nOptional parameters are:\n- frequency (possible values are: \"DAILY\", \"WEEKLY\", \"MONTHLY\", \"YEARLY\")\n- start_date: From the given date (\"YYYY-MM-DD\")\n- end_date: To the given date (\"YYYY-MM-DD\")"},"ENTITY.EXPOSURE":{"type":"number","description":"Total notional exposure of the entity, expressed in %AUM.\nNeeds the kind parameter (possible values are: \"LONG\", \"SHORT\", \"NET\", \"GROSS\")\nOptional parameters are:\n- _format (possible values are: \"AMOUNT\", \"PERCENTAGE\", \"BASIS_POINTS\")\n- exposure_aggregation (possible values are: \"SUM\", \"MAX\", \"MIN\", \"COUNT\")"},"POSITION.EXPOSURE":{"type":"number","description":"Total notional exposure of the position, expressed in %AUM.\nOptional parameters are:\n- kind (possible values are: \"LONG\", \"SHORT\", \"NET\", \"GROSS\")"},"POSITION.AGGREGATED_PNL":{"type":"number","description":"Aggregated pnl value of the position.\nNeeds the period parameter (possible values are: \"DTD\", \"FYTD\", \"ITD\", \"LAST\", \"MTD\", \"QTD\", \"WTD\", \"YTD\")\nOptional parameters are:\n- _format (possible values are: \"AMOUNT\", \"PERCENTAGE\", \"BASIS_POINTS\")\n- aggregation (possible values are: \"SUM\", \"MAX\", \"MIN\", \"AVG\", \"PROD\")\n- frequency (possible values are: \"DAILY\", \"WEEKLY\", \"MONTHLY\", \"YEARLY\")\n- _types (possible values in the array are: \"TOTAL\", \"INCOME\", \"FX\", \"TRADING\", \"REALISED\", \"UNREALISED\")\n- start_date: From the given date (\"YYYY-MM-DD\")\n- end_date: To the given date (\"YYYY-MM-DD\")"},"ENTITY.PNL":{"type":"number","description":"Aggregation of the DTD PnLs of an entity for a given period of time.\nNeeds the period parameter (possible values are: \"DTD\", \"FYTD\", \"ITD\", \"LAST\", \"MTD\", \"QTD\", \"WTD\", \"YTD\")\nOptional parameters are:\n- _format (possible values are: \"AMOUNT\", \"PERCENTAGE\", \"BASIS_POINTS\")\n- aggregation (possible values are: \"SUM\", \"MAX\", \"MIN\", \"AVG\", \"PROD\")\n- frequency (possible values are: \"DAILY\", \"WEEKLY\", \"MONTHLY\", \"YEARLY\")\n- _types (possible values in the array are: \"TOTAL\", \"INCOME\", \"FX\", \"TRADING\", \"REALISED\", \"UNREALISED\")\n- methodology (possible values are: \"SIMPLE\", \"CARINO\")\n- start_date: From the given date (\"YYYY-MM-DD\")\n- end_date: To the given date (\"YYYY-MM-DD\")"},"POSITION.MARKET_VALUE_NOTIONAL_REPORTING":{"type":"number","description":"Market value of the position in reporting currency."},"ENTITY.CUMULATIVE_PERFORMANCE":{"type":"number","description":"Cumulative performance value of the entity."},"ASSET.CUMULATIVE_PERFORMANCE":{"type":"number","description":"Cumulative performance value of the asset.\nNeeds the period parameter (possible values are: \"DTD\", \"FYTD\", \"ITD\", \"LAST\", \"MTD\", \"QTD\", \"WTD\", \"YTD\")"},"ENTITY.RISK":{"type":"number","description":"Risk value of the entity.\nNeeds the risk_measure_id parameter (integer), which can be found at docs.landytech.com"},"POSITION.RISK":{"type":"number","description":"Risk value of the position.\nNeeds the risk_measure_id parameter (integer), which can be found at docs.landytech.com"}},"required":["ASSET.CUMULATIVE_PERFORMANCE","ASSET.ID","ASSET.NAME","ASSET.TYPE","ENTITY.CUMULATIVE_PERFORMANCE","ENTITY.EXPOSURE","ENTITY.ID","ENTITY.NAME","ENTITY.PNL","ENTITY.REPORTING_CURRENCY","ENTITY.RETURN","ENTITY.RISK","ENTITY.TYPE","POSITION.AGGREGATED_PNL","POSITION.DATE","POSITION.EXPOSURE","POSITION.LOCAL_CURRENCY","POSITION.MARKET_VALUE_LOCAL","POSITION.MARKET_VALUE_NOTIONAL_REPORTING","POSITION.QUANTITY","POSITION.RETURN","POSITION.RISK","POSITION.UNIT_PRICE_LOCAL","TRANSACTION.CUSTODIAN_TRANSACTION_ID","TRANSACTION.DATE","TRANSACTION.DESCRIPTION","TRANSACTION.LOCAL_CURRENCY","TRANSACTION.MOVEMENT_LOCAL","TRANSACTION.QUANTITY","TRANSACTION.REVERSAL","TRANSACTION.SUBTYPE"]},"TransactionGranularityDetails":{"type":"object","description":"A breakdown of the difference between MOVEMENT_LOCAL and GROSS_MOVEMENT_LOCAL","properties":{"COMMISSIONS_LOCAL":{"type":"integer","format":"int64","description":"Value of commissions associated with the transaction, in local currency"},"STAMP_DUTY_LOCAL":{"type":"integer","format":"int64","description":"Value of stamp duties associated with the transaction, in local currency"},"WITHHOLDING_TAX_LOCAL":{"type":"integer","format":"int64","description":"Value of withholdings tax associated with the transaction, in local currency"},"COLLECTION_CHARGE_LOCAL":{"type":"integer","format":"int64","description":"Value of collection charges associated with the transaction, in local currency"},"TAX_LOCAL":{"type":"integer","format":"int64","description":"Value of taxes, duties associated with the transaction, in local currency"},"ACCRUED_INTEREST_LOCAL":{"type":"integer","format":"int64","description":"The value of the accrued interest when a fixed income investment is transacted, in local currency"}}},"PrivateFundGranularityDetails":{"type":"object","description":"Provides a breakdown of MOVEMENT_LOCAL for Capital Calls, Distributions and Equalisations","properties":{"PE_DEDUCTIBLE":{"type":"integer","format":"int64","description":"The portion of a capital call which reduces the remaining commitment or the portion of an equalisation which increases the remaining commitment, in local currency"},"PE_NON_DEDUCTIBLE":{"type":"integer","format":"int64","description":"The portion of a capital call which does not reduce the remaining commitment or the portion of an equalisation which does not increase the remaining commitment, in local currency"},"PE_INVESTMENT":{"type":"integer","format":"int64","description":"The portion of a capital call which goes towards purchasing portfolio companies or the portion of an equalisation which refunds for amounts previously paid towards purchasing portfolio companies, in local currency"},"PE_MANAGEMENT_FEES":{"type":"integer","format":"int64","description":"The portion of a capital call which is used for covering management fees or the portion an equalisation representing the pro-rata rebate for previously paid management fees, in local currency"},"PE_FUND_EXPENSES":{"type":"integer","format":"int64","description":"The portion of a capital call which is used for covering fund expenses or the portion of an equalisation representing the pro-rata rebate for previously paid fund expenses, in local currency"},"PE_OTHER_FEES":{"type":"integer","format":"int64","description":"The portion of a capital call which is used for covering other fund fees or the portion an equalisation representing the pro-rata rebate for previously paid other fund fees, in local currency"},"PE_EQUALISATION":{"type":"integer","format":"int64","description":"The portion of a capital call which is a catch-up equalisation payment or the portion of an equalisation which is received following catch-up equalisation by other investors, where above granularity is not provided, in local currency"},"PE_RECALLABLE":{"type":"integer","format":"int64","description":"The portion of the distribution that is recallable, in local currency"},"PE_NON_RECALLABLE":{"type":"integer","format":"int64","description":"The portion of the distribution that is non-recallable, in local currency"},"PE_CAPITAL_RETURN":{"type":"integer","format":"int64","description":"The portion of the distribution that represents a return of capital to the LP, in local currency"},"PE_CAPITAL_GAIN":{"type":"integer","format":"int64","description":"The portion of the distribution that is a capital gain (this can be negative, indicating a capital loss), in local currency"},"PE_INCOME":{"type":"integer","format":"int64","description":"The portion of the distribution that represents income, in local currency"}}}}}}
```
