# 清算抵押物拍卖的竞拍教程

* BakerDAO的清算采用和MakerDAO一致的机制，当用户的金库抵押物价值不足最低抵押率要求的时候，任何人都可以触发清算操作，清算用户不足的资产以获利，同时保证整个系统的抵押率稳定在最低要求以上。

## 机器人下载和安装  <a href="#ji-qi-ren-xia-zai-he-an-zhuang" id="ji-qi-ren-xia-zai-he-an-zhuang"></a>

### 机器人下载连接  <a href="#ji-qi-ren-xia-zai-lian-jie" id="ji-qi-ren-xia-zai-lian-jie"></a>

{% embed url="<https://github.com/BakerDAO-Fi/auction-keeper>" %}

### &#x20;或者通过git clone下载： <a href="#huo-zhe-tong-guo-git-clone-xia-zai" id="huo-zhe-tong-guo-git-clone-xia-zai"></a>

```
git clone https://github.com/BakerDAO-Fi/auction-keeper.git
```

### 下载依赖模块 [pymaker](https://github.com/BakerDAO-Fi/pymaker) , pygasprice-client :  <a href="#xia-zai-yi-lai-mo-kuai-pymaker-pygaspriceclient" id="xia-zai-yi-lai-mo-kuai-pymaker-pygaspriceclient"></a>

```
cd auction-keeper git submodule update --init --recursive 
```

&#x20;注释： 如果运行时报错缺 BSC 项目合约的配置文件 “bscmainnet-addresses.jso&#x6E;**” ，** 可以手动下载该文件： [bsc**mainnet-addresses.json​**](https://github.com/BakerDAO-Fi/pymaker/blob/main_bsc/config/bscmainnet-addresses.json)

### python 环境：  <a href="#python-huan-jing" id="python-huan-jing"></a>

推荐使用项目用的 python 3.6.6 版本， 安装完python 环境后， install requirments.txt

```bash
pip3 install -r requirments.txt
```

## **机器人抵押物拍卖参数**  <a href="#ji-qi-ren-di-ya-wu-pai-mai-can-shu" id="ji-qi-ren-di-ya-wu-pai-mai-can-shu"></a>

**配置参数传给 main.py, 以下例子通过一个bash 文件做参数配置例子（flip-bnb-a.sh）以竞拍金库类型 BNB-A 为例:**

```bash
dir="$(dirname "$0")"

bin/auction-keeper \
--rpc-host 'https://bsc-dataseed.binance.org' \
#参与竞拍的钱包地址
--eth-from '0x*******************************' \ 
#钱包地址的keystore 文件和密码文件， 生成keystore 方式钱包可以使用：www.myetherwallet.com/
--eth-key 'key_file=/path/key_file.json,pass_file=/path/key_pass.txt' \
#开始区块，可以设置成该金库类型大概部署时的区块
--from-block 8431876 \  
--fixed-gas-price 6 \   
--chunk-size 4800 \
--gas-maximum 10 \
#拍卖类型（flip : 抵押物拍卖）， 参与拍卖的金库类型(BNB-A)
--type flip --ilk BNB-A \ 
#竞价model，需要自己写策略。
--model '/path/bid_model_ht.sh' \ 
--network 'bscmainnet' \
#参与竞拍的BAI 数量
--vat-dai-target '1000' 
--bid-check-interval 3 \  
--keep-dai-in-vat-on-exit \
--log "/path/bnb_a_mainnet.log" \
--info
```

**竞拍models**\
竞拍models 建议自己写策略， 以下是一个最简单的例子, 以固定价格 250  BAI 参与竞拍 BNB (bid\_model\_bnb.sh)：

```bash
    #!/usr/bin/env bash    
    #在此处输入您想要的固定价格进行竞拍， 比如你想以300BAI 参与竞拍HT    
    echo "{\"price\": \"300\"}"     
    #锁定价格时长（秒）    
    sleep 60 
```

## &#x20;本地运行机器人（ **flip-bnb-a.sh 在项目根目录）**：  <a href="#ben-di-yun-hang-ji-qi-ren-jia-ru-fliphtash-zai-xiang-mu-gen-mu-lu" id="ben-di-yun-hang-ji-qi-ren-jia-ru-fliphtash-zai-xiang-mu-gen-mu-lu"></a>

```bash
sh flip-ht-a.sh
```

更多详情文档，请参考 [makerDAO Auction keeper 文档](https://docs.makerdao.com/auctions/the-auctions-of-the-maker-protocol)​


---

# 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.bakerfi.com/bakerdao/guide/flip-auctions.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.
