Gains Network
Published in

Gains Network

gTrade v6.1: In-depth

Hi everyone!

In this article, we are going to explore in detail how the new fee types will be calculated after the v6.1 update. The docs will be updated very soon to reflect that and will include a full fee breakdown.

I am really excited for this update as the platform is right now operating significantly under its potential due to the risk management measures we’ve had to put in place after the LUNA/USD crash, I can’t wait to see lower leverages offered again and many pairs relisted!

Enjoy reading.
Séb

Price impact

Goal

Remove spot oracle manipulation risk, allowing listing pairs with lower liquidity than currently.

Calculation

The price impact will be specific for each pair, and will also be different on each side (long/short).

Each pair will have two parameters, the 1% depth above (for longs), and the 1% depth below (for shorts).

It will be calculated like so:

Price impact (%) = (Open interest {long/short} + New trade position size / 2) / 1% depth {above/below}.

It means the open price of all trades will still follow the spot price of the pair, but depending on the open interest on the pair it will be higher (longs) or lower (shorts).

Note: Price impact/spread never applies when closing a trade.

Example:

The “1% depth above price” parameter is $20m on BTC/USD, there is $500k of existing long open interest, and the user wants to open a $200k trade (collateral x leverage).

The price impact (%) will be ($500k + $200k / 2) / $20m = 0.03%. To that we need to add the base spread which after the update will go from 0.05% to 0.025% → 0.03% + 0.025% = 0.055%.

It means for example if the current spot price is $20,000 that the trade will be opened at $20,000 + 0.055% = $20,011

Methodology to set the parameter

For cryptos, we will use the 1% depth of Binance multiplied by two. Since we use the median spot prices of 7 exchanges, using the 1% depth of Binance only would be overly conservative, therefore we apply a multiplier of two to it.

Please note that this multiplier can be updated later in the future if required.

For major forex pairs, there won’t be any price impact, and for stocks, the 1% depths will be set at $10m (tier 1), $5m (tier 2), and $2.5m (tier 3).

Examples (accurate at the time of writing):

BTC/USD: $16m (1% depth above), $24m (1% depth below).
ETH/USD: $7.7m (1% depth above), $18.4m (1% depth below).
LINK/USD: $1.5m (1% depth above), $1.8m (1% depth below).

Rollover fees

Goal

Allow traders to use lower leverages while maintaining solid risk management for the protocol.

Calculation

It is very simple, there is a “rollover fee per block %” parameter that represents the cost to keep a trade open for each block.

It is charged on the initial collateral of the trade, each block:

Rollover fee = (Current block - trade open block) * rollover fee per block % * trade collateral.

Example:

You have closed a $1,000 collateral trade that was open for 10,000 blocks (5.5 hours) and the rollover fee per block was 0.00001% per block (= 157% per year). The rollover fee paid is 10,000 * 0.00001 / 100 * 1000 = 1 DAI.

Please note that rollover fees are deducted from the trade value just like negative PnL and make the liquidation price closer over time (higher for longs, lower for shorts).

Methodology to set the parameter

The parameter will depend on the volatility of the pair, which we measure using the ATR indicator (average true range):

Rollover fee per block % = (ATR % 4 week average)^x * 52 / y (with x = 1.25, and y = 20)

Please note that the x and y parameters can be updated later in the future if required.

The 1.25 exponent (x) is helpful because for example if a pair is 2x more volatile than BTC/USD, we estimate it to be slightly more than 2x risky for the protocol. And the 20 divider (y) is useful to set the parameter to a reasonable value.

Examples (accurate at the time of writing):

BTC/USD: 22 ^1.25 * 52 / 20 = 123% / year
EUR/USD: 1.94^1.25 * 52 / 20 = 5.95% / year
AAPL/USD: 7.5^1.25 * 52 / 20 = 32.27% / year

Please note that this rate is applied to the collateral only.

For example, a 123% / year rollover fee means 12.3% / year on the position size of a 10x leverage trade, and 1.23% / year on a 100x trade.

Funding fees

Goal

Aims to minimize the gap between long and short open interests to prevent very significant exposure on one side only on any trading pair.

Calculation

There is a “funding fee per block %” which is applied to the net exposure of a pair.

The net exposure of the pair will probably change while your trade is open, which means it keeps track of it using accumulated values per open interest (one for longs, and one for shorts). Here is how they are calculated:

Accumulated funding fee per OI (long) += (Long OI - Short OI) * blocks elapsed * funding fee per block % / Long OI.

Accumulated funding fee per OI (short) += (Short OI - Long OI) * blocks elapsed * funding fee per block % / Short OI.

We store the initial accumulated funding fee value when trades are opened, and update them every time the OI changes (when a trade is opened/closed).

Finally, to know how much your trade should pay/receive in funding fees, we simply do this:

Funding fee = (Current accumulated funding fee per OI - Initial accumulated funding fee per OI) * Trade collateral * Trade leverage.

If the value is negative, it is added to the trade value just like positive PnL, and also makes the liquidation price go further away. If the value is positive, it is removed from the trade value just like negative PnL, and also makes the liquidation price get closer.

Methodology to set the parameter

Just like for rollover fees, the parameter will depend on the volatility of the pair, which we measure using the ATR indicator (average true range):

Funding fee per block % = (ATR % 4 week average)^x * 52 / y (with x = 1.25, and y = 60)

Please note that the x and y parameters can be updated later in the future if required.

Examples (accurate at the time of writing):

BTC/USD: 22 ^1.25 * 52 / 60 = 41.29% / year
EUR/USD: 1.94 ^ 1.25 * 52 / 60 = 1.98% / year
AAPL/USD: 7.5 ^ 1.25 * 52 / 60 = 10.75% / year

Please note that for example if the funding fee rate per block corresponds to 40% / year, it doesn’t mean that 40% will be charged at all times.

It would only be the case if there is 0 exposure on the opposite side, as the funding rate is only applied to the net exposure of the pair.

For example, if there is $1m long exposure and $500k short exposure on this pair, the funding fees paid will be ($1m — $500k) * 40 / 100 = $200k per year, which represents a cost of 20% / year for longs and a reward of 40% / year for shorts.

Conclusion / TL;DR

If you have been using the platform for short-term trades (regardless of leverage), you will pay fewer fees than before.

This update’s purpose is to target new strategic fees at trades that are deemed riskier for the protocol (= extended exposure on one side over a long period of time) while significantly reducing existing ones. For example, the closing fee on collateral + PnL will be reduced from 1% to 0.5%.

Also, lower leverage will be allowed, more pairs will be relisted, max open interests will be raised gradually, and the maximum collateral per trade will go from 35k to 50k.

To conclude, this v6.1 update brings the platform back to life after the severe risk management limitations we’ve had to put in place after the LUNA/USD wins and puts it back on track to reach its full potential.

Note: The v6.1 contracts will be deployed in a few days. After that, there will be a 30h timelock to give the minting roles to the new contracts. Trading will never be paused, it will be a smooth transition.

Thank you for reading!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store