> ## Documentation Index
> Fetch the complete documentation index at: https://api.unusualwhales.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> API requests use the base URL https://api.unusualwhales.com and require a bearer token in the `Authorization` header (`Authorization: Bearer <API_KEY>`). Create and manage API tokens at https://unusualwhales.com/dashboard/api.
> For live market data inside an AI tool, use the Unusual Whales MCP server at https://unusualwhales.com/public-api/mcp.
> Instructions for agents using Unusual Whales tools: https://unusualwhales.com/skill.md

# Build and combine filters

> Use the rich formula language to express your wildest filters

Lets assume you want to filter for stocks that have a marketcap of at least
\$1billion and whose call volume is at least twice its put volume. You want to filter
for a certain call to put volume ratio.

For custom ratios and comparing of fields (`call_volume > put_volume`) the stock screener
comes with a builtin formula language that allows for all of this.

You can retrieve the grammar from the following endpoint:

```bash wrap theme={null}
curl --fail-with-body 'https://api.unusualwhales.com/api/screener/stocks/dsl' \
  --header "Authorization: Bearer $UW_API_KEY"
```

It has a few fields. `grammar`, `notes` and `examples`. `fields` are all the fields
that are available to be used. This works very well with agents. You could prompt your agent
with the link to the dsl and tell it that you are interested in filtering for stocks that have a marketcap of at least
\$1billion and whose call volume is at least twice its put volume and with the help of
the grammar it could create the correct formula.

```text wrap theme={null}
where marketcap > 1B and call_volume > put_volume * 2
```

<CodeGroup>
  ```bash cURL wrap theme={null}
  curl --fail-with-body --get 'https://api.unusualwhales.com/api/screener/stocks' \
    --header "Authorization: Bearer $UW_API_KEY" \
    --data-urlencode 'query=where marketcap > 1B and call_volume >= put_volume * 2' \
    --data-urlencode 'limit=10'
  ```
</CodeGroup>

Another interesting starting point could be to filter
for tickers who have had growing options volume over a 4 day time span:

```
where 
        option_volume > prev_day_option_volume
        and prev_day_option_volume > prev_2_day_option_volume 
        and prev_2_day_option_volume > prev_3_day_option_volume 
        and prev_3_day_option_volume > prev_4_day_option_volume 
```

What we are essentially filtering for is for where over a 4 day trading time span
each day has more options volume than the previous day.

Next let's learn how to [compare options activity](/docs/guides/stock-screener/options-activity)
