> For the complete documentation index, see [llms.txt](https://docs.deltaprime.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.deltaprime.io/prime-brokerage-account/health-and-borrowing-power/calculations.md).

# Calculations

## Health calculations&#x20;

**borrowing Power ratio (Pr):** The borrowing power ratio of an asset is a number between 0 and 1 and describes how much you can borrow against this certain asset. It is calculated as:

$$
Pr = {P \over P + 1} \ \text{}\ \begin{align} & \text{Pr = borrowing Power ratio} \\&\text{P = borrowing Power} \ \ \end{align}
$$

| Borrowing Power | Formula   | Borrowing Power ratio |
| --------------- | --------- | --------------------- |
| 1x              | 1 / (1+1) | 0.5                   |
| 3x              | 3 / (3+1) | 0.75                  |
| 5x              | 5 / (5+1) | 0.8333                |

**Collateral (Ct & C):** DeltaPrime being fully cross-margin, means that "collateral" as such does not exist, but is either a token-derived collateral value (Ct):

$$
Ct = {At-Bt} \\\text{}\ \begin{align} &\text{Ct = Collateral of token} \ &\text{At = Account's token value} \ &\text{Bt = token borrowed value}
\end{align}
$$

Or a portfolio-derived value (C):

$$
C = {Ta-Tb} \\\text{}\ \begin{align} &\text{C = Collateral} \ &\text{Ta = Total account value} \ &\text{Tb = Total borrowed value}
\end{align}
$$

In words: The dollar value of your collateral is equal to the dollar value of your assets, minus the dollar value of your borrowed tokens, either for one token, or for the whole portfolio.

{% hint style="info" %}
At launch all integrated tokens have either 0x or 5x Borrowing power. If they have 0, the Borrowing Power ratio is 0 as well.
{% endhint %}

### Cross-margin Borrowing Power

How much you can actually borrow against your deposit is not solely dependent on the borrowing power of the token provided, but also on the borrowing power of the token borrowed. This means that if you provide a token with 5x borrowing power, and borrow a token with 2x borrowing power, the exact ratio at which the health meter reaches zero is neither 2x nor 5x, but rather somewhere in between. Below are the calculations how the exact Health can be measured. Additionally you can see how it differs in the[ Health Playground](#health-playground).

### Health of single asset (Ha)

$$
{Ha = }{Pr*Ct+Pr*Bt-Bt\over Pr\*Ct}  \*100%  \\
$$

**Examples**

| Borrowing Power, Collateral, Borrowed value | Formula                                                    | Asset Health |
| ------------------------------------------- | ---------------------------------------------------------- | ------------ |
| 5x, $100, $250                              | (0.8333\*100 + 0.8333 \* 250 - 250) / (0.8333\*100) \*100% | 50%          |
| 5x, $120, $250                              | (0.8333\*120 + 0.8333\*250 - 250) / (0.8333\*120) \* 100%  | 58.3%        |
| 3x, $100, $101                              | (0.75 \* 100 + 0.75 \* 101 - 101) / (0.75\*100) \* 100%    | 66.3%        |

### Health of all assets (H)

#### Weights

In order to calculate a cross-margin portfolio, we need to take different borrowing powers and token prices into account. To do this we calculate the weighted collateral value of a token (*Cw)* and the weighted borrowed value (*Bw)* of a token. By multiplying either with both the token price and Borrowing Power ratio (Pr), we get a value that represents that token's weighted collateral/borrowing value.&#x20;

$$
{Cw =  CtPtPr} \ {Bw = BtPtPr} \\\text{} \\\begin{align} &\text{Ct = Collateral of token} \\&\text{Bt = Borrows of token}\\&\text{Pt = Price of token} \end{align}
$$

Compounding the collateral weights of all tokens within one Prime Account, we get the portfolio's Total Collateral weight (ΣCw). Compounding the borrowed weights of all tokens within one Prime Account we get the portfolio's Total Borrowed weight (ΣBw).&#x20;

By using the same formula we used with the single-asset health meter, but taking into account the different token prices and borrowing powers, we get:

$$
{H = }{ΣCw+ΣBw-B\over ΣCw}  \*100%  \\
$$

### Health Playground

The Health Playground is an excel sheet you can use to calculate different scenarios for yourself. Make a copy of this document to play around with variable health meters: [Health Playground](https://docs.google.com/spreadsheets/d/1wukyfAj641H4xBva6G1DVIzrauyn1sazYZoD1qGCcIo/edit#gid=479001345)


---

# 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 dynamically by asking a question.

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

```
GET https://docs.deltaprime.io/prime-brokerage-account/health-and-borrowing-power/calculations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
