# Discovery engine v1 : Statistical model \[Live]

The engine runs on real-time on-chain data to relatively score available markets in a range of \[0,1]. This is to note that the engine's scores are relative based on the parameters chosen by the user, and NOT an absolute measure of risk. The users are advised to do their own research before deploying assets into any of the integrated protocols.&#x20;

The first set of inputs to the engine required from the user:&#x20;

* Supply asset (in case of lending)
* Collateral asset and Debt asset (in case of borrowing)

The second set of inputs is the parameters users wish to optimise for. The parameters vary based on whether the user wishes to lend or borrow. The parameters are presented as toggles that users can opt to enable.

Lender&#x20;

<table><thead><tr><th width="192">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Supplied Liquidity</td><td>The total supplied liquidity in a protocol for the selected asset</td></tr><tr><td>Net Supply APR</td><td>Net supply APY for the supply asset, including protocol rewards (if any)</td></tr></tbody></table>

Borrower

<table><thead><tr><th width="193">Parameter</th><th>Description</th></tr></thead><tbody><tr><td>Net APY</td><td>Supply APY + (LTV*Borrow APY) </td></tr><tr><td>Available Liquidity</td><td><p>Total available liquidity of the borrow asset in a protocol<br><br>The engine calculates two additional rewards:<br><br>Borrow requirement reward (checks whether the debt requirement of a user is less than 10% of the available liquidity)<br>       ie, If BoReq &#x3C; (0.1 * AvaiLiq) </p><p>                     BoReqReward = 0.25 </p><p>            Else BoReqReward = 0<br><br>Utilisation reward (checks that the debt requirement of the user doesn’t cross the utilisation threshold of the pool)<br>       ie, If (ReserveSize − AvaiLiq + BoReq)/ReserveSize &#x3C; Uth                                                                                                                                                 <br>                     UthReward = 0.25<br>            Else UthReward = 0<br><br>This parameter underscores the protocol's risk profile, as a function of TVL and market's utilisation.</p></td></tr><tr><td>LTV</td><td>Loan-to-value ratio<br>(Max borrowable amount)/(collateral supplied)<br><br>This parameter can be selected if the user wishes to maximise exposure to the borrow asset</td></tr><tr><td>LT</td><td>Liquidation Threshold: the ratio of borrowed/collateral amount at which a position is defined as undercollateralised</td></tr></tbody></table>

Users have the option to select which parameters the engine should optimise for. Based on the user’s requirements and parameter selection, the engine uses a simple weighted sum model to score each lending pool.&#x20;

### Scoring

#### Normalisation

* Parameter values across available marekts are generally spread across different ranges&#x20;
* These values are captured at a given timestamp through the [Data engine](https://docs.google.com/document/d/1wY5DS0a8DbXI5fuWB7v0JLcScgEqxKzadbGyPpmj740/edit#heading=h.onwa4jrmp2vm)&#x20;
* Model then identifies max & min values for the parameter’s range at the given timestamp&#x20;
* normalizedValue = (rawValue − minValue) / (maxValue − minValue)&#x20;
* This way, each parameter range is normalised within \[0,1]

#### Scoring (when lending)

If optimising only one parameter

* Score = selected normParameter&#x20;

If optimising both parameters chosen&#x20;

* Score = (normSupplyAPY + normSupplyLiq) / 2&#x20;
* Both parameters are given equal weight

#### Scoring (when borrowing)

If optimising only parameter&#x20;

* Score = selected normParameter&#x20;

If optimising two parameters

* Including Available Liquidity (ex: Available Liquidity, Net APY)
  * BoReqReward + UthReward + normNetAPY/2
* Excluding Available Liquidity (ex: Net APY, LTV)
  * (normNetAPY + normLTV)/2

If optimising three parameters

* Including Available Liquidity (ex: Available Liquidity, Net APY, LTV)
  * BoReqReward + UthReward + (normNetAPY + normLTV)/4
* Excluding Available Liquidity (ie, Net APY, LTV, LT)
  * (normNetAPY + normLTV normLT)/3
* If optimising all parameters:
  * Score = BoReqReward + UthReward + (normNetAPY + normLTV + normLT)/6

Based on the above model, the engine scores each available market for the selected supply/borrow asset(s) within the range \[0,1].

> **Note:** The purpose of the discovery engine is to allow users to easily evaluate the available leverage sources relative to each other. Hence the each market is scored relative to other available markets for the selected asset(s). The score is not an absolute measure of risk, and and the users are expected to do their own research while deploying assets into any protocol.


---

# Agent Instructions: 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:

```
GET https://docs.lucidity.finance/protocol/discovery-engine/discovery-engine-v1-statistical-model-live.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
