> For the complete documentation index, see [llms.txt](https://docs.satoshiterminal.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.satoshiterminal.io/resources/copy-of-defi-analytics/risk-management-and-security-analytics/flash-loan-event-scoring.md).

# Flash Loan Event Scoring

**Implementation Details**

**Class Names**

| Model Name            | Parameters Class     | Data Class         |
| --------------------- | -------------------- | ------------------ |
| FlashLoanEventScoring | FlashLoanQueryParams | FlashLoanEventData |

**Import Statement**

```python
pythonCopyEditfrom satoshi_terminal.models.flash_loan_event_scoring import (
    FlashLoanEventScoring,
    FlashLoanQueryParams,
    FlashLoanEventData,
)
```

***

**Parameters**

| Name            | Type  | Description                                                                   | Default | Optional |
| --------------- | ----- | ----------------------------------------------------------------------------- | ------- | -------- |
| protocol\_name  | str   | Name of the protocol to monitor for flash loan events (e.g., Aave, Compound). | None    | False    |
| event\_window   | int   | Time window (in minutes) for detecting flash loan activity.                   | 60      | True     |
| risk\_threshold | float | Risk score threshold (0-100) to flag suspicious events.                       | 75      | True     |

***

**Data**

| Name           | Type     | Description                                                     |
| -------------- | -------- | --------------------------------------------------------------- |
| protocol\_name | str      | Name of the protocol where the flash loan occurred.             |
| event\_id      | str      | Unique identifier for the flash loan event.                     |
| loan\_amount   | float    | Amount borrowed in the flash loan.                              |
| risk\_score    | float    | Risk score (0-100) based on the event’s impact and abnormality. |
| timestamp      | datetime | Timestamp of the event.                                         |

***

**Key Features**

* **Anomaly Detection:** Identifies abnormal flash loan activity, such as rapid liquidations or exploit patterns.
* **Impact Scoring:** Quantifies the financial and systemic risk of each event.
* **Protocol-Specific Tracking:** Enables focused monitoring on specific DeFi protocols.
