# Tricrypto dynamic fee parameters research and proposal

**URL:** <http://gov.curve.finance/t/tricrypto-dynamic-fee-parameters-research-and-proposal/9588>\
**Category:** Proposals\
**Created:** [September 3, 2023, 11:38pm UTC](http://gov.curve.finance/t/tricrypto-dynamic-fee-parameters-research-and-proposal/9588 "2023-09-03T23:38:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![michwill](http://gov.curve.finance/letter_avatar_proxy/v4/letter/m/8e8cbc/32.png) [@michwill](http://gov.curve.finance/u/michwill)\
**Post date:** [September 3, 2023, 11:38pm UTC](http://gov.curve.finance/t/tricrypto-dynamic-fee-parameters-research-and-proposal/9588/1 "2023-09-03T23:38:50Z")

</div>

**Preface**

After optimizing TriCRV pool with somewhat-high `out_fee`, I noticed that it reaches low fees much faster than tricrypto pools (which have `out_fee` lower). In addition, it seems to show a much better fee APY. Hence, I decided to re-apply same approach to optimizing tricrypto pools, and saw some interesting results. Tricryptos in simulations show APY (before admin fee) somewhere between 3 and 5% which somewhat matches the performance of tricrypto2 (which is very well arbitraged) but not yet tricrypto-NGs.

**Approach**  
Idea appeared rather simple. We set amplification fixed (say `A=10`) as well as `mid_fee` and `out_fee`. Here I chose `mid_fee = 0.03%`, and `out_fee` varied from `0.8%` to `5.0%` in different simulations. For each value of `out_fee` I performed a 2D scan `(fee_gamma, gamma)`. The parameter `fee_gamma` is responsible for the steepness of dynamic fee function, and `gamma` is responsible for the width of the concentrated liquidity part of the liquidity distribution.  
In each of the scans, we find maximum APY, and keep track of volume and average slippage in the point of maximum APY. We are looking for the maximum of volume / minimum of slippage in those points of maximum APY as we scan `out_fee`.

**Raw simulation results**  
The simulation results are located [on Github](https://github.com/curvefi/cryptopool-simulator/tree/main/tricrypto-resim). Here I attach pictures for different parameters just for the beauty of them.

`out_fee=0.8%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/c/ce4b204bc1bd6f977d4d97b3a2875589fd4785f5.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/f/f1776ce56474d5af9aa9e56d61f461c27bcb76fe.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/2/2e4760e7df84170455024bcddf34be56c4546ced.png)

`out_fee=1.2%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/0/0ff170c82ccf44a9e6da23345763a9c2d5c4b218.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/0/05422baa24b5efe73f29ae1127fe19cdd5188ffb.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/5/5ff8f669b9bcb6536eb9728d87e4b9a724f3c02c.png)

`out_fee=2%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/7/74fe4bc2668246e7608e44ff9388e9fc85fd8211.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/3/38f4e6a2839cea49bcea48393b922f3267f0a4be.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/8/889a20912f59c28f5354ded2eb7273cb76009852.png)

`out_fee=2.5%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/f/f1efca5cdbe9ed5e34d973a258e36f6df0d6f5f2.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/e/ecdd23fde218423e2af47bf8b11b5edb4efe4d61.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/5/5ba349b7f4fc86f9fd86f7a0e41eacf8dbd2b042.png)

`out_fee=3%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/c/ca56a3daa2bcf657c9284f4c8249904eaa6278b4.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/0/016bbb238d6cc410dc7d0f142e73ec455e2ea57b.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/9/95f92a2cb3e735b7aa1fba750dbc0837433efc87.png)

`out_fee=3.5%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/2/2a69b332cceb34e75c9b581ba512059c4a2c27d9.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/8/89a2643a29a15c362fe6c5e2f709140133e91b50.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/4/424ece0d928c1555521264515cabae0bfb410ad8.png)

`out_fee=4%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/8/832a1f6eade9706b71e33641665f2e24fe79a9c9.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/f/f8b6840885c338eec1e23ca56d5f3b39e8c5270e.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/5/58f33832e9d8890f8f44d52467440c63f6f00a49.png)

`out_fee=5%`:  
APY:

 ![apy](https://gov.curve.finance/uploads/default/original/2X/9/9fc996fc96caa3cff7e7df72a0cc60cd8e935718.png)  
Slippage:  
 ![slippage](https://gov.curve.finance/uploads/default/original/2X/a/a2e511eeab493c0a0e09ff65e134ddc1cb2840a2.png)  
Volume:  
 ![vol](https://gov.curve.finance/uploads/default/original/2X/b/b5f1f02a6f6c83eb4bf2729bc66ddbb850ae2e63.png)

**Summary graphs**

 ![APY](https://gov.curve.finance/uploads/default/original/2X/6/69cda2a9362680314e9e36550f1d8a8ca27673ab.png)  
 ![Slippage](https://gov.curve.finance/uploads/default/original/2X/4/46f5d6d8f6187370338c39c593d5013a6fad9b7e.png)  
 ![Volume](https://gov.curve.finance/uploads/default/original/2X/8/833385bd66dd1ac596951e72d4cb6870c5b4f9f9.png)

**Conclusion**  
It can be seen that maximum volume and minimal slippage (while APY is maximized in fee\_gamma x gamma scan) occurs at `out_fee=3%` when `mid_fee=0.03%`. **The value of fee APY there is 44%, around 10x of what we currently have at the best conditions**.  
Keep in mind that these are just simulations, and one should be careful with conclusions. The real numbers are to be seen in practice.

**Proposal**  
Change parameters of trcicryptoUSDT first to `(A=10, gamma=4.01e-5, fee_gamma=7.34e-5)`. Keep in mind that in the contract one should multiply this A by `3**3 * 10000`. After that, observe how it behaves in comparison with tricryptoUSDC. If we like the results - change parameters of that one and TricryptoLLAMA to the same. Also, reduce `allowed_extra_profit` and `adjustment_step` for a more precise and fast `price_scale` adjustment (same as in TriCRV will do).
