> For the complete documentation index, see [llms.txt](https://lens-project.gitbook.io/lens-project-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lens-project.gitbook.io/lens-project-docs/documentation/how-lens-works.md).

# How Lens Works

#### Detection Layer

Lens uses a dual-layer detection architecture:

**WebSocket (primary)** - subscribes to on-chain log notifications for every tracked wallet. New transactions are detected in near real-time as they appear on the network.

**Polling fallback** - a background scan runs every 5 seconds per wallet, catching anything the WebSocket misses during reconnects or network gaps.

#### Parsing Layer

Every detected transaction is parsed for swap activity. Lens identifies:

* Input token (SOL, USDC, USDT, or wSOL)
* Output token (the purchased SPL token)
* Buy size in SOL
* Token mint address

Transactions that don't match a recognised buy pattern are silently discarded.

#### Enrichment Layer

After fast alert delivery, a second pass runs in the background:

* Token symbol resolution (Jupiter token list + DexScreener fallback)
* Market cap and liquidity from DexScreener (with Birdeye fallback)
* Wallet behaviour profile from 7-day swap history
* Signal rating scored across liquidity, market cap, buy size, and wallet confidence
* 7-day PnL via SolanaTracker API
* Convergence detection - multiple tracked wallets buying same token within 10 minutes

#### Alert Delivery

Alerts are sent via Telegram bot to each subscriber's private chat. Each alert includes:

* Signal rating and quality badge
* Wallet label and behaviour tag
* Buy size and token
* Market cap and liquidity at entry
* Wallet 7d PnL
* Convergence indicator if active
* One-tap buy buttons (Lens Sniper), chart links, and trading platform links

***

### 6. Signal System

Every alert is scored across four dimensions:

| Factor                      | Score |
| --------------------------- | ----- |
| Liquidity ≥ $5,000          | +1    |
| Market cap ≤ $200,000       | +1    |
| Buy size ≥ 0.5 SOL          | +1    |
| Conviction wallet behaviour | +1    |
| Wallet confidence ≥ 80%     | +1    |
| Scaler wallet behaviour     | -1    |

**Ratings:**

* **HIGH** — score ≥ 3
* **MED** — score = 2
* **LOW** — score ≤ 1

**Quality badges** combine signal rating with wallet profile confidence:

* **A** - HIGH signal + confidence ≥ 75%
* **B** - HIGH or MED signal + confidence ≥ 60%
* **C** - everything else


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://lens-project.gitbook.io/lens-project-docs/documentation/how-lens-works.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
