> ## Documentation Index
> Fetch the complete documentation index at: https://blackswan-23965643.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# APR Calculation and Trust-Based Pricing in BlackSwan

> BlackSwan calculates APR dynamically based on a wallet's trust tier. Higher trust scores result in lower borrowing costs. APR is returned in basis points.

BlackSwan uses **trust-based pricing** to determine the interest rate a borrower pays. Instead of applying a flat rate to all users, BlackSwan rewards wallets with strong credit histories by offering them lower APRs. This creates a direct incentive to build and maintain a healthy on-chain credit score.

## APR and Basis Points

BlackSwan returns APR values in **basis points** (bps). One basis point equals one-hundredth of a percent (0.01%). To convert a basis point value to a human-readable percentage, divide by **1,000**:

```
percentage = apr / 1000
```

For example, an `apr` value of `85` equals **0.085%**, and a value of `1500` equals **1.5%**.

## How Trust Tier Affects APR

Your current APR is determined by your trust tier. Wallets in higher tiers (A, B) receive more favorable rates, while wallets in lower tiers (D, E) — including new wallets with no history — pay higher rates to compensate lenders for increased risk.

As your `trustRatio` improves and your tier advances, BlackSwan automatically recalculates your APR downward. There is no manual application process — pricing updates on-chain as your score changes.

## Querying the Current APR

You can fetch the current APR for any wallet using the SDK or REST API.

<CodeGroup>
  ```javascript JavaScript theme={null}
  import { BlackSwanClient } from "blackswan-sdk";

  const client = new BlackSwanClient({ apiKey: "YOUR_API_KEY" });

  const result = await client.getCurrentApr("0xYourWalletAddress");

  const aprBps = result.currentApr;
  const aprPercent = aprBps / 1000;

  console.log(`APR: ${aprBps} bps (${aprPercent}%)`);
  ```

  ```python Python theme={null}
  from blackswan import BlackSwanClient

  client = BlackSwanClient(api_key="YOUR_API_KEY")

  result = client.get_current_apr("0xYourWalletAddress")

  apr_bps = result["currentApr"]
  apr_percent = apr_bps / 1000

  print(f"APR: {apr_bps} bps ({apr_percent}%)")
  ```

  ```bash REST theme={null}
  curl -X GET "https://api.blackswan.finance/v1/apr/0xYourWalletAddress" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```
</CodeGroup>

**Example response:**

```json theme={null}
{
  "wallet": "0xYourWalletAddress",
  "currentApr": 750,
  "trustTier": "B"
}
```

In this example, the wallet's APR is `750` basis points, which equals **0.75%**.

<Tip>
  When building a lending UI, always display APR as a human-readable percentage by dividing the basis point value by 1,000. You can also use the `trustTier` field alongside the APR to give borrowers context — for example, showing "Your Tier B score qualifies you for a 0.75% APR" helps users understand the direct benefit of maintaining a strong credit history.
</Tip>
