Rolling Up Options & Swaps Market Value by Fund in CoSet Views

published on 21 July 2026

Scenario: The Options & Swaps Extract

To give middle-office teams an instant snapshot of fund exposure and overnight movement, we want a aggregate view that rolls these trade-level rows up to the Fund level.

Source Columns:
- AsOfDate
- Fund
- Underlier
- InstrumentType (Swap / Call / Put)
- MarketValue
- PriorMarketValue

In our warehouse, we have a daily market-value table named options_swaps_mv. Each row represents a fund × underlier × instrument breakdown with today’s market value alongside the prior-day market value.

Building the View Step-by-Step

Calculated swap MV grouped and aggregated with embedded logic.
Calculated swap MV grouped and aggregated with embedded logic.

At the end of this process, we have a view with aggregates of calculations based on the data in your underlying table. This view automatically updates as data enters the system, removing the need to build time-sensitive reporting pipelines. Any data you have is simply transformed in real time.

In this walkthrough, we’ll set up a single fund-level view using daily options and swap data to track total market value, overnight P&L movement, call exposure, and concentration metrics—all in one place.

Option A: Ask AI to build this

AI Automatically generates a view based on your free text question.
AI Automatically generates a view based on your free text question.

Probably the simplest option for creating this view is just asking CoSet's AI harness to do so for you. Ask in a simple prompt how 

Option B: Set up manually

Here is how we construct the summary view directly inside CoSet Views.

1. Base Setup

  • Create View -> Select table options_swaps_mv
  • Set I want to = aggregates / rolls up groups of rows.
  • Set Group by -> Fund

2. Configure Select Columns & Inners

To build our summary metrics, we use a mix of CoSet’s aggregate inner types: Column, Calculated, and Conditional.

Fund Name:

  • Select: Reference Fund

Total Book Value (Column Inner):

  • Measure: SUM
  • Inner type: Column -> MarketValue
  • Display name: TotalMV

Overnight Change (Calculated Inner):

  • Measure: SUM
  • Inner type: Calculated -> Expression: MarketValue - PriorMarketValue
  • Display name: MvChange
  • Note: When writing expressions for calculated inners, always reference physical warehouse columns (MarketValue - PriorMarketValue) rather than display names of other select columns.

Total Lines (Empty-column COUNT):

  • Measure: COUNT (Leave the column selection empty to perform a standard COUNT(*))
  • Display name: PositionCount

Call Option Exposure (Conditional Inner):

  • Measure: SUM
  • Inner type: Conditional
  • Rule: When InstrumentType = 'Call', Then MarketValue, Default 0
  • Display name: CallMV

Unique Underliers (Distinct COUNT):

  • Measure: COUNT
  • Inner type: Column -> Underlier
  • Check option: Distinct
  • Display name: UnderlierCount
  • Note: Counting distinct values requires an explicit column (like Underlier), unlike an empty-column COUNT(*).

3. Save

CoSet Views allow you to sit directly on top of warehouse tables and reshape data without drafting SQL queries from scratch. If you need to transform daily position extracts into concise portfolio summaries, aggregate views do the heavy lifting for you.

Save the view to compile and run the aggregation over your dataset.

Expected Results

Once built, your view collapses hundreds of position-level rows into a clean, fund-by-fund summary table:

Demo Note: In our demo environment, this schema is loaded daily from options_swaps_mv_YYYYMMDD.csv
(~450 rows/day). The logic remains identical, though total figures will reflect the expanded daily file size rather than the sample numbers shown above.

Why This Layout Works

This view setup solves several common operational questions in a single screen:

TotalMV gives you instant valuation across books without writing custom rollups.

MvChange highlights overnight P&L swings directly, removing the need to manage a separate prior-day join table.

CallMV isolates listed option exposure even when large swap lines dominate the rest of the book.

PositionCount vs. UnderlierCount provides an immediate check on portfolio noise versus true underlying concentration.

When you’re managing ops, middle office, or data services for a multi-fund setup, you rarely want to stare at raw, trade-level extract tables just to answer high-level risk and exposure questions. Views with robust ability to create calculations and subsequently aggregate them, your teams can quickly and easily set up reports and present data without loading onto Dev teams' consistently packed backlogs.

What We Practiced

In this example, we utilized key aggregation techniques within CoSet Views:

  1. Using Group by to aggregate raw, transaction-level warehouse data up to the portfolio level.
  2. Applying Column vs. Calculated inners to run math over raw physical columns (MarketValue - PriorMarketValue) for day-over-day tracking.
  3. Leveraging Conditional inners to isolate specific instrument types (like Call) without filtering out the rest of the row data.
  4. Distinguishing between COUNT(*)and Distinct COUNT depending on whether you need a total row count or a unique count of underliers.

Read more