Saturday, April 29, 2023

Fifth Element: Ghost stable arb with hedge

Okay, what's The Problem™️ with my @TeamKujira Ghost-borrow-arbs up to this point?

They're basically shorts, right? You borrow, then straightaway, sell them to arb.

What happens if the markets sky during your arb?

You're eff'd.

I don't like being eff'd, personally. πŸ₯ΊπŸ™„

... "They're basically shorts."

Hold that thought.

Pigeonhole it, but hold that thought for now.

(Yes, another ANOTHER HOWTO is forthcoming)
(Yes, my mind never stops. Yours?)

Hedging the borrow with a long


So: short. That's one theme to explore.

If the borrow-then-sell an asset is equivalent to a short, then the way to hedge against a sudden market surge (that happens to me on too many arbs, I'm piqued to say), is to open a corresponding long at the same time as the borrow. VOILΓ€!

Let's start a working example to illustrate, and make money, because: no dur.

I consult ./vern (my main man: ./vern) who says there's a nice arb on $LUNA.


  • LUNA,axlUSDC,OSMO,ATOM,KUJI,LUNA

So, before I borrow $LUNA, I place a 2.2xLONG on 50 $LUNA on the FIN LUNA/USK board.


THEN I borrow 50 $LUNA from Ghost.


With the 2.2xLONG in place, if $LUNA skies, I make out like bandits by closing the long, and paying back the borrow with the profits.

If $LUNA DOESN't sky, then my arb goes through, and I pay off the borrow from the arb.

I'm covered, then, either way.

The point of all the above is to protect yourself from (sudden) market movements.

How do we do this?

A borrow (from Ghost)-then-sell is equivalent to a short; you hedge a short with a long.

That's one approach (hedge short with a long).

There's an entirely different approach.

I eventually do close this arb from a big spike on the KUJI/LUNA board.

Playing both sides

Here's the entirely different approach.

Play both sides of an order book. That way, if the markets go up, or if the markets go down, your arb works, either way.

"Which order book? and how?" you ask.

Fair questions.

The answer is "which asset can you both sell and buy on FIN that you can borrow from Ghost?"

It's a bit 'magical,' but if you consider $axlUSDC and $USK to represent the same thing: a stable coin, you can borrow both from Ghost, and they conveniently marry up on FIN axlUSDC/USK.




The 'magic' of this approach is this: whichever way the markets go, you win.

  • If the markets go up, your sell-order hits, creating $USK
  • If the markets go down, your buy-order hits, creating $axlUSDC

Okay, so, whichever way the markets go, an order hits.

So what?

That's half the story. So, say, the ratio goes up, and you get $USK from your sell order.

You place that $USK in the buy-range, wait for a ratio-fall, then, ch-CHING! you now have more $USK than you borrowed! YAY!

Those of you with experience doing the axlUSDC/USK-arb will immediately see a problem

  1. you have a buy- and sell-order
  2. the sell-order hits, you claim that, and place a buy-order

You now how 2 buy orders: you're dependent on the markets again.

Problem: not solved. 😒

In practice this problem is easy to (re)solve.

In the above scenario, you have 2 buy orders, so, place another sell-order.

Market balanced: restored.

"But what if the markets keep going up ... forever?"

This is a problem? Really? Say that out loud like it's a problem.

I'll wait.

Again: in practice, this doesn't happen. Yes, it's a risk, and you're left holding the bag, right?

Nope.

Why?

The neat thing about unfilled orders?

You can always cancel them, and get your money back.

You don't have to have 35,962 orders placed on the axlUSDC/USK book. You can cancel the WAY out of range orders and repay your borrows.

With this out in your back pocket, ... wow.

Just wow, folks.

This means:

  1. you get to borrow money at a really low rate (1%-6% rn)
  2. you get to make money with borrowed money, that is: OTHER PEOPLE's MONEY! 😱
  3. you get to back out any time you feel the heat's too hot.

Risks

So, but with the axlUSDC/USK-arb, borrowing from Ghost, you're not going to get rich quick(ly).

I can borrow 50 $LUNA and make 5 $LUNA in one arb. I did that today.

axlUSDC/USK happens at the rate of, say, $1 gained from two trades of $100.

It's slower, but less risky.

Also, borrowing stables can be expensive, up to 6% borrow rate (annualized), whereas borrowing a volatile coin, such as $LUNA, the borrow rate is usually only 1%.

So you have to watch your borrow rates when borrowing stables.

Just do it!


"So, geophf, given these risks, are you going for the Ghost-borrow stable-arb?"

You betcha. Not only: 'you betcha,' but: you betcha in a big way.

I've set this arb in motion tonight, and, given I prove this out, this is going to be a standard investment tool I go to.

The. End.

Postlude


The markets DID go in a direction (huh! amazing! the markets move. FANCY THAT, HEDDA!), the ratio going up, so I claimed the sell-order and now have 2 buy-orders.

So, I borrowed more $axlUSDC against $KUJI (that I bought with $axlUSDC, hehehe) 


and placed a sell-order.


The balanced-approach is restored. Once again I'm market-neutral: if the ratio goes up, I make money on the sell-order, if the ratio goes down, I make money on the buy-orders.

Either way, I win.

If the markets stay in one direction, I can alway cancel orders and repay borrow.

Case in point


Markets go up; markets go down.

This time, the ratio dipped, filling a buy-order, 


...so my buy-sell orders just magically rebalance when I take this buy order and immediately place it back on the axlUSDC/USK board as a sell-order.

When the sell-order I just placed (PT) fills, I'll take that $USK and close the borrow, AND have some left over: that's the arb, that's the gain, and it's all from OTHER PEOPLE's MONEY!

Suh-WEET! πŸŽ‰

I'll report that out when that occurs.

... some time later

HA! The opposite happened: the BUY order filled, completing an $axlUSDC borrow against $KUJI (one of them)!


SO!

  • I collect the order
  • I repay the borrow


  • I lend the remainder (smol tho' it be) to Ghost


  • I ...

... well, I get on with my life. 😊


ROI: 1%, annualized to 847% APY

Raison d'Γͺtre


Two things to the 'why' I do the above.

  1. Why do I repay the borrow, if I'm just going to borrow the same amount and do the same thing, all over again?

Two reasons:

  1. It brings that borrow to closure
  2. It resets any borrowed interest

  1. Why do I lend that minuscule amount of $axlUSDC to Ghost?

I'm treating Ghost as my bag-repository, so the bags I accumulate go to Ghost lend, growing over time as x-tokens (when all the markets open). 


I deposit that smol amount of $axlUSDC to show my bag growing over time.

Fourth Quartet: arbing borrowed KUJI with Kujira Ghost

Let's arb borrowed $KUJI with Ghost.

  1. I borrow 100 $KUJI against $axlUSDC supply


  1. I swap 100 $KUJI -> $axlUSDC on FIN


  1. I swap $axlUSDC -> $USK


  1. I swap $USK -> 101 $KUJI


It's a meh-arb, but it was also a quick one.

The next day ...

... hey, this is a perfect example, because it shows that arbs never hit right away, nor when you want them to. To be an arbiteur is to be smarter than the markets, and even more patient.

/descends from soapbox.

SO!

The KUJI/USK limit order hit! BAM!

(ouch)

yielding me 101.476 $KUJI on the borrowed 100 $KUJI.

SO!

  1. 1. I claim the $KUJI from FIN


  1. I close the borrow on Ghost



  1. I lend the arb'd $KUJI to Ghost, generating $xKUJI for me, and allowing others to borrow $KUJI.

Analysis


I'm sure some of you are thinking: "1.476 $KUJI? So what!"

But I made, no, I KEPT FOR MYSELF!: 1.476 $KUJI in one day, with BORROWED money.


ROI: 1.476%, annualized to 1062.72% APR

Tell me where else you're getting those APRs

...WITH OTHER PEOPLE'S MONEY!

I'll wait.

Friday, April 28, 2023

Kujira Ghost arbitration: borrowing, lending, bidding with x-tokens

Let's look at a 3rd way to arb with Ghost on @TeamKujira.

First, we borrow an asset (which asset?)
Then, we lend that borrowed asset to get x-asset.
Finally, we bid on a liquidation with that x-asset.

That's the plan.

How do we do this?

First, let's examine the marketplace.


You see from the ORCA marketplace (OT) that there are 4 markets with volume, but three of them are overbid, particularly $xKUJI, so, let's stay away from that one. One market, $stATOM, has a lot of liquidity but hardly any bids, so: I loan myself $stATOM, lend that to get $xStATOM, and then bid on ORCA with those x-tokens.

When that liquidation is fulfilled, I'll buy-back $stATOM at market price with the discounted $USK, pay back the $stATOM to close the borrow, and keep the overage.

YAY!

This approach was inspired by a tweet from @DeFi_N00b who ran this arb quite successfully.

Arbing borrowed OSMO from Kujira Ghost

Let's arb $OSMO with @TeamKujira Ghost.

First problem: Ghost doesn't have any $OSMO to lend.

No problem: I lend the $OSMO, then I borrow that.





See?

./vern, my main man, ./vern recommends the following arb-path:

  • OSMO,axlUSDC,LUNA,USK,KUJI,ATOM,axlUSDC,OSMO
So I place the first order

  • 2023-04-28 placed: 30 OSMO -> _ axlUSDC, SELL at 0.799 filled
$LUNA just shot up 20¢, changing the arb significantly (and invalidating the LUNA-arb. Yay.), so ./vern, my main man, ./vern, reroutes via KUJI/ATOM, and, as soon as I submit that order, it fills (faster, even, than the $OSMO sell order, smh).

  • 2023-04-28 placed: 24.6435 axlUSDC -> 32.8142 KUJI, BUY at 0.751 filled
And a change again, simplifying the path back to $axlUSDC then out to $OSMO.

This simplification is fine by me.


  • 2023-04-28 placed: 32.8142 KUJI -> _ axlUSDC, SELL at 0.763 filled
And we head out with a buy order on $OSMO



But now it's better to swap to $USK and buy $OSMO that way.

  • 2023-04-28 placed: 25.0185 axlUSDC -> 23.843 USK, SELL at 0.953 filled
  • 2024-04-28 placed: 23.843 USK -> _ OSMO, BUY at 0.748 filled
We started with 30 $OSMO, and we arbed to 31.645 $OSMO, in a twisty-turny fashion.

While I was pursuing a Ghost-arb with ORCA, my $OSMO buy-order popped on FIN, so now I close my $OSMO borrow. I lend the $OSMO I earned from the arb to Ghost, so somebody else can do this now, and earn me extra 'x' on my 'x'-tokens. See? 






Using Ghost on Kujira: a case-study, LUNA

Using Ghost on @TeamKujira: a case-study.

Okay, I supply 100 $USK, and borrow 24 $LUNA against that.


It's weird that I've lent 500 $USK already, but none of that is available for borrowing against.

I have a lot to learn here. 

./vern, my main man, ./vern tells me there's a $LUNA-arb:



  • LUNA,USK,KUJI,ATOM,axlUSDC,LUNA

So I kick off that arb by selling my borrowed $LUNA on the LUNA/USK FIN order book. 

  • 2023-04-28 placed: 24 LUNA -> 29.472 USK, SELL at 1.228 filled
I have the wherewithal to run these trades in parallel inside the transaction.

So, I place the following additional limit orders:

  • 2023-04-28 placed: 29.449896 USK -> 30.6068 axlUSDC, BUY at 0.9622 filled


  • 2023-04-28 placed: 30.583879 axlUSDC -> _ LUNA, BUY at 1.171 [deferred]

You see that the trade-path is much simpler than what ./vern, my main man, ./vern recommended, but still I make out on the arb, starting with 24 $LUNA, and, when the last limit order fills, ending up with 26.1 $LUNA.

When that occurs, I'll pay off the $LUNA-loan and keep the arb

And, as I wrote writing PT, the middle order filled (USK->axlUSDC), which is cool, ...


... then, right after that, the first order filled (LUNA -> USK), which is SUPER cool!


THIS ARB-STUFF IS HELLA K-KOOL, FRENZ! 😎

Postlude


So, $LUNA shot up 17¢ while I was writing this, so the final bid is '[deferred]'.

In the interim, the axlUSDC/USK bid hit, so let's arb around to regain our 24 $LUNA somehow.

  • 2023-04-29 placed: 30.584 axlUSDC -> 29.183 USK, SELL at 0.9542 filled
... and it looks like ./vern, my main man, ./vern found an arb to dig me out of this predicament.


  • USK,ATOM,axlUSDC,USK,LUNA

I love ./vern, I do. ./vern, ./vern is my main man, ICYMI.

So, I put in all trades as limit orders, tout Γ  coup!





When the buy $LUNA limit order hits, I'll close the borrowed position and lend the arb'd $LUNA, growing my $LUNA bag on Ghost, ... with BORROWED MONEY!

How cool is THAT? 😎

The orders, for completeness sake:

  • 2023-04-29 placed: 29.183 USK -> 2.6408 ATOM, BUY at 11.051 filled
  • 2023-04-29 placed: 2.623 ATOM -> 30.4247 axlUSDC, SELL at 11.599 filled
  • 2023-04-29 placed: 30.7451 axlUSDC -> 29.4999 USK, SELL at 0.9595 filled
  • 2023-04-29 placed: 29.4778 USK -> 24.1819 LUNA, BUY at 1.219 filled
Okay, the $LUNA arb cleared, finally, with 24.164.

It yain't much, but it's honest work.

  • I claim the order on FIN


  • I close the borrow on Ghost (paying 0.002 $LUNA fee)


  • I lend the arb (0.162 $LUNA) on Ghost.


ROI: 0.67% (meh! 😀) annualized to 268.58% APR (better πŸ˜…)

A reminder of what some of you are probably laughing at my minuscule lend of 0.162 $LUNA:

  1. This illustrates my principal of 'Start verra smol.' Yes: I follow my own rules, too.
  2. This 0.162 $LUNA is now MINE from BORROWED money. I can build a bag from this start.

Thx, fam 😘