> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xmonaco.com/llms.txt
> Use this file to discover all available pages before exploring further.

# useFees

> Simulate order fees before placing trades

```tsx theme={null}
import { useFees } from "@0xmonaco/react";

const { simulateFees, getMyFeeTier } = useFees();
```

## Methods

<ResponseField name="simulateFees" type="(params: SimulateFeeParams) => Promise<SimulateFeeResponse>">
  Calculate exact fees for an order before placing it. Requires authentication.

  **Parameters:**

  * `tradingPairId`: string - Trading pair UUID
  * `side`: "BUY" | "SELL" - Order side
  * `price`: string - Price per unit
  * `quantity`: string - Quantity to trade
  * `orderType`: "LIMIT" | "MARKET" (optional) - Defaults to LIMIT behaviour if omitted. Pass `"MARKET"` to get a slippage-adjusted `buyOrderLockAmount`
  * `slippageToleranceBps`: number (optional, 0–1000) - Slippage tolerance in basis points. Only valid with `orderType: "MARKET"`. Default: `1000` (10%), matching the protective price band

  **Returns:**

  * `notional`: string - Total order value (price × quantity)
  * `monacoTakerFee`: string - Monaco protocol taker fee
  * `monacoTakerFeeBpsExact`: string | null - Tier-resolved Monaco taker rate as a decimal bps string (e.g. `"6.5"`) — the exact rate the ledger charges this caller, equal to `monacoTakerFee / notional`. Prefer this over the integer field below
  * `monacoMakerRebateBpsExact`: string | null - Tier-resolved Monaco maker rebate as a decimal bps string (negative = rebate, e.g. `"-1"`) — the exact rate the ledger credits this caller
  * `monacoTakerFeeBps`: number - **Deprecated.** Whole-bps taker rate; an integer cannot carry fractional tiered rates (e.g. 6.5), so this echoes the flat trading-pair column, not the tier-resolved rate. Use `monacoTakerFeeBpsExact` or `getMyFeeTier`
  * `monacoMakerRebate`: string - Monaco maker rebate (negative = rebate)
  * `monacoMakerRebateBps`: number - **Deprecated.** Whole-bps maker rebate; same integer limitation as above. Use `monacoMakerRebateBpsExact` or `getMyFeeTier`
  * `applicationTakerFee`: string - Application taker fee
  * `applicationTakerFeeBps`: number - Application fee in basis points
  * `applicationName`: string | null - Application name (if applicable)
  * `totalTakerFees`: string - Total fees for taker (monaco + application)
  * `takerTotalPayment`: string - Total amount taker must pay
  * `makerTotalReceipt`: string - Total amount maker receives
  * `buyOrderLockAmount`: string | null - Amount to lock for BUY orders. For MARKET orders includes slippage buffer
  * `maxQuantity`: string | null - Maximum quantity affordable at the given price, after fees. Use this for the 100% balance slider
  * `maxQuantityRaw`: string | null - Same value in raw (smallest unit) format
  * `slippageToleranceBps`: number | null - Slippage tolerance used in the calculation, echoed back. `null` for LIMIT orders
</ResponseField>

<ResponseField name="getMyFeeTier" type="(params: GetMyFeeTierParams) => Promise<GetMyFeeTierResponse>">
  Look up your current fee tier, rolling 14-day volumes, and a pair's six-row fee schedule. Requires authentication. The tier and volumes are wallet-wide: they sum the wallet's trades across every application it trades through, so they read the same from any application.

  **Parameters:**

  * `tradingPairId`: string - Trading pair UUID whose fee schedule to return

  **Returns:**

  * `currentTierLevel`: number - Resolved tier, `1` (lowest volume) through `6` (highest), from the higher of `weightedVolume14d` and any volume floor set on the wallet (a floor that is set or changed counts once it applies to the wallet's fills, usually within a minute, and likewise for an account the wallet opens in a new application; it stops counting at once when removed or expired)
  * `weightedVolume14d`: string - Weighted 14-day volume (perp + 2.5× spot) the tier resolves from, unless a higher volume floor is set on the wallet
  * `spotVolume14d`: string - Rolling 14-day spot volume
  * `perpVolume14d`: string - Rolling 14-day perp volume
  * `volumeToNextTier`: string | null - Additional weighted volume needed to reach the next tier, counted from the volume the current tier resolved from; omitted at tier 6
  * `nextTierLevel`: number | null - Next tier level; omitted at tier 6
  * `feeSchedule`: FeeTierScheduleRow\[] - The pair's six rows, ascending by tier. Each row: `tierLevel` (number), `minVolumeThreshold` (string), `makerFeeBps` (string — human bps, negative = rebate), `takerFeeBps` (string — human bps)
</ResponseField>

## Example

```tsx theme={null}
import { useFees, useMarket } from "@0xmonaco/react";
import { useState, useEffect } from "react";

function FeeCalculator() {
  const { getTradingPairBySymbol } = useMarket();
  const { simulateFees } = useFees();
  const [fees, setFees] = useState(null);

  const calculateFees = async () => {
    const pair = await getTradingPairBySymbol('BTC/USDC');

    // LIMIT order — exact fee calculation
    const result = await simulateFees({
      tradingPairId: pair.id,
      side: "BUY",
      price: "50000",
      quantity: "0.1"
    });

    setFees(result);
  };

  return (
    <div>
      <button onClick={calculateFees}>Calculate Fees</button>
      {fees && (
        <div>
          <p>Order Value: ${fees.notional}</p>
          <p>Total Fees: ${fees.totalTakerFees}</p>
          <p>You Pay: ${fees.takerTotalPayment}</p>
          {/* 100% slider — use maxQuantity instead of balance / price */}
          <p>Max quantity you can buy: {fees.maxQuantity}</p>
        </div>
      )}
    </div>
  );
}
```

## Fee Breakdown

Monaco uses a maker-taker fee model:

| Role | Fee Type | Description |
| - | - | - |
| **Taker** | Positive fee | Pay fees when taking liquidity (market orders, crossing spread) |
| **Maker** | Rebate | Earn rebates when providing liquidity (limit orders in book) |

Use `simulateFees` before placing orders to show users exact costs upfront.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.