> For the complete documentation index, see [llms.txt](https://docs.hipersnipe.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hipersnipe.com/development/handlers-reference.md).

# Handlers reference

## Trading handlers

| Module                  | Responsibility                                                                |
| ----------------------- | ----------------------------------------------------------------------------- |
| `trading_ca_handler.py` | Detect CA in any message; open Trading UI                                     |
| `trading_token_ui.py`   | Build/render token dashboard; refresh; stage-2 audit; pump automation toggles |
| `trading_buy_sell.py`   | Buy/sell callbacks; custom amount FSM; success UI                             |
| `trading_execution.py`  | Resolve slippage, fees, execution mode for swaps                              |
| `trading_limits.py`     | `/limits` dashboard; limit order FSM                                          |
| `trading_auto_sell.py`  | Trading Shield matrix UI and activation                                       |
| `trading.py`            | Router aggregator for trading sub-modules                                     |

## User handlers

| Module            | Responsibility                                                                              |
| ----------------- | ------------------------------------------------------------------------------------------- |
| `user_setup.py`   | `/start`, `/wallet`, `/assets`, `/help`, registration, **Trade Journal**, internal transfer |
| `settings.py`     | Pro Settings dashboard and toggles                                                          |
| `analytics_ui.py` | Analytics & PnL screen (`analytics_menu`)                                                   |
| `referral_ui.py`  | Affiliate Center — referral link and commissions                                            |
| `dca_ui.py`       | DCA create/cancel UI (`dca_menu`)                                                           |
| `copytrade_ui.py` | Copy target management                                                                      |
| `snipe_ui.py`     | Raydium LP snipe configuration                                                              |

## Admin handlers

| Module                   | Responsibility                                                                         |
| ------------------------ | -------------------------------------------------------------------------------------- |
| `admin.py`               | Stats, fees, RPC, infrastructure, sniper, relay, calls, treasury, reboot, promo grants |
| `project_admin.py`       | `/set_buy_bot`, `/hiper` — Project Buy Bot group commands                              |
| `channel_interceptor.py` | Partner channel CA → Fast Buy button injection                                         |

## Other

| Module        | Responsibility                 |
| ------------- | ------------------------------ |
| `scrapers.py` | Scraper utilities for handlers |

## Main menu callbacks (`menus.py`)

| Button               | Callback             |
| -------------------- | -------------------- |
| Buy/Sell (Positions) | `swap_menu`          |
| Wallets              | `wallet_menu`        |
| Limit Orders         | `limits_menu`        |
| Settings             | `settings_menu`      |
| Leaderboard          | `leaderboard_menu`   |
| Affiliate Center     | `referral_menu`      |
| Trade Journal        | `trade_journal_menu` |
| Copy Trade           | `copytrade_menu`     |
| Daily Spin           | `spin_reward`        |
| Help/Docs            | `help_menu`          |

## Keyboard builders

`menus.py` contains all `InlineKeyboardMarkup` factories:

* `make_main_menu_keyboard()`
* `make_token_trade_keyboard()` — includes shield row text
* `make_zero_typing_shield_keyboard()`
* `make_pro_settings_keyboard()`

## FSM states

Defined in `shared.py`. Trading flows use aiogram FSM for custom buy/sell amounts and limit order creation.

## Adding a new handler

1. Create module in `handlers/`
2. Define `Router()` and register callbacks
3. Include router in `handlers/trading.py` or `main.py`
4. Add keyboard buttons in `menus.py` if needed
5. Do not put swap logic in handlers—delegate to `swap.py`


---

# 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://docs.hipersnipe.com/development/handlers-reference.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.
