# Win Rate Calculator for Consecutive Wins

> `GET /api/addon/win-rate-calculator`: Addon endpoint of the Rone Arena API.

Calculate the number of consecutive wins required to reach a target win rate based on current matches and current win rate.

Query parameters:
- **match-now**: Current total number of matches played (minimum: 0).
- **wr-now**: Current win rate in percent (range: 0-100).
- **wr-future**: Target win rate in percent. Must be greater than current win rate and between 0-100.

The response includes win rate calculation data:
- **status**: Response status (e.g., 'success').
- **match_now**: Current total matches played.
- **wr_now**: Current win rate.
- **wr_future**: Target win rate.
- **required_no_lose_matches**: Number of consecutive wins required without losses to reach the target win rate.
- **message**: Explanation message summarizing the result.

This endpoint is useful for:
- Calculating how many consecutive wins are needed to reach a desired win rate.
- Helping players set realistic performance goals.
- Providing analytics for win rate progression.

## Request

`GET https://arena.rone.dev/api/addon/win-rate-calculator`

### Parameters

| Name | In | Type | Required | Default | Description |
| --- | --- | --- | --- | --- | --- |
| `match-now` | query | integer | yes |  | Current total number of matches played. Must be a non-negative integer. Range: 0... |
| `wr-now` | query | number | yes |  | Current win rate in percent. Must be a value between 0 and 100. Range: 0..100. |
| `wr-future` | query | number | yes |  | Target win rate in percent. Must be greater than the current win rate and between 0 and 100. Range: ..100. |

### Example

```bash
curl -X GET 'https://arena.rone.dev/api/addon/win-rate-calculator?match-now=<match-now>&wr-now=<wr-now>&wr-future=<wr-future>'
```

## Example response

```json
{
  "status": "success",
  "match_now": 100,
  "wr_now": 50,
  "wr_future": 75,
  "required_no_lose_matches": 100,
  "message": "To achieve a win rate of 75.0%, you need 100 consecutive wins without any losses."
}
```

## Links

- Try it in the playground: https://arena.rone.dev/web/addon/win-rate-calculator
- Addon endpoints: https://arena.rone.dev/web/addon.md
- OpenAPI schema: https://arena.rone.dev/api/openapi.json
