Streaming Swaps: Go Arb Yourself

in LeoFinance6 months ago (edited)



There's a pretty useful feature being implemented by L1 DEXes like Thorchain and Maya call streaming swaps. The concept is pretty basic but the way we interpret it can vary based on perception similar to how "impermanent losses" work. Is IL a "loss" or is it just a safe rebalancing strategy for those looking to mitigate their risk? The answer depends on our degenerate-level and appetite for overall risk.

Similar to DCA and impermanent loss, streaming swaps allow the user to quickly DCA their position without splashing the market too heavily. It's best done to mitigate slippage in a market that might be illiquid compared to the amount we are trying to trade. For example, if our swap was going to create less than 1% of slippage it's perhaps not worth doing a streaming swap as trying to reduce that <1% tax might not be worth it to the user. We all know how the market can move and the price of the token we are buying could easily spike up organically 5% on its own... completely defeating the purpose.

Of course on the other side of that coin is the fact that the user might not even care how much slippage the trade is going to create (even though this is the primary function). The secondary function of streaming swaps is DCA, so if a user wanted to buy that day's average: they employ streaming swaps to accomplish this goal.

Examples

Let's say I want to buy $10k of some random meme coin on Thorchain. The liquidity for this pool is such that slippage for the entire $10k at once would be something like a 30% loss. Let's also assume that this meme coin has liquidity on other exchanges, but for whatever reason we don't want to mess around with juggling multiple exchanges.

We can employ a streaming swap here to make 100 purchases over the course of the day. If there is enough liquidity or downward pressure across other exchanges arbitragers will move in to automatically balance the pool for the user; potentially reducing the 30% slippage cost down to 1% or less given a little luck.

Avoid on-chain operations

Imagine this meme coin exists on Ethereum. Making 100 on-chain Ethereum swaps is too expensive and not a viable way to reduce slippage costs. A core feature of streaming-swaps is that they completely sidestep this technicality make virtual off-chain DCA operations on their internal ledger to reduce those 100 on-chain swaps down to 1 or 2 (depending on if the input token is also on ETH or not). The utility of being able to avoid these on-chain fees is huge, and as long as there is sufficient trust that Thorchain isn't going to rugpull or get hacked within the relatively short time-limit it's all good.

Example Two

You want to buy 0.1 BTC and your slippage is going to be near 0%. However, you'd like to get the average price over the next 24 hours or longer. A streaming swap allows the user the DCA automatically over a pre-determined time even if they aren't saving on fees/slip. Pretty good.

Using streaming swaps to swap more than total volume

Streaming swaps are so good they can be used to trade more volume than the total amount of the entire LP. For example imagine an LP has $2M in it which would be two tokens paired against each other for $1M each in total value. If someone tried to dump even $1M into either side of the pool it would pump the other side x4 and the user would incur 50% slip and lose half of their stack immediately just from slippage.

When employed correctly a user can streaming swap this same trade as long as there is good liquidity on other exchanges the market will automatically arb this LP over and over again every time it's profitable to do so.

Buying/Arbitrage by proxy

It is in this way that we can think of streaming swaps as a way to project the burden of on-chain fees and arbitrage onto the market makers. The market makers are happy because they are making money on razor-thin profit margins, and the user is happy because their slip is very low.

We can see from this logic that streaming swaps do not really reduce the number of on-chain transactions at all, but rather outsource them to the market makers for a cheap price. Rather than the user having to juggle dozens or even hundreds of on-chain fees (which we've already shown is extremely counterproductive) all of that slip is captured by the market makers. It's a pretty ingenious solution for creating a previously unknown supply and demand market with users and arbitragers.

Lightning Network Channel?

Streaming swaps are also similar to how the Lightning Network on Bitcoin works except the money only travels in one direction. Opening a channel is like starting a streaming swap with all the money under the DEXes control. The DEX then DCAs that token on their off-chain internal market. When everything is converted the channel is closed and the DEX delivers the other token to the correct address.

Conclusion

Streaming swaps may not lower on-chain fees on aggregate, but they almost certainly lower on-chain fees for the user making the swap while also lowering slippage caused by low-liquidity. The the balancing is paid for by the market makers. It's a pretty great system that has worked wonders for Thorchain and will soon be employed on Maya as well.

Streaming swaps can be used to sidestep the burden of illiquid markets and essentially create a virtual market in which every liquidity pool in the world is connected via arbitrage. Pretty amazing solution if I do say so myself. At the very least it can be used to DCA buy or sell into an LP over a period of time even if the slippage is nil. This feature has multiple use-cases and has proven itself in the field quite nicely. Bullish on streaming swaps.

Sort:  

Oh wow, that's a pretty interesting concept. Price impact has been a big issue we have seen in the past six or seven years with some of these tokens. Being able to spread it out and reduce that impact is definitely interesting. Thanks for sharing this and explaining it a bit more.

This is good idea.
Thorchain continues to impress me with their fixes for DeFi problems.
This is just one in a short line of fixes to recuce losses for retail investors.
I remember when they developed a fund to reimburse investors for impermanent loss, and now for slippage. Nice focus on customers. I am glad to be a part of this ecosystem.

It sounds good but do I understand it in totality? May be I need to go over it again.