# Volatility based fee

In times of high volatility or due to black swan events or unexpected real world events, the margin engine will be adding a flat 10bps fees as volatility fee and the asset volatility is calculated onchain based on price difference between pyth's reported price and pyth's reported EMA price for the asset.&#x20;

We monitor market volatility by comparing the reported price to the exponential moving average ([EMA](https://docs.pyth.network/documentation/how-pyth-works/ema-price-aggregation)) reported by Pyth’s oracles. If the difference between these prices exceeds a predefined threshold, the High Volatility Flag is set for the said asset. If it exceeds a greater threshold, then volatility based fee will be applied.&#x20;

**Thresholds for "High Volatility Flag"**

* Crypto: 2% difference between EMA and Spot.
* Metals: 0.66% difference between EMA and Spot.
* Currencies: 0.33% difference between EMA and Spot.

**Thresholds for "Close Only Mode"**

* Crypto: 5% difference between EMA and Spot.
* Metals: 1.1% difference between EMA and Spot.
* Currencies: 0.55% difference between EMA and Spot.

\
More info to be added!&#x20;


---

# 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.flash.trade/flash-trade/flash-trade-protocol/technical-architecture/volatility-based-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.
