# 用户与资产

## 查询用户信息

```
GET /api/v1/users/{userId}
```

### 路径参数

| 参数       | 类型     | 说明                         |
| -------- | ------ | -------------------------- |
| `userId` | string | 当前版本为用户钱包地址。服务端 trim 后转小写。 |

### 返回 `data`

| 字段            | 类型     | 说明              |
| ------------- | ------ | --------------- |
| `userId`      | string | 用户 ID，当前等于钱包地址。 |
| `userAddress` | string | 钱包地址。           |

***

## 查询资产组合

```
GET /api/v1/users/{userId}/balance
```

### Query 参数

| 参数               | 类型     | 必填 | 默认值           | 说明                            |
| ---------------- | ------ | -- | ------------- | ----------------------------- |
| `spenderAddress` | string | 否  | `0x000...000` | 查询 allowance 时使用的 spender 地址。 |

### 返回 `data`

| 字段              | 类型     | 说明          |
| --------------- | ------ | ----------- |
| `chainId`       | number | 链 ID。       |
| `productType`   | string | 产品类型。       |
| `address`       | string | 用户钱包地址。     |
| `mUsdBalance`   | string | mUSD 余额。    |
| `tokenBalances` | array  | token 持仓列表。 |

### `tokenBalances` 单项

| 字段                | 类型            | 说明                         |
| ----------------- | ------------- | -------------------------- |
| `address`         | string        | Token 地址。                  |
| `name`            | string        | Token 名称。                  |
| `symbol`          | string        | Token symbol。              |
| `stockSymbol`     | string / null | 股票 symbol，仅股票 token 适用。    |
| `isStock`         | boolean       | 是否为股票 token。               |
| `decimals`        | number        | Token decimals。            |
| `price`           | number / null | Token 价格，仅股票 token 适用。     |
| `walletBalance`   | string        | 钱包余额（人类可读单位）。              |
| `walletAllowance` | string        | 钱包对 spender 的授权额度（人类可读单位）。 |
| `exchangeBalance` | string        | 交易所内余额（人类可读单位）。            |
| `logoUrl`         | string        | Logo 地址。                   |

***

## 查询持仓列表

```
GET /api/v1/users/{userId}/positions
```

参数与 `/balance` 相同。返回 `data` 为 `tokenBalances` 数组。


---

# 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.anchored.finance/trading-api-docs-zh/api-jie-kou/user-assets.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.
