> For the complete documentation index, see [llms.txt](https://bitlong.gitbook.io/api-doc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bitlong.gitbook.io/api-doc/tapd-api/pool2.md).

# Pool2

## 查询

### 1.1.swap交易记录总数

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/query/swap_trs/count`

示例

/pool/query/swap\_trs/count?<mark style="color:orange;">token\_a</mark>=<mark style="color:blue;">sat</mark>&<mark style="color:orange;">token\_b</mark>=<mark style="color:blue;">9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41</mark>

#### 参数

* `token_a` 代币A，`sat`或资产ID
* `token_b` 代币B，`sat`或资产ID

#### 响应

`data` 总数

```json
{"errno":0,"errmsg":"","data":8}
```

### 1.2.swap交易记录分页

#### 请求

<mark style="color:green;">`GET`</mark> `/pool/query/swap_trs`

示例

/pool/query/swap\_trs?<mark style="color:orange;">token\_a</mark>=<mark style="color:blue;">sat</mark>&<mark style="color:orange;">token\_b</mark>=<mark style="color:blue;">9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41</mark>&<mark style="color:orange;">limit</mark>=<mark style="color:blue;">10</mark>&<mark style="color:orange;">offset</mark>=<mark style="color:blue;">0</mark>

#### 参数

* `token_a` 代币A，`sat`或资产ID
* `token_b` 代币B，`sat`或资产ID
* `limit` 限制数据条数
* `offset` 跳过数据条数

#### 响应

* `id` <mark style="color:orange;">uint</mark> ID
* `price` <mark style="color:orange;">string</mark> 价格(swap均价)
* `number` <mark style="color:orange;">string</mark> 数量(资产总数)
* `total_price` <mark style="color:orange;">string</mark> 总价(sats总数)
* `npub_key` <mark style="color:orange;">string</mark> 用户名
* `tr_unixtime_ms` <mark style="color:orange;">int64</mark> 时间戳，UnixMilli
* `assets_id` <mark style="color:orange;">string</mark> 资产ID
* `type` <mark style="color:orange;">string</mark> buy/sell

```json
{"errno":0,"errmsg":"","data":[{"id":24,"price":"1.008572869","number":"9915","total_price":"10000","npub_key":"eve","tr_unixtime_ms":1735022324617,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"sell"},{"id":23,"price":"1.018744906","number":"9816","total_price":"10000","npub_key":"eve","tr_unixtime_ms":1735022324582,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"sell"},{"id":22,"price":"1.031","number":"10000","total_price":"10310","npub_key":"bob","tr_unixtime_ms":1735022324548,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"buy"},{"id":21,"price":"1.0205","number":"10000","total_price":"10205","npub_key":"bob","tr_unixtime_ms":1735022324509,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"buy"},{"id":20,"price":"0.9642829592","number":"103704","total_price":"100000","npub_key":"steve","tr_unixtime_ms":1735022318679,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"buy"},{"id":19,"price":"0.95095","number":"100000","total_price":"95095","npub_key":"steve","tr_unixtime_ms":1735022318643,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"sell"},{"id":18,"price":"0.959969281","number":"104170","total_price":"100000","npub_key":"alice","tr_unixtime_ms":1735022318609,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"buy"},{"id":17,"price":"0.94648","number":"100000","total_price":"94648","npub_key":"alice","tr_unixtime_ms":1735022318567,"assets_id":"9f03947580b8a5dc4c27799b176467cf4b9a48158d377ce2d0c3fe8757971e41","type":"sell"}]}
```
