You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The make_trade (as well as get price methods) have a route of [token1, WETH, token2]
By default. You can specify the route parameter (for univ2 at least). Mentioned route causes two swaps: token1->weth; weth->token2. Taker's fee is applied twice, so total fee = 1-0.997^2=0.005991
I've checked this. Well, it is possible for get_price methods, but make_swap methods don't have such an option actually, which is surprising. However, it is relatively easy to add it.
When I come to think about it, the default should be [t0,t1] (and a boolean for going through [t0,weth,t1] route) and in case such pair doesn't exist an exception thrown suggesting to set the boolean parameter to true. Because incurring double fee breaks the principle of least surprise.
Well, it is possible for get_price methods, but make_swap methods don't have such an option actually, which is surprising. However, it is relatively easy to add it.
When I come to think about it, the default should be [t0,t1] (and a boolean for going through [t0,weth,t1] route) and in case such pair doesn't exist an exception thrown suggesting to set the boolean parameter to true.
@romanbsd The issue is that [t0, t1] is often a much less liquid pair than [t0, weth, t1], so chances are high that such a trade might have significant price impact and therefore a bad execution price.
Swaps are actually made using [t0, t1] right now though (no multi-hop swaps yet), so yeah...
Because incurring double fee breaks the principle of least surprise.
I agree, but in this case ensuring that the pair assumed has liquidity takes precedence imo (I'd be more surprised if I made a terrible trade, as in #198, then if I incurred an additional 0.3% fee).
Hey all, so i've been running into this issue because sometimes my clients have LP as [t0, stablecoin] instead of [t0, bnb/eth/base_token], and not being able to customize route in make_trade is not ideal.
Should we add an optional param route= to make_trade? I have a working solution; i'd be happy to contribute
Activity
liquid-8 commentedon Nov 24, 2021
By default. You can specify the
routeparameter (for univ2 at least). Mentioned route causes two swaps: token1->weth; weth->token2. Taker's fee is applied twice, so total fee = 1-0.997^2=0.005991romanbsd commentedon Nov 24, 2021
I don't think you can do that using this library.
liquid-8 commentedon Nov 25, 2021
I've checked this. Well, it is possible for get_price methods, but make_swap methods don't have such an option actually, which is surprising. However, it is relatively easy to add it.
romanbsd commentedon Dec 14, 2021
When I come to think about it, the default should be [t0,t1] (and a boolean for going through [t0,weth,t1] route) and in case such pair doesn't exist an exception thrown suggesting to set the boolean parameter to true. Because incurring double fee breaks the principle of least surprise.
ErikBjare commentedon Dec 21, 2021
@liquid-8 Yeah, I might look into that.
@romanbsd The issue is that [t0, t1] is often a much less liquid pair than [t0, weth, t1], so chances are high that such a trade might have significant price impact and therefore a bad execution price.
Swaps are actually made using [t0, t1] right now though (no multi-hop swaps yet), so yeah...
I agree, but in this case ensuring that the pair assumed has liquidity takes precedence imo (I'd be more surprised if I made a terrible trade, as in #198, then if I incurred an additional 0.3% fee).
ErikBjare commentedon Dec 21, 2021
@liquid-8 Apparently I had already been working on that in #221, feel free to continue the work! (I might not have time)
romanbsd commentedon Dec 21, 2021
Insufficient liquidity is caveat emptor. But maybe some safeguard is needed indeed...
starascendin commentedon Mar 7, 2022
Hey all, so i've been running into this issue because sometimes my clients have LP as [t0, stablecoin] instead of [t0, bnb/eth/base_token], and not being able to customize
routeinmake_tradeis not ideal.Should we add an optional param
route=tomake_trade? I have a working solution; i'd be happy to contribute