# GET Price Range

### /price-range

```json
/price-range/{symbol}
```

**Example Query:**

```
https://base-hedger82.rasa.capital/price-range/BTCUSDT
```

**Example Response:**

```json
{
  "min_price": "1113.60",
  "max_price": "754960.6666666666666666666668176588"
}
```

#### **Data Source**

The `min_price` and `max_price` are configured by the hedger but **must align with the price range** of the external exchange where the hedger is actively hedging (e.g., Binance, Bybit).

**`min_price`**: The minimum acceptable order price for the symbol (in quote currency, e.g., USDT). Derived from the external exchange’s current price floor or liquidity constraints.

* Example: `"1113.60"` → Orders below this price are rejected.

**`max_price`**: The maximum acceptable order price for the symbol. Reflects the hedging platform’s upper price limit.

## Price Range Implementation (Rasa)

### Router

```python
@common_router.get(
    '/price-range/{symbol}',
    responses={status.HTTP_200_OK: {"model": SymbolPriceRangeInputSchema}},
    response_model=SymbolPriceRangeInputSchema
)
async def get_symbol_price_range(symbol: symbol_enum):
    # 1. Compute safe order-price bounds from the exchange
    _, _, min_price, max_price = BinanceConditionChecks.get_price_bounds(symbol, from_stats=True)

    # 2. Return JSON matching SymbolPriceRangeInputSchema
    return {
        "min_price": min_price,
        "max_price": max_price
    }

```

* Reads the exchange’s order-book or recent trades (via the Binance API or a cached copy).
* Computes a safe **min\_price** (floor) and **max\_price** (ceiling) for new orders.

#### Steps to Implement Your Own Version

**Define the Response Schema**

```python
class SymbolPriceRangeInputSchema(BaseModel):
    min_price: Decimal
    max_price: Decimal
```

**Build Your Condition-Checks Utility**

* Implement `BinanceConditionChecks.get_price_bounds(symbol, from_stats)` to return a tuple `(_, _, min_price, max_price)`.

**Add the FastAPI Route**

* In `common_router`, register the `GET /price-range/{symbol}` endpoint as shown above.
* Import `symbol_enum` for the path parameter (a class containing all Symbol names), and `SymbolPriceRangeInputSchema` for the response.


---

# 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.symm.io/liquidity-provider-documentation/building-a-solver-on-symmio/5.-creating-the-apis/get-price-range.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.
