> For the complete documentation index, see [llms.txt](https://p2p-2.gitbook.io/watcher-api/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://p2p-2.gitbook.io/watcher-api/reference/api-reference/risk-triggers.md).

# Risk-triggers

The risk factors and metrics

You may use following methods to receive the historical data for the particular metric or sing for notifications.

## Get history for risk-factor by strategy

## Get history for risk-factor.

<mark style="color:blue;">`GET`</mark> `https://api.web3watcher.fi/v1/strategies/history/{strategy_id}/{track_deFi}/{risk_factor}`

The method returns the historical data for the particular metric / defi / strategy.

#### Request Body

| Name                                           | Type      | Description                              |
| ---------------------------------------------- | --------- | ---------------------------------------- |
| strategy\_id<mark style="color:red;">\*</mark> | string    | The id of the strategy                   |
| offset                                         | int       | the number of historical rows            |
| pagination                                     | int       | num of page                              |
| track\_deFi<mark style="color:red;">\*</mark>  | \[string] | the name of deFi to track metrics        |
| risk\_factor<mark style="color:red;">\*</mark> | string    | the factor name to get historical values |

{% tabs %}
{% tab title="200 Success" %}

```json
{
    "status":"200",
    "message":"Success",
    "result": {
        "strategy_name":"lido_curve",
        "strategy_id":"389201",
        "strategy_category":"liqSt_dex",
        "risk_factor_history":[
                {
                "deFi_name": "curve",
                "factor_name": "f_whales",
                "factor_score": 90,
                "freshness_date": "2023-10-25 17:25:35:0000",
                "factor_score_change": -2,
                },
                {
                "deFi_name": "curve",
                "factor_name": "f_whales",
                "factor_score": 92,
                "freshness_date": "2023-10-25 17:20:35:0000",
                "factor_score_change": 0,
                },
                {
                "deFi_name": "curve",
                "factor_name": "f_whales",
                "factor_score": 92,
                "freshness_date": "2023-10-25 17:15:35:0000",
                "factor_score_change": -2,
                },
        },
    "offset": 3,
    "pagination": 1,
}
```

{% endtab %}

{% tab title="401 Permission denied" %}

```json
{
    "status":"401",
    "message":"Permission denied",
    "result":[],
    "offset": 3,
    "page": 1,
}
```

{% endtab %}
{% endtabs %}

## Sing-in for notifications

## Get strategies for a token.

<mark style="color:green;">`POST`</mark> `https://api.web3watcher.fi/v1/notifications/{strategy_id}/{track_deFi}/{risk_factor}`

The method returns the list of strategies for your token.

#### Request Body

| Name                                                | Type      | Description                                                                                            |
| --------------------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------ |
| strategy\_id<mark style="color:red;">\*</mark>      | string    | The id of the strategy                                                                                 |
| track\_deFi<mark style="color:red;">\*</mark>       | \[string] | the name of deFi to track metrics                                                                      |
| risk\_factor<mark style="color:red;">\*</mark>      | string    | the factor name to get historical values                                                               |
| threshold\_percent                                  | float     | The threshold for the metric delta for the notification. You may leave empty for the default settings. |
| messenger<mark style="color:red;">\*</mark>         | string    | tg / slack / discord / phone                                                                           |
| messenger\_target<mark style="color:red;">\*</mark> | string    | tg, slack, discord account or phone number                                                             |
| threshold\_value                                    | String    | The threshold for the metric delta for the notification. You may leave empty for the default settings. |

{% tabs %}
{% tab title="200 Success" %}

```json
{
    "status":"200",
    "message":"Success",
    "result": {
        "strategy_id":"389201",
        "track_deFi": "curve",
        "risk_factor": "f_reward_liquiduty",
        "threshold_percent": 0.1,
        "messenger": "tg",
        "messenger_target": "user_name",        
        },
}
```

{% endtab %}

{% tab title="401 Permission denied" %}

```json
{
    "status":"401",
    "message":"Permission denied",
    "result":[],
    "offset": 3,
    "page": 1,
}
```

{% endtab %}
{% endtabs %}
