> For the complete documentation index, see [llms.txt](https://docs.sfox.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sfox.com/rest-api/reporting/get-portfolio-valuation.md).

# Get Portfolio Valuation

USD valuation of your portfolio over time

<mark style="color:green;">**`GET`**</mark> `https://api.sfox.com/v1/account/balance/history`

Retrieve a history of the USD value of your account's portfolio at hourly or daily intervals

## Request

### Query Parameters

<table><thead><tr><th width="136.453125">Name</th><th width="115.68359375" align="center">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>start_date</code> <em><mark style="color:red;">required</mark></em></td><td align="center">timestamp</td><td>Timestamp of the start of the query. Unix timestamp (ms)</td></tr><tr><td><code>end_date</code></td><td align="center">timestamp</td><td>Timestamp of the end of the query. Unix timestamp (ms)</td></tr><tr><td><code>interval</code></td><td align="center">int</td><td><p>Timeseries interval (sec). <br>Possible values: <code>3600</code> (hourly), <code>86400</code> (daily)</p><p>Default value: <code>86400</code></p></td></tr></tbody></table>

### Example Request

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

```bash
curl -H 'Authorization: Bearer <API_TOKEN>'
'https://api.sfox.com/v1/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000'
```

{% endcode %}
{% endtab %}

{% tab title="NodeJS" %}
{% code overflow="wrap" %}

```javascript
const axios = require('axios');

axios({
  method: 'get',
  url: 'https://api.sfox.com/v1/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000',
  headers: {
    'Authorization': 'Bearer <API_KEY>'
  }
}).then(response => {
  console.log(response)
}).catch(err => {
  console.error(err)
});
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" %}

```python
import requests

data = requests.get(
  "https://api.sfox.com/v1/account/balance/history?interval=86400&start_date=1701475200000&end_date=1701734400000",
  headers={
    "Authorization": "Bearer <API_KEY>",
  }
)
print(data)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Response

### Response Body

<table><thead><tr><th width="156">Key</th><th width="113.375" align="center">Type</th><th>Description</th></tr></thead><tbody><tr><td><code>data</code></td><td align="center">[object]</td><td>An array of portfolio value objects, each object with a <code>timestamp</code> and <code>usd_value</code></td></tr><tr><td><code>timestamp</code></td><td align="center">timestamp</td><td>Unix timestamp (ms) of the valuation</td></tr><tr><td><code>usd_value</code></td><td align="center">number</td><td>USD valuation of your portfolio as of the timestamp</td></tr></tbody></table>

### Responses

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "data": [
        {
            "timestamp": 1701475200000,
            "usd_value": 349515.64495392627
        },
        {
            "timestamp": 1701561600000,
            "usd_value": 349628.6458040236
        },
        {
            "timestamp": 1701648000000,
            "usd_value": 349653.452981625
        },
        {
            "timestamp": 1701734400000,
            "usd_value": 349301.02066800353
        },
        {
            "timestamp": 1701820800000,
            "usd_value": 350066.51819476683
        },
        {
            "timestamp": 1701907200000,
            "usd_value": 350761.96052562393
        }
    ]
}
```

{% endtab %}

{% tab title="422: Unprocessable Entity Invalid Request" %}

```json
//Invalid start_date
{
    "error": "start_date must be a valid unix timestamp in milliseconds"
}

//Invalid end_date
{
    "error": "end_date must be a valid unix timestamp in milliseconds"
}

// Invalid interval
{
    "error": "interval must be 3600 or 86400"
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sfox.com/rest-api/reporting/get-portfolio-valuation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
