Write LINQ queries for a .NET application and explain how you would use them in database access at Balyasny Asset Management.
For this exercise, provide the PostgreSQL equivalent that a LINQ provider should generate. Include active portfolios, current active positions, aggregated gross exposure, and an exposure classification.
portfolio_id, portfolio_name, active_position_count, gross_exposure, and exposure_band.gross_exposure descending, then portfolio_id ascending.| Column | Type | Description |
|---|---|---|
| portfolio_idPK | INT | Unique portfolio identifier |
| portfolio_name | VARCHAR(100) | Portfolio display name |
| manager_name | VARCHAR(100) | Portfolio manager name |
| is_active | BOOLEAN | Whether the portfolio is active |
| Column | Type | Description |
|---|---|---|
| position_idPK | INT | Unique position identifier |
| portfolio_id | INT | Referenced portfolio |
| instrument_id | INT | Referenced instrument |
| quantity | NUMERIC(18,4) | Signed position quantity |
| as_of_date | DATE | Position valuation date |
| Column | Type | Description |
|---|---|---|
| instrument_idPK | INT | Unique instrument identifier |
| symbol | VARCHAR(20) | Instrument symbol |
| sector | VARCHAR(60) | Instrument sector |
| last_price | NUMERIC(18,4) | Latest available instrument price |
| is_active | BOOLEAN | Whether the instrument is active |