SBF Profile picture
Oct 12 23 tweets 5 min read
1) When it comes to oracles,

you just have to make up your own damn mind
2) NOT FINANCIAL ADVICE, NOT LEGAL ADVICE
3) Let's say that you have a margin trading protocol which allows cross-margin between a bunch of different assets.

Your algorithm is "require 30% initial margin and 20% maintenance margin"--i.e. allow ~3x leverage, and margin call accounts if they get up to 5x leverage.
4) You have an 'oracle' which reports the price of the assets, and your risk engine--the thing that calculates users' margin--uses prices from that oracle.

One asset--say XYZ--has a price of roughly $0.40 according to the oracle.

A user--Alice--has $200m XYZ and -$25m USD.
5) Alice:

500m XYZ ~ $200m
-25m USD = -$25m
net value ~ $175m
margin ~ 87.5%

how much should the risk engine allow Alice to withdraw?
6) A naïve answer would be "well if you require 30% margin then Alice can withdraw up to $115m; at that point her account would be:

500m XYZ ~ $200m
-140m USD = -$140m
net value ~ $60m
margin ~ 30%"
7) But there's a picture of a mango over The Oracle's face.

So, obviously, XYZ is actually MNGO, and MNGO isn't really worth $0.40; it's worth around $0.04.

Alice's real account value is, roughly:

500m XYZ ~ $20m
-25m USD = -$25m
net value ~ -$5m
margin < 0

It's already gone.
8) But for a brief period, someone (almost certainly Alice) bought enough MNGO that it did trade for $0.40, and before people could get in to sell and return it to a more reasonable price, the risk engine had already allowed Alice to withdraw $100m from Mango Markets.
9) So, what went wrong? Did the oracle fuck up?

I mean, not really. Or, rather, it depends on what the specs of the oracle were.

The oracle accurate reported the current price of MNGO. It's just that the 'current price' wasn't really anything close to the 'fair price'.
10) What should you really do?

Well, let's look at what FTX does, and why *it* didn't have any risk engine issues.
11) First, FTX has EWMA price bands.

What this means is, roughly, that FTX consumes raw price feeds.

But, before feeding that into its risk engine, it bounds those price feeds so that they can't move more than ~20% over a 5 minute period.

help.ftx.com/hc/en-us/artic…
12) The reason, basically, is:

b) If an asset's price moves 3x in 1 minute, it's decently likely to be bad data, or a temporary wick, or something like that

b) If the asset's price stays there for 5 hours, that new price is likely the true economic price
13) FTX's MNGO index price moved--there should be *some* update--but much less than others because of those EWMA price bands.

In particular, while FTX's index topped out at a ~100% increase, on some exchanges the move (temporarily!) hit a +900% increase (!!!).
14) Second, FTX uses 'IMF Factors'.

The larger your position, the greater % margin we charge.

For MNGO, the margin we charge is 0.00025 * sqrt(MNGO tokens).

If you wanted to have a 500m MNGO position, FTX would have required, uh, 500%. (Bounded at 'fully funded'.)
15) The reason, basically, is that large positions--especially in illiquid tokens--can have a lot of impact.

So we charge more % margin the greater your position is.

help.ftx.com/hc/en-us/artic…
16) And some positions -- like the one in question -- are large and illiquid enough that the risk engine forces you to fully collateralize a position.
17) So even before hitting position limits, the risk engine ensures that the collateral backing a position is sufficient.

And what if you try to use something other than dollars as collateral?

Well, we haircut it. In some cases, a lot.

help.ftx.com/hc/en-us/artic…
18) (It's worth noting that this is all referring to FTX International.

In addition to all of the above protections, our amendment for FTX US Derivative's margin order would only be for BTC and ETH futures using USD margin. No MNGO, and certainly no MNGO collateral.)
19) There are a bunch of other risk engine protections and sanity checks, too, which would have caught something like this.

So -- back to the oracle.

It reports:

"MNGO: $0.40"

Is it wrong?
20) Well, it depends on what it's promising.

But probably it's just promising to tell you, literally, what MNGO is currently trading at. And, for a brief period, on some exchanges, MNGO was in fact trading at $0.40.

The real problem here was using the raw oracle price.
21) The Oracle tells you everything and nothing--the history and current state of markets.

It's the risk engine's job to consume that information, and decide what positions are safe.

Sometimes it can't just regurgitate The Oracle. Sometimes it has to make up its own damn mind.
22) Which doesn't mean that the risk engine needs to be manual.

You can create a set of rules for it so that it's conservative, and handles apparent large moves gracefully.

That, in the end, is probably the most important thing we do at FTX.
23) And, really, it's why we started FTX in the first place.

Tradfi had sophisticated (sometimes!), slow, manual risk models, and--in some FCMs--fast, egregious ones.

Crypto had fast, automated, broken risk models.

There was an opening for a thoughtfully automated risk engine.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with SBF

SBF Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @SBF_FTX

Oct 10
1) Equitable direct access:

the way market access should work

ftx.com/settings/api
2) On your API page, you can now whitelist an IP address to get direct, fast access to FTX's servers, bypassing Cloudflare.

This should take API order latency down significantly.

ftx.com/settings/api
3) Traditional examples of this cost millions of dollars and are reserved for privileged firms.

Even on crypto exchanges, it's usually reserved just for VIPs.

But that's dumb: there's no reason to just make the fastest firms faster.

Everyone should have equitable access.
Read 5 tweets
Oct 10
1) This Thanksgiving:

FTX, Evolved.
2) Over the next month, we'll be rolling out a bunch of improvements to FTX's matching engine.

In fact we've already started.
3) We'll be rolling out a whole new order matcher, lower latency API pathways, and a whole slew of other features.

These have been in the works for most of the year.

They're almost ready to release.
Read 7 tweets
Sep 27
1) Blacklists and whitelists
2) I don't know what the perfect answer is for crypto regulation.

But the core thesis that I believe is that blacklists are better than whitelists.

What does that mean?
3) Well, basically:

Alice wants to send $100 to Bob. Should she be allowed to? After it's sent, if she requests a refund, should it be sent back?
Read 14 tweets
Sep 12
1) The freedom of the goat
2) I'm watching the Bucs vs Cowboys game today.

The announcers just talked about how @TomBrady used the run to set up the pass:

a) defense plays against pass b/c of Brady/Jones/Evans/Godwin
b) Bucs run
c) defense adjusts to run
d) Bucs pass
3) This is a classic strategy; generally it's framed as "you have to run a lot so that they respect the run, in order to set up the pass".

But I think that framing of it lacks nuance
Read 14 tweets
Sep 8
1) I'M NOT A REGULATOR, THIS IS NOT LEGAL ADVICE

but:

my current best guess is consistent what @GaryGensler says: that the CFTC will regulate spot + futures for non-security tokens, and the SEC will regulate spot + issuance of tokens that are securities

wsj.com/articles/secs-…
2) This is also consistent with the @SenStabenow / @JohnBoozman / @CoryBooker / @SenJohnThune bill, and with @RoKhanna / @CongressmanGT.

And it's consistent with what @CFTCbehnam and others have said publicly.
3) It seems pretty likely that BTC, ETH, and many forks/variants will not be securities; and that many other tokens will be securities.

(How about other large tokens? Or futures or swaps on security tokens? Or tokenized stocks? And what exactly is a stablecoin? We'll see!)
Read 4 tweets
Sep 5
1) One cool application of on-chain social media:

In-message verification.

2) In theory, if social media messages were on-chain, then in addition to composability between different platforms, you could have the blockchain operate within a tweet.

What does that mean?
3) Well, first, there would be ways to send messages like:

"The winner of the protocol governance vote is {xyz}", where {xyz} was a reference to an actual on-chain smart contract, _combined with its value_.

And so the tweet would be verifiably correct.
Read 6 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(