# Liquidity Provider and Protocol Fees

Note: not all FXPools charge the same 8 bps per trade. See the subpages for the actual fees charged

<figure><img src="https://2822860750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6utITMNjJXVJJVMgUpbZ%2Fuploads%2Fu9TkF7CQ2hZhTX5DwJJn%2FUntitled.png?alt=media&#x26;token=70eed8c9-11f8-493d-82a7-dd7b6692f175" alt=""><figcaption><p>Trading Fees</p></figcaption></figure>

LP Fees

1. For every successful trade, a percentage of the transaction value is deducted as trading fees and remains in the pool
2. A portion of these fees is allocated to liquidity providers (LPs) and paid to them upon withdrawal, while the rest is allocated to the protocol. For a detailed breakdown of fee distribution between LPs and the Protocol for individual pools, please refer to the subsections of the Fee page and find the specific pool you are interested in for more details.

Protocol Fees

<figure><img src="https://2822860750-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F6utITMNjJXVJJVMgUpbZ%2Fuploads%2FMel4DZYgtTL03uCd9TM1%2FDisperse%2520Protocol%2520Fees%2520(with%2520figures).png?alt=media&#x26;token=16f447b8-ce22-446c-b0fe-03f1a844d6f5" alt=""><figcaption><p>Disperse Protocol Fees</p></figcaption></figure>

1. The FXPool tracks the protocol unclaimed fees from transactions through a public parameter, `FXPool.totalUnclaimedFeesInNumeraire`, where "numeraire" represents USD value in our code
2. On every LP deposit/withdraw, `FXPool.totalUnclaimedFeesInNumeraire` is paid to the protocol fee distributor contract
3. The `disperseFees` function can then be called by anyone, distributing half of the unclaimed fees to the Xave fee collector address and the other half to Balancer's fee collector.

\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_

## Simulated Fee Computation&#x20;

#### Simulated Transaction

| Swap In (XSGD) | Swap Out (USDC) |
| -------------- | --------------- |
| 100            | 75.57378887     |

| XSGD/USD Price | USDC/USD Price |
| -------------- | -------------- |
| 0.75637240     | 1.00003892     |

#### Sample Parameters and Fee Break Down:

| Fee Break Down                                     | Fees value (bps)                  | Fee Value (Numeraire) |
| -------------------------------------------------- | --------------------------------- | --------------------- |
| LP Fees                                            | 5.04                              | 0.03812117283         |
| Protocol Fees (Xave)                               | 1.48                              | 0.01119431152         |
| Protocol Fees (Balancer)                           | 1.48                              | 0.01119431152         |
| <mark style="color:red;">Total Trading Fees</mark> | <mark style="color:red;">8</mark> | 0.06050979814         |

<br>
