# How to calculate fees

The trading fee is calculated at the time of opening and charged at the time of closing a position. The fee is charged only in the cryptocurrency in which the trade took place. To calculate the fee as a percentage of the amount invested in the position, use the formula:

Fee (%) = Trading fee (%) * Leverage * 2

To calculate the fee in cryptocurrency, use another formula:

Fee = Order amount * Trading fee (%) * Leverage * 2

You can check the current trading fee (%) on the page:

https://fybit.com/FeesAndLimits

As we can see, the fee depends on the order amount, trading fee%, and leverage. The fee does not depend on the type of orders (marker or limit), asset price, profit or loss in a trade, the number of executed orders, and so on.

If we set up a position using several orders in one direction, then we need to summarize the volume of orders and calculate the average leverage.

To calculate the average leverage, use the formula:

Average leverage = (Order amount 1 * Leverage 1 + Order amount 2 * Leverage 2 + … + Order amount n * Leverage n) / (Order amount 1 + Order amount 2 + … + Order amount n)

Here is an example of a formula for calculating the trading fee consisting of 3 orders:

Fee = (Order amount 1 + Order amount 2 + Order amount 3) * Trading fee (%) * ((Order amount 1 * Leverage 1 + Order amount 2 * Leverage 2 + Order amount 3 * Leverage 3) / (Order amount 1 + Order amount 2 + Order amount 3)) * 2

For example, if you open 1 Buy UP Market order for 0.1 BTC with 10x leverage at 55,000 and 1 Buy UP Limit order for 0.3 BTC with 2x leverage at 50,000, then the fee will be calculated using the following formula:

Fee = (0.1 BTC + 0.3 BTC) * 0.075% * ((0.1 BTC * 10 + 0.3 BTC * 2) / 0.4 BTC) * 2

Fee = 0.4 BTC * 0.075% * 4 (leverage) * 2

Fee = 0.0024 BTC or 0.6%.

Note that orders that have been opened in the same direction will be merged into one. At the same time, orders opened in the opposite direction are added to the opposite position and do not participate in the calculation of the fee for the first position. That is, for each instrument, only one UP position and one DOWN position can be opened at a time, the size of which is the sum of all orders in each direction. 