> For the complete documentation index, see [llms.txt](https://docs.gmgn.ai/cn/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gmgn.ai/cn/he-zuo-jiao-ben-ru-he-kuai-su-da-jian-gmgn-bot-zi-dong-jiao-yi-jiao-ben.md).

# 🤝🏻 合作-脚本：💵如何快速搭建GMGN Bot自动交易脚本

你可以利用Telegram API，自动喂代币合约地址给GMGN Sniper Bot，实现**快速买卖代币**，**创建限价买入/限价卖出**。适用场景：

1. 监听聪明钱信号，自动买入+挂单限价卖出 (自动止盈止损)
2. 监听链上交易信号，CTO信号，自动买入+挂单限价卖出 (自动止盈止损)

## 具体步骤：

## 1. 🔔监听GMGN交易信号和聪明钱

#### 1) 🔔订阅GMGN Signal信号

* 加入信号群 <https://t.me/gmgnsignals>
* 接收特色信号消息（已有10+信号，持续开发中）：

  * CTO信号 (社区接管）
  * Update DEX Screener Social Infos (更新社交三件套)
  * PUMP Update DEX Screener Social Infos (PUMP币更新社交三件套)
  * PUMP FDV Surge (PUMP内盘代币快速飙升)
  * Solana FDV Surge (Solana代币快速飙升)
  * Smart Money FOMO (聪明钱FOMO)
  * KOL FOMO
  * DEV Burnt Alert (作者烧币)
  * ATH Price (历史新高)
  * Heavy Bought (大单买入)
  * Sniper New (狙新币)

  <figure><img src="/files/hu8EyIcdfpeMupLUFhue" alt=""><figcaption></figcaption></figure>

## 2) 💰关注聪明钱

* 访问GMGN.AI聪明钱榜单，找到胜率高，并且适合自己交易风格的聪明钱 <https://gmgn.ai/discover/?chain=sol>

  <figure><img src="/files/43bT7H8dxbnozW3pkNHP" alt=""><figcaption></figcaption></figure>

## 2. 🙋🏼‍♀️申请Telegram APP API

* 登录 <https://my.telegram.org/auth>
* 创建Telegram APP，填写表单，获取APP的**api\_id** 和 **api\_hash** （注意，不要泄露给任何第三方，防止Telegram账号被盗）。详细教程见Telegram官方文档 <https://core.telegram.org/api/obtaining_api_id>

## 3. 🤖搭建自动化脚本

* 你需要编写自动化脚本，或者从github.com搜索相关功能的开源项目 (注意鉴别代码安全性，避免Telegram被盗号)
* 自动化脚本代码逻辑：
  * 用上述**api\_id** 和 **api\_hash**接收来自GMGN信号群消息，或者自己从其他频道/群组获取的交易信号，或者自己监听聪明钱链上交易 (例如在Solana rpc供应商alchemy开付费套餐，websocket监听指定钱包的交易动态)
  * 根据收到的信号消息，按照自己的喜好，自制代币过滤条件，置顶交易策略 (提取代币合约地址CA)
  * 发送交易命令给[GMGN Sniper Bot](https://t.me/GMGN_sol03_bot):
    * 方法1（傻瓜式，速度更快）：发送代币合约地址。需要先开启GMGN Sniper Bot的自动买入，自动卖出功能(预设止盈止损单，当买入时，自动挂卖出限价单)。— 功能开发中，近期上线
    * 方法2（参数更灵活）：发送交易命令，例如立即买入/卖出，创建限价买入/限价卖单。交易命令如下：

```
立即买入
/buy ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82 0.5
表示立即买入 0.5 SOL BOME代币

立即卖出
/sell ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82 50
/sell ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82 50%
表示立即卖出 50% BOME代币持仓

创建限价买入挂单
/create limitbuy ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82 0.5@0.1 -exp 3600
表示创建BOME代币限价买单，金额 0.5 SOL，触发价 $0.1，过期时间1小时(3600秒)

创建限价卖出挂单
/create limitsell ukHH6c7mMyiWCf1b9pnWe25TSpkDDt3H5pQZgZ74J82 50@0.1 -exp 3600
表示创建BOME代币限价卖单，卖出50%持仓，触发价 $0.1，过期时间1小时(3600秒)

注：如果'-exp'参数未填写，则限价单的默认有效期是3天
```

## 4.🎉 自动化脚本搭建完成

建议先用小额金额操作，测试交易策略。

如果你对自动化交易策略感兴趣，欢迎加入GMGN官方群讨论 <https://t.me/gmgn_official>


---

# 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.gmgn.ai/cn/he-zuo-jiao-ben-ru-he-kuai-su-da-jian-gmgn-bot-zi-dong-jiao-yi-jiao-ben.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.
