> For the complete documentation index, see [llms.txt](https://docs.saros.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.saros.xyz/kr/saros-dlmm/technical-guides/user-position.md).

# 사용자 포지션

### 개요(Overview)

유동성을 제공한 후, Saros DLMM REST API를 통해 자신의 포지션을 조회할 수 있습니다. 두 가지 엔드포인트가 제공됩니다:

1. 빈 단위 포지션(Bin-Level Positions): 각 포지션의 빈(Bin)별 세부 정보를 조회
2. 풀 단위 포지션(Pool-Level Positions): 풀(Pool)별 집계된 요약 정보 조회

### 사용자 포지션 조회(Fetching User Positions)

유동성을 추가한 후, Liquidity Book API를 사용하여 자신의 포지션을 가져올 수 있습니다. 사용 가능한 엔드포인트는 다음과 같습니다.

#### 1. 빈 단위 포지션 조회(Fetch Bin-Level Positions)

이 엔드포인트는 사용자의 포지션에서 각 빈(Bin)에 대한 상세 정보를 반환합니다:

```
// Fetch bin-level positions
const fetchBinPositions = async (userId: string, pairId?: string) => {
  const params = new URLSearchParams({
    user_id: userId,
    page_num: "1",
    page_size: "100",
  });

  if (pairId) {
    params.append("pair_id", pairId);
  }

  const response = await fetch(`/api/bin-position?${params.toString()}`);
  if (!response.ok) {
    throw new Error("Failed to fetch bin positions");
  }

  return await response.json();
};

// Example usage
const binPositions = await fetchBinPositions(wallet.publicKey.toString());
console.log("Bin positions:", binPositions);

```

응답에는 사용자의 포지션에 포함된 각 빈(Bin)에 대한 상세 정보가 포함됩니다. 여기에는 다음이 포함됩니다:

* 빈 ID(Bin ID)
* 각 빈에 포함된 토큰 수량(Token amounts in each bin)
* 유동성 지분(Liquidity shares)
* 가격 정보(Price information)

### 2. 풀 단위 포지션 조회 (Fetch Pool-Level Positions)

이 엔드포인트는 사용자의 포지션을 풀 단위로 집계하여, 각 풀에서 보유한 전체 유동성에 대한 요약을 제공합니다.

```
// Fetch pool-level positions
const fetchPoolPositions = async (userId: string, pairId?: string) => {
  const params = new URLSearchParams({
    user_id: userId,
    page_num: "1",
    page_size: "100",
  });

  if (pairId) {
    params.append("pair_id", pairId);
  }

  const response = await fetch(`/api/pool-position?${params.toString()}`);
  if (!response.ok) {
    throw new Error("Failed to fetch pool positions");
  }

  return await response.json();
};

// Example usage
const poolPositions = await fetchPoolPositions(wallet.publicKey.toString());
console.log("Pool positions:", poolPositions);

```

각 풀에서 사용자의 포지션에 관한 응답(Response)에 포함되는 정보:

* 총 유동성 (Total liquidity)
* 총 토큰 수량 (Total token amounts)
* 풀 정보 (Pool information) – 수수료, 토큰 세부사항 등
* 가격 정보 (Price information)


---

# 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.saros.xyz/kr/saros-dlmm/technical-guides/user-position.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.
