# Price a full portfolio

## What is this endpoint for?

This endpoint allows users to price an entire portfolio of multiple instruments including crypto, cash, futures, and options, in USD on a given date with minute-level precision.

### Endpoint

```
https://us.market-api.kaiko.io/v2/data/analytics.v2/portfolio
```

### Parameters

<table><thead><tr><th width="135">Parameter</th><th width="98">Required</th><th width="284">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>value_date</code></td><td>Yes</td><td>The date on which the portfolio will be priced in ISO 8601 format.</td><td>“2025-11-07T08:00:00Z”</td></tr><tr><td><code>sensitivities</code></td><td>No</td><td>Boolean requesting sensitivity calculations (Greeks).</td><td>False</td></tr><tr><td><code>portfolio</code></td><td>Yes</td><td>Array representing the composition of the portfolio (i.e. the instruments and their quantities).</td><td>See below</td></tr></tbody></table>

#### Portfolio parameters

<table><thead><tr><th width="195">Parameter</th><th width="98">Required</th><th width="284">Description</th><th>Example</th></tr></thead><tbody><tr><td><code>instrument_id</code></td><td>Yes</td><td>User-defined unique identifier for this instrument, returned in the response alongside its valuation to enable straightforward matching between input and output.</td><td>"USD", "BTC",<br>"btc-future-15dec25", <br>"btc-call-dec25-110000"</td></tr><tr><td><code>sign</code></td><td>Yes</td><td>Either 1 for a long position or -1 for short.</td><td>1</td></tr><tr><td><code>kind</code></td><td>Yes</td><td>One of the supported kind [”cash”, ”spot”, “future”, “vanilla_option”, “digital_option”].</td><td>"future"</td></tr><tr><td><ul><li><mark style="color:blue;"><code>cash</code></mark> </li></ul></td><td></td><td></td><td></td></tr><tr><td>          - <mark style="color:purple;"><code>amount</code></mark></td><td>Yes</td><td>Amount of currency.</td><td>10000</td></tr><tr><td>          - <mark style="color:purple;"><code>currency</code></mark></td><td>Yes</td><td>Currency code.</td><td>"eur”</td></tr><tr><td><ul><li><mark style="color:blue;"><code>spot</code></mark></li></ul></td><td></td><td></td><td></td></tr><tr><td>          - <mark style="color:purple;"><code>amount</code></mark></td><td>Yes</td><td>Quantity of crypto asset.</td><td>2.5</td></tr><tr><td>          - <mark style="color:purple;"><code>currency</code></mark></td><td>Yes</td><td>Currency code.</td><td>“btc”</td></tr><tr><td><ul><li><mark style="color:blue;"><code>future</code></mark> </li></ul></td><td></td><td></td><td></td></tr><tr><td>          - <mark style="color:purple;"><code>quantity</code></mark></td><td>Yes</td><td>Number of contracts.</td><td>10</td></tr><tr><td>          - <mark style="color:purple;"><code>base</code></mark></td><td>Yes</td><td>Base currency/asset.</td><td>“btc”</td></tr><tr><td>          - <mark style="color:purple;"><code>expiry</code></mark></td><td>Yes</td><td>Expiry date of the future in ISO 8601 format.</td><td>“2025-12-25T08:00:00Z”</td></tr><tr><td><ul><li><mark style="color:blue;"><code>vanilla_option</code></mark></li></ul></td><td></td><td></td><td></td></tr><tr><td>          - <mark style="color:purple;"><code>quantity</code></mark></td><td>Yes</td><td>Number of contracts.</td><td>100</td></tr><tr><td>          - <mark style="color:purple;"><code>base</code></mark></td><td>Yes</td><td>Base currency/asset.</td><td>“btc”</td></tr><tr><td>          - <mark style="color:purple;"><code>expiry</code></mark></td><td>Yes</td><td>Expiry date of the option in ISO 8601 format.</td><td>“2025-12-25T08:00:00Z”</td></tr><tr><td>          - <mark style="color:purple;"><code>strike</code></mark></td><td>Yes</td><td>Strike price.</td><td>110000</td></tr><tr><td>          - <mark style="color:purple;"><code>is_call</code></mark></td><td>Yes</td><td>Boolean, true for call, false for put.</td><td>true</td></tr><tr><td><ul><li><mark style="color:blue;"><code>digital_option</code></mark></li></ul></td><td></td><td></td><td></td></tr><tr><td>          - <mark style="color:purple;"><code>quantity</code></mark></td><td>Yes</td><td>Number of contracts.</td><td>100</td></tr><tr><td>          - <mark style="color:purple;"><code>base</code></mark></td><td>Yes</td><td>Base currency/asset.</td><td>“btc”</td></tr><tr><td>          - <mark style="color:purple;"><code>expiry</code></mark></td><td>Yes</td><td>Expiry date of the option in ISO 8601 format.</td><td>“2025-12-25T08:00:00Z”</td></tr><tr><td>          - <mark style="color:purple;"><code>strike</code></mark></td><td>Yes</td><td>Strike price.</td><td>110000</td></tr><tr><td>          - <mark style="color:purple;"><code>is_call</code></mark></td><td>Yes</td><td>Boolean, true for call, false for put.</td><td>true</td></tr><tr><td>          - <mark style="color:purple;"><code>payout</code></mark></td><td>Yes</td><td>Payout of the digital option.</td><td>50000</td></tr></tbody></table>

### Fields

<table><thead><tr><th width="195">Parameter</th><th width="489">Description</th></tr></thead><tbody><tr><td><code>portfolio</code></td><td>Dictionary containing the following :</td></tr><tr><td><ul><li><mark style="color:blue;"><code>total_value</code></mark> </li></ul></td><td>Total value of the portfolio.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>base_currency</code></mark></li></ul></td><td>Currency in which the portfolio is priced.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>sensitivities</code></mark> </li></ul></td><td>Dictionary with greeks for each crypto.</td></tr><tr><td><code>instruments</code></td><td>Array of all instruments in the portfolio.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>instrument_id</code></mark></li></ul></td><td>Reminder of the instrument ID for each instrument.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>kind</code></mark> </li></ul></td><td>Reminder of each instrument's kind.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>value</code></mark></li></ul></td><td>Value of each instrument.</td></tr><tr><td><ul><li><mark style="color:blue;"><code>sensitivities</code></mark></li></ul></td><td>Greeks of each instrument.</td></tr></tbody></table>

### Request examples

{% tabs %}
{% tab title="cURL" %}
{% code overflow="wrap" %}

```url
curl -X POST "https://us.market-api.kaiko.io/v2/data/analytics.v2/portfolio" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: <client-api-key>" \
  -d '{
    "value_date": "2025-11-07T08:00:00Z",
    "sensitivities": false,
    "portfolio": [
      {
        "kind": "spot",
        "instrument_id": "btc-spot-1",
        "amount": 2.5,
        "sign": 1,
        "currency": "btc"
      },
      {
        "kind": "cash",
        "instrument_id": "eur-1",
        "amount": 50000,
        "sign": 1,
        "currency": "eur"
      }
    ]
  }
'
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}

```
##### 1. Import dependencies #####

import requests
import json
import pandas as pd


##### 2. Choose the value of the query's parameters #####
# ---- Required parameters ---- #
value_date = "2025-12-14T00:00:00.000Z"
portfolio = [
    {
     "instrument_id": "btc-spot-1",
     "kind": "spot",
     "sign": 1,
     "amount": 2.5,
     "currency": "btc"
     },
    {"instrument_id": "eth-spot-1",
     "kind": "spot",
     "sign": 1,
     "amount": 10.0,
     "currency": "eth"
     },
    {
     "instrument_id": "btc-call-100k",
     "kind": "vanilla_option",
     "sign": 1,
     "quantity": 1.0, 
     "base": "btc",
     "strike": 100000.0,
     "expiry": "2025-12-26T08:00:00.000Z",
     "is_call": True
     },
    {
     "instrument_id": "eur-cash",
     "kind": "cash",
     "sign": 1,
     "amount": 50000.0,
     "currency": "eur"
     }
]

# ---- Optional parameters ---- #
sensitivities=False

# ---- API key configuration ---- #
#api_key = "YOUR_API_KEY"

##### 3. Get the data #####
# ---- Function to run an API call ---- # 

def get_portfolio_value(api_key: str, value_date: str, portfolio: list, sensitivities: bool = False):
    """
    Price a cryptocurrency portfolio.
    Returns complete response with portfolio summary and instruments.
    """
    headers = {
        'Accept': 'application/json',
        'Content-Type': 'application/json',
        'X-Api-Key': api_key
    }
    
    url = 'https://us.market-api.kaiko.io/v2/data/analytics.v2/portfolio'
    
    payload = {
        "value_date": value_date,
        "portfolio": portfolio,
        "sensitivities": sensitivities
    }
    
    try:
        res = requests.post(url, headers=headers, json=payload)
        res.raise_for_status()
        data = res.json()
        if 'data' not in data:
            print("No data returned.")
            return pd.DataFrame()
        
        df = pd.DataFrame(data['data'])
        return df
    
    except requests.exceptions.RequestException as e:
        print(f"API request error: {e}")
        return pd.DataFrame()


result = get_portfolio_value(api_key, value_date, portfolio, sensitivities=sensitivities)

print("Portfolio valuation :", result["portfolio"][0]["total_value"], "USD")
# Display
print(json.dumps(json.loads(result.to_json(orient='records')), indent=2))
```

{% endtab %}
{% endtabs %}

### Response example

```json
{
    "query": {
        "value_date": "2025-12-25T00:02:00Z",
        "sensitivities": false,
        "request_time": "2026-02-10T13:37:30.623689182Z"
    },
    "time": "2026-02-10T13:37:30.652712913Z",
    "timestamp": 1770730650,
    "result": "success",
    "data": [
        {
            "portfolio": {
                "total_value": 277706.4327034304,
                "base_currency": "usd",
                "sensitivities": []
            },
            "instruments": [
                {
                    "instrument_id": "btc-spot-1",
                    "kind": "SPOT",
                    "value": 218834.00454545452,
                    "sensitivities": []
                },
                {
                    "instrument_id": "eur-1",
                    "kind": "CASH",
                    "value": 58872.42815797592,
                    "sensitivities": []
                }
            ]
        }
    ]
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.kaiko.com/rest-api/analytics-solutions/kaiko-portfolio-and-risk-management/price-a-full-portfolio.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
