Skip to content

Commit

Permalink
minor docs update (beefyfinance#695)
Browse files Browse the repository at this point in the history
* init

* reorder run

* include localhost

* breakdown minor revision

* shuffle minute comment

* readme updates
  • Loading branch information
andreb0x authored Mar 21, 2022
1 parent 21846d3 commit f7536b8
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,34 @@ API that powers [Beefy Finance](https://app.beefy.finance). You can find the rep

## To Run.

```
yarn install-all
yarn start
```

Note: After you start the API it can take a minute or two before you can fetch the APYs. We currently log `getApys()` to the console when all the data is available.

Optional enviroment vars:

`BSC_RPC` - A custom RPC endpoint that you want to use.
`HECO_RPC` - A custom RPC endpoint for HECO. You can just leave the default one otherwise.
`FORTUBE_API_TOKEN` - A token from Fortube to use their API. If you don't have a token you will get a console warning and the Fortube APYs will be slightly smaller than in production. Everything works fine otherwise.

Afterwards just do

```
yarn install-all
yarn start
```

---

---

## Endpoints

http://localhost:3000/

---

### Consumed by the [app](https://app.beefy.finance)

#### **/apy**

The main endpoint used by the frontend. It returns the APY of all the vaults in the following format. This is the legacy format. A new endpoint is being created at **/apy/breakdown** with a staggered migration.
The main endpoint used by the frontend. It returns the APY of all the vaults in the following format.

```
{
Expand All @@ -42,6 +44,8 @@ The main endpoint used by the frontend. It returns the APY of all the vaults in
}
```

NB This is the legacy format. A new endpoint is being created at **/apy/breakdown** with a staggered migration.

#### **/apy/breakdown**

The new version of the APY endpoint, broken down into component parts when they are available. The endpoint moves to a new format, which is consistent whether or not the breakdown stats are possible to display. It has the following structure:
Expand All @@ -63,7 +67,7 @@ The new version of the APY endpoint, broken down into component parts when they
}
```

As you can see above, the endpoint attempts to expose some elements from the breakdown of the Total APY calculation. Where this is not possible, we just show the legacy Total APY. Note that the legacy Total APY -> totalApy does not include the trading fees.
Note the endpoint exposes elements needed for the Total APY calculation. Where this is not possible, we just show the legacy Total APY. Note that the legacy Total APY -> totalApy does not include the trading fees.

Each of these fields within the structure are:

Expand All @@ -75,12 +79,14 @@ Each of these fields within the structure are:
- **tradingApr** - Annual interest from trading fees, not compounded.
- **totalApy** - The known Total APY. Where fields are available to calculate the Total APY including trading fees, this is calculated. The final calculation is totalApy = (1 + vaultApr) \* (1 + (compounded tradingApr)) - 1.

After you start the API it can take a minute or two before you can fetch the APYs. We currently log `getApys()` to the console when all the data is available.

#### **/prices** All token prices under the same endpoint (crosschain).

#### **/lps**: All liqudity pair prices under a single endpoint (crosschain).

#### **/vaults**: TBD


---

### Consumed by the [dashboard](https://dashboard.beefy.finance)
Expand Down

0 comments on commit f7536b8

Please sign in to comment.