> For the complete documentation index, see [llms.txt](https://medusa-finance.gitbook.io/medusa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://medusa-finance.gitbook.io/medusa/how-the-apy-is-calculated.md).

# How the APY is Calculated

### <mark style="color:green;">Simple Interest Equation (Principal + Interest)</mark>

A = P(1 + rt)

Where:

* A = Total Accrued Amount (principal + interest)
* P = Principal Amount
* I = Interest Amount
* r = Rate of Interest per year in decimal; r = R/100
* R = Rate of Interest per year as a percent; R = r \* 100
* t = Time Period involved in months or years

From the base formula, A = P(1 + rt) derived from A = P + I and since I = Prt then A = P + I becomes A = P + Prt which can be rewritten as A = P(1 + rt)

Note that rate r and time t should be in the same time units such as months or years. Time conversions that are based on day count of 365 days/year have 30.4167 days/month and 91.2501 days/quarter. 360 days/year have 30 days/month and 90 days/quarter.

### <mark style="color:green;">Simple Interest Formulas and Calculations</mark> <a href="#simple-interest-formulas-and-calculations" id="simple-interest-formulas-and-calculations"></a>

A = the Final Investment Value, using the simple interest formula: A = P(1 + rt) where P is the Principal amount of money to be invested at an Interest Rate R% per period for t Number of Time Periods. Where r is in decimal form; r=R/100; r and t are in the same units of time.

The accrued amount of an investment is the original principal P plus the accumulated simple interest, I = Prt, therefore we have:

A = P + I = P + (Prt), and finally **A = P(1 + rt)**

* Calculate Total Amount Accrued (Principal + Interest), solve for A
  * A = P(1 + rt)
* Calculate Principal Amount, solve for P
  * P = A / (1 + rt)
* Calculate rate of interest in decimal, solve for r
  * r = (1/t)(A/P - 1)
* Calculate rate of interest in percent
  * R = r \* 100
* Calculate time, solve for t
  * t = (1/r)(A/P - 1)

### <mark style="color:green;">Example:</mark> <a href="#example" id="example"></a>

**P = (Principle + Interest) = $1,000**

**A = (Total Accrued Amount) = $3,830,258.00**


---

# 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://medusa-finance.gitbook.io/medusa/how-the-apy-is-calculated.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.
