# Portfolio

#### **Table of Contents**

- [Description](#bkmrk-description)
- [Examples](#bkmrk-examples)
- [Cookbook](#bkmrk-cookbook)
- [F.A.Q.](#bkmrk-api-documentation)
- [API Documentation](#bkmrk-api-documentation)

#### **Description**

##### *Financial meaning*

**Portfolio** refers to a collection of financial assets. Portfolios are held directly by investors and/or managed by financial professionals. Effective portfolio management involves diversification, asset allocation, and regular performance monitoring to optimize returns and manage risks.

##### *Platform abstraction*

**Portfolio** in Finmars platform is a container for financial assets (cash ([currency](https://docs.finmars.com/books/entities/page/currency "Currency")) &amp; [instruments](https://docs.finmars.com/books/entities/page/instrument "Instrument")) allocation.

**Portfolio also is used in:**

- [performance](https://docs.finmars.com/books/reports/chapter/performance "Performance") calculation with its [registers](https://docs.finmars.com/books/entities/chapter/register "Register") grouped in [bundles](https://docs.finmars.com/books/entities/chapter/bundle "Bundle")
- [reconciliation](https://docs.finmars.com/books/reports/chapter/reconciliation "Reconciliation") using special [portfolio type](https://docs.finmars.com/books/entities/page/portfolio-type "Portfolio Type") and [portfolio reconcile group](https://docs.finmars.com/books/entities/page/portfolio-reconcile-group "Portfolio Reconcile Group").

#### **Examples**

<table border="1" id="bkmrk-" style="border-collapse: collapse; width: 107.5%;"><colgroup><col style="width: 6.67461%;"></col><col style="width: 8.70083%;"></col><col style="width: 6.7938%;"></col><col style="width: 6.67461%;"></col><col style="width: 6.91299%;"></col><col style="width: 6.91299%;"></col><col style="width: 10.7271%;"></col><col style="width: 10.7271%;"></col><col style="width: 9.29621%;"></col><col style="width: 10.7276%;"></col><col style="width: 8.10489%;"></col><col style="width: 7.86651%;"></col></colgroup><thead><tr><td class="align-center">User code</td><td class="align-center">Portfolio Type</td><td class="align-center">Name</td><td class="align-center">Short name</td><td class="align-center">Public name</td><td class="align-center">Notes</td><td class="align-center">First Transaction Date</td><td class="align-center">First Cash Flow Date</td><td class="align-center">Accounts</td><td class="align-center">Transaction types</td><td>Responsibles</td><td>Counterparties</td></tr></thead><tbody><tr><td>obl01  
</td><td>Manual</td><td>Bonds</td><td>Bonds</td><td>Bonds</td><td>-</td><td>2022-12-01</td><td>2022-12-01</td><td>  
</td><td>  
</td><td>  
</td><td>  
</td></tr></tbody></table>

- `User code`: workspace unique identifier of the portfolio with source prefix as it's multi-source entity
- `Portfolio Type`: configuration-defined criterion for reconciliation
- `Name`: full name
- `Short name`: short name, showed in other relations
- `Public name`: public view name for users without access
- `Notes`: custom description for portfolio
- `First Transaction Date`: date of the first transaction in the portfolio (changes by the logic described below)
- `First Cash Flow Date`: date of the first transaction in the portfolio for base transaction class == <span class="code" spellcheck="false">Cash-Inflow</span> or <span class="code" spellcheck="false">Cash-Outflow</span> (changes by the logic described below)
- `Accounts`: (not strict, informative) selected accounts that can be used for this portfolio
- `Transaction types`: (not strict, informative)selected transaction types that can be used for this portfolio
- `Responsibles`: (not strict, informative)selected responsibles that can be used for this portfolio
- `Counterparties`: (not strict, informative)selected counterparties that can be used for this portfolio

Portfolio has 2 attributes `First Transaction Date` and `First Cash Flow Date` which are used for performance calculations with workflow and performance report and the logic for them is defined below:

**Logic for defining First Transaction Date &amp; First Cash Flow Date based on complex transactions:**

1. Portfolio entity has 2 properties:
    
    
    1. <span class="code" spellcheck="false">first\_transcation\_date</span> (name = <span class="code" spellcheck="false">First transaction date</span>, value = <span class="code" spellcheck="false">null</span>)
    2. <span class="code" spellcheck="false">first\_cash\_flow\_date </span>(name = <span class="code" spellcheck="false">First cash flow date</span>, value = <span class="code" spellcheck="false">null</span>)
2. **For complex transaction CRUD** operations **For each base transaction** in the complex transaction:
    
    
    1. if **Book**
        
        
        1. if base transaction class == <span class="code" spellcheck="false">Cash-Inflow</span> or <span class="code" spellcheck="false">Cash-Outflow</span>
            
            
            1. if <span class="code" spellcheck="false">trade\_date</span> &lt; <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
                
                
                1. <span class="code" spellcheck="false">first\_cash\_flow\_date</span> = <span class="code" spellcheck="false">trade\_date</span>
        2. if <span class="code" spellcheck="false">trade\_date</span> &lt; <span class="code" spellcheck="false">first\_transcation\_date</span>
            
            
            1. <span class="code" spellcheck="false">first\_transcation\_date</span> = <span class="code" spellcheck="false">trade\_date</span>
    2. if **Rebook !!!**
        
        
        1. if base transaction class == <span class="code" spellcheck="false">Cash-Inflow</span> or <span class="code" spellcheck="false">Cash-Outflow</span>
            
            
            1. if **<u>new </u>**<span class="code" spellcheck="false">trade\_date</span> &lt; <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
                
                
                1. <span class="code" spellcheck="false">first\_cash\_flow\_date</span> = <span class="code" spellcheck="false">trade\_date</span>
            2. else
                
                
                1. if **<u>old </u>**<span class="code" spellcheck="false">trade\_date</span> == <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
                    
                    
                    1. <span class="code" spellcheck="false">first\_cash\_flow\_date</span> = find new <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
        2. if **<u>new </u>**<span class="code" spellcheck="false">trade\_date</span> &lt; <span class="code" spellcheck="false">first\_transcation\_date</span>
            
            
            1. <span class="code" spellcheck="false">first\_transcation\_date</span> = <span class="code" spellcheck="false">trade\_date</span>
        3. else
            
            
            1. if **<u>old </u>**<span class="code" spellcheck="false">trade\_date</span> == <span class="code" spellcheck="false">first\_transcation\_date</span>
                
                
                1. <span class="code" spellcheck="false">first\_transcation\_date</span> = find new <span class="code" spellcheck="false">first\_transcation\_date</span>
    3. if **Delete**
        
        
        1. if base transaction class == <span class="code" spellcheck="false">Cash-Inflow</span> or <span class="code" spellcheck="false">Cash-Outflow</span>
            
            
            1. if <span class="code" spellcheck="false">trade\_date</span> == <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
                
                
                1. if true <span class="code" spellcheck="false">first\_cash\_flow\_date</span> = find new <span class="code" spellcheck="false">first\_cash\_flow\_date</span>
        2. if <span class="code" spellcheck="false">trade\_date</span> == <span class="code" spellcheck="false">first\_transcation\_date</span>
            
            
            1. if true <span class="code" spellcheck="false">first\_transcation\_date</span> = find new <span class="code" spellcheck="false">first\_transcation\_date</span>

#### **Cookbook**

##### *CRUD* 

- **Create: [How to Create a Portfolio Entity](https://docs.finmars.com/books/entities/page/how-to-create-a-portfolio-entity "How to Create a Portfolio Entity")**
- **Read: [How to Read a Portfolio Entity](https://docs.finmars.com/books/entities/page/how-to-read-a-portfolio-entity "How to Read a Portfolio Entity")**
- **Update: [How to Update a Portfolio Entity](https://docs.finmars.com/books/entities/page/how-to-update-a-portfolio-entity "How to Update a Portfolio Entity")**
- **Delete: [How to Delete a Portfolio Entity](https://docs.finmars.com/books/entities/page/how-to-delete-a-portfolio-entity "How to Delete a Portfolio Entity")**

##### *Use Cases*

- Within a portfolio, transactions and instrument positions are grouped using **registers**, which feed into bundles and ultimately affect portfolio-level calculations and reporting.
- Auto-populated fields such as **First Transaction Date** and **First Cash Flow Date** are critical inputs for internal workflows, audit tracking, and performance evaluation logic.
- Leverage the **Portfolio Type** field to define reconciliation logic and reporting behavior (e.g., General, Manual, or Position Only).

#### **F.A.Q.**

Frequently asked questions.

#### **API documentation**

Link to API documentation.