Skip to content

Creating Scenarios

A scenario is a container for one or more hypothetical trades that you want to simulate against your portfolio. This guide covers everything you need to know about creating and organizing scenarios.


What Is a Scenario?

A scenario represents a "snapshot" of your portfolio with proposed changes applied. It includes:

  • Base Portfolio: Your current holdings (from a workbook or sample data)
  • Proposed Trades: One or more buy/sell actions to simulate
  • Simulation Results: Compliance test outcomes after trades are applied
  • Metadata: Name, description, status, and audit information
erDiagram
    SCENARIO ||--o{ TRADE : contains
    SCENARIO ||--o{ RESULT : generates
    SCENARIO }|--|| WORKBOOK : references

    SCENARIO {
        uuid id
        string name
        string description
        string status
        uuid base_workbook_id
        datetime created_at
    }
    TRADE {
        uuid id
        string trade_type
        string cusip
        decimal par_value
        string rating
    }
    RESULT {
        uuid id
        string test_name
        decimal current_value
        decimal projected_value
        string impact_direction
    }

Scenario Lifecycle

Every scenario progresses through these states:

Status Description Actions Available
draft Initial state, can add/remove trades Add trades, modify, delete
calculating Simulation in progress View only
completed Simulation finished successfully View results, delete
failed Simulation encountered an error Retry, modify, delete
stateDiagram-v2
    [*] --> draft: Create Scenario
    draft --> calculating: Run Simulation
    calculating --> completed: Success
    calculating --> failed: Error
    completed --> [*]: Delete
    failed --> draft: Modify & Retry
    failed --> [*]: Delete

Creating a Scenario via UI

Step 1: Navigate to Scenarios

From the CalcBridge dashboard, click "Scenarios" in the main navigation or use the quick access card.

Step 2: Click "New Scenario"

Click the "+ New Scenario" button in the top right corner of the scenarios list.

Step 3: Fill in Scenario Details

Field Required Description
Name Yes Descriptive name (max 200 characters)
Description No Detailed notes about the scenario purpose
Base Workbook No Select a workbook containing your current portfolio

Naming Your Scenario

Use descriptive names that include the date and purpose:

  • 2026-01-Q1 Portfolio Rebalance
  • Healthcare Exit Analysis - Jan 25
  • New Loan Evaluation - ABC Corp

Step 4: Add Initial Trades (Optional)

You can add trades during creation or add them later. See Trade Simulation for details.

Step 5: Save the Scenario

Click "Create Scenario" to save. The scenario will be created in draft status, ready for trade simulation.


Creating a Scenario via API

Basic Creation

Create a scenario with just a name:

curl -X POST https://api.calcbridge.io/api/v1/scenarios \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q1 2026 Portfolio Optimization"
  }'

Response:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "name": "Q1 2026 Portfolio Optimization",
  "description": null,
  "status": "draft",
  "base_workbook_id": null,
  "trade_count": 0,
  "created_by": "user-123",
  "created_at": "2026-01-25T10:30:00Z",
  "updated_at": "2026-01-25T10:30:00Z"
}

With Description and Base Workbook

curl -X POST https://api.calcbridge.io/api/v1/scenarios \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q1 2026 Portfolio Optimization",
    "description": "Evaluating exit from weak credits and adding high-quality loans",
    "base_workbook_id": "550e8400-e29b-41d4-a716-446655440001"
  }'

With Initial Trades

Create a scenario with trades in a single request:

curl -X POST https://api.calcbridge.io/api/v1/scenarios \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Healthcare Sector Exit",
    "description": "Reduce healthcare concentration by selling weak positions",
    "base_workbook_id": "550e8400-e29b-41d4-a716-446655440001",
    "trades": [
      {
        "trade_type": "sell",
        "cusip": "WEAK123",
        "borrower_name": "Struggling Healthcare Inc",
        "par_value": 2000000.00,
        "rating_moodys": "Caa2"
      },
      {
        "trade_type": "buy",
        "cusip": "STRONG456",
        "borrower_name": "Solid Tech Corp",
        "par_value": 2000000.00,
        "price": 99.50,
        "spread": 3.75,
        "rating_moodys": "B1",
        "industry": "Technology"
      }
    ]
  }'

Base Workbook Selection

The base workbook determines the starting portfolio for your simulation.

With a Base Workbook

When you specify a base_workbook_id:

  1. CalcBridge loads the portfolio data from the workbook
  2. It looks for sheets named "Portfolio", "Holdings", "Loans", "Assets", or "Collateral"
  3. The simulation applies trades to this real portfolio data

Without a Base Workbook

When no base workbook is specified:

  1. CalcBridge uses a sample portfolio for demonstration
  2. Useful for learning the feature or testing trade combinations
  3. Results reflect the sample data, not your actual portfolio

Sample Portfolio Limitation

The sample portfolio is for demonstration only. Always use a base workbook for real trade analysis.


Scenario Naming Conventions

Establish naming conventions for your team to keep scenarios organized:

[Date/Period] [Action] [Target] - [Detail]

Examples

Scenario Name Purpose
2026-01 Rebalance - Reduce CCC Monthly rebalancing focused on rating improvement
2026-Q1 New Loan - ABC Corp Evaluating a specific new loan opportunity
2026-01-25 Exit - Healthcare Same-day analysis for sector exit
Stress Test - 5% Selloff Hypothetical stress scenario
Template - Standard Buy Reusable template for common trades

Organization Tips

  1. Use date prefixes for time-sensitive scenarios
  2. Include the action type (Buy, Sell, Rebalance, Exit)
  3. Reference specific positions when analyzing individual trades
  4. Mark templates with a "Template" prefix

Managing Scenarios

Listing Scenarios

# List all scenarios
curl -X GET https://api.calcbridge.io/api/v1/scenarios \
  -H "Authorization: Bearer $TOKEN"

# Filter by status
curl -X GET "https://api.calcbridge.io/api/v1/scenarios?status_filter=completed" \
  -H "Authorization: Bearer $TOKEN"

# Paginate results
curl -X GET "https://api.calcbridge.io/api/v1/scenarios?page=1&page_size=20" \
  -H "Authorization: Bearer $TOKEN"
{
  "items": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "name": "Q1 2026 Portfolio Optimization",
      "status": "completed",
      "trade_count": 5,
      "created_at": "2026-01-25T10:30:00Z"
    }
  ],
  "total": 42,
  "page": 1,
  "page_size": 20,
  "pages": 3
}

Getting Scenario Details

curl -X GET https://api.calcbridge.io/api/v1/scenarios/{scenario_id} \
  -H "Authorization: Bearer $TOKEN"

Deleting a Scenario

Permanent Deletion

Deleting a scenario removes all associated trades and results. This action cannot be undone.

curl -X DELETE https://api.calcbridge.io/api/v1/scenarios/{scenario_id} \
  -H "Authorization: Bearer $TOKEN"

Request/Response Reference

Create Scenario Request

Field Type Required Description
name string Yes Scenario name (1-200 characters)
description string No Detailed description (max 2000 characters)
base_workbook_id UUID No ID of workbook with portfolio data
trades array No Initial trades to add

Scenario Response

Field Type Description
id UUID Unique scenario identifier
name string Scenario name
description string Scenario description
status string Current status (draft/calculating/completed/failed)
base_workbook_id UUID Reference to base workbook
trade_count integer Number of trades in scenario
created_by UUID User who created the scenario
created_at datetime Creation timestamp
updated_at datetime Last update timestamp

Error Handling

Common Errors

Error Cause Resolution
404 Not Found Workbook ID does not exist Verify the workbook ID is correct
400 Validation Error Name is empty or too long Provide a valid name (1-200 characters)
401 Unauthorized Invalid or expired token Refresh your authentication token
403 Forbidden Workbook belongs to another tenant Use workbooks from your own tenant

Validation Rules

  • Scenario name must be 1-200 characters
  • Description must be under 2000 characters
  • Base workbook must exist and belong to your tenant
  • Trade type must be "buy" or "sell"
  • Par value must be positive

Next Steps

Now that you have created a scenario, learn how to: