> ## 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.

# BlackSwan Python SDK Methods Reference

> Full reference for all six BlackSwan Python SDK methods: credit dashboard, trust ratio, APR, SBT balance, reputation, and credit history.

The `BlackSwanClient` exposes six methods for reading on-chain credit data. All methods accept a wallet address string and return data sourced from the BlackSwan smart contracts.

## get\_credit\_dashboard

Returns the complete lending profile for a wallet.

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

`CreditDashboard` object with properties:

| Property          | Type | Description                                         |
| ----------------- | ---- | --------------------------------------------------- |
| trust\_ratio      | int  | Trust score (0–10000)                               |
| trust\_tier       | str  | Tier as letter (A–E)                                |
| current\_apr      | int  | APR in basis points (divide by 1000 for percentage) |
| borrowed\_usd     | int  | Total USD borrowed                                  |
| repaid\_usd       | int  | Total USD repaid                                    |
| successful\_loans | int  | Number of successful loans                          |
| defaults          | int  | Number of defaults                                  |
| tier              | int  | User tier (0–4)                                     |

### Example

```python theme={null}
dashboard = client.get_credit_dashboard("0x...")
print(dashboard.trust_ratio)          # 7700
print(dashboard.trust_tier)           # "C"
print(dashboard.current_apr / 1000)   # 0.142 → 14.2%
```

### Response

```json theme={null}
{
  "trust_ratio": 7700,
  "trust_tier": "C",
  "current_apr": 142,
  "borrowed_usd": 99,
  "repaid_usd": 99,
  "successful_loans": 1,
  "defaults": 0,
  "tier": 2
}
```

***

## get\_trust\_ratio

Returns the raw trust score for a wallet.

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

`int` — Trust score from 0 to 10000.

### Example

```python theme={null}
ratio = client.get_trust_ratio("0x...")
print(ratio)  # e.g. 7700
```

***

## get\_current\_apr

Returns the current APR index assigned to a wallet.

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

`int` — APR in basis points. Divide by 1000 to get the percentage (e.g. 142 → 14.2%).

### Example

```python theme={null}
apr = client.get_current_apr("0x...")
print(apr / 1000)  # e.g. 0.142 → 14.2%
```

***

## balance\_of

Checks whether a wallet holds a BlackSwan Soulbound Token (SBT).

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

`int` — `1` if the wallet holds an SBT, `0` otherwise.

### Example

```python theme={null}
has_sbt = client.balance_of("0x...")
print(has_sbt)  # 1 or 0
```

***

## get\_reputation

Returns aggregated reputation data for a wallet.

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

```python theme={null}
{
  "repaid_volume": int,   # Total repaid value
  "loans": int,           # Total number of loans
  "trust_ratio": int      # Trust score (0–10000)
}
```

### Example

```python theme={null}
rep = client.get_reputation("0x...")
print(rep["trust_ratio"])    # e.g. 7700
print(rep["repaid_volume"])  # e.g. 99
```

***

## get\_credit\_history

Returns the loan history for a wallet.

### Parameters

| Parameter | Type | Description        |
| --------- | ---- | ------------------ |
| wallet    | str  | The wallet address |

### Return Value

```python theme={null}
{
  "total_loans": int,       # Total number of loans taken
  "successful_loans": int,  # Loans repaid on time
  "defaults": int           # Loans that defaulted
}
```

### Example

```python theme={null}
history = client.get_credit_history("0x...")
print(history["successful_loans"])  # e.g. 5
print(history["defaults"])          # e.g. 0
```
