# Collect Fee

You can directly collect position fee through the collect\_position\_fee method in the Cetus DLMM pool module.

```rust
/// Collects accumulated fees from a position.
///
/// This function extracts the accumulated fees from a position and returns
/// them as token balances. The fees are taken from the pool's balance.
///
/// ## Type Parameters
/// - `CoinTypeA`: First token type in the pool
/// - `CoinTypeB`: Second token type in the pool
///
/// ## Parameters
/// - `pool`: Mutable reference to the pool
/// - `position`: Mutable reference to the position
/// - `config`: Global configuration
/// - `versioned`: Versioned object for compatibility check
/// - `ctx`: Transaction context
///
/// ## Returns
/// - `(Balance<CoinTypeA>, Balance<CoinTypeB>)`: Collected fee balances
///
/// ## Events Emitted
/// - `CollectFeeEvent`: Contains position and fee amounts
///
/// ## Errors
/// - `EPositionPoolNotMatch`: If position doesn't belong to this pool
public fun collect_position_fee<CoinTypeA, CoinTypeB>(
    pool: &mut Pool<CoinTypeA, CoinTypeB>,
    position: &mut Position,
    config: &GlobalConfig,
    versioned: &Versioned,
    ctx: &TxContext,
): (Balance<CoinTypeA>, Balance<CoinTypeB>) {
    abort 1
}
```


---

# 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://cetus-1.gitbook.io/cetus-developer-docs/developer/via-dlmm-contract/features-available/collect-fee.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.
