19 ms·
FTX "insurance fund" calculated by multiplying trading volume by random number
- skilled 3y agohttps://nitter.net/molly0xFFF/status/1710718416724595187 https://nitter.net/molly0xFFF/status/1710718416724595187
- goosedragons 3y agoCan't that go negative occasionally too? Was that intentional?
- gruez 3y agoThe function doesn't calculate the insurance fund amount directly, it only applies a change to the insurance fund (line 28), based on last day's trading volume. Presumably this function gets run every day, so the size of the insurance fund would be the sum of this process repeated multiple times. The chances of that going to negative would be astronomically low.
- mxmlnkn 3y agonp.random itself with that configuration can go negative with a probability of 0.62% as can be derived with scipy.stats.norm(loc = 7500, scale = 3000).cdf(0) or by looping a million times and counting the negative numbers. Maybe the f2d function filters negative values but it sounds like a simple float-to-double conversion. I'm not sure whether it was intentional, but, contrary to the headline, this random value was used to update the fund size daily as shown in the rest of the code. So, a single day for which the fund actually decreases wouldn't matter much. It might even be beneficial to make it look more real.
- BXlnt2EachOther 3y agof2d does seem like float-to-decimal (edit, typo). My brain is off for the evening but might that part have a misplaced parenthesis? They f2d() the random number but then multiply it by the higher-precision expression (previous day's volume / 1 billion), which will give 8 numbers after the decimal in USD as in the tweet they posted. Still, it's fewer digits than without the call I suppose.
- whbrown 3y agoSince it's a normal distribution with a mean of 7500, and a standard deviation of 3000 multiplied by daily volume—it would only cause a negative change less than 1% of the time. This "PublicInsuranceFund" truly embodies their culture of "number go up".
- timmytokyo 3y agoThis is obviously just speculation, but there probably wasn't a whole lot of thought put into it by the coder. The goal was "produce a fluctuating number based on daily trading volume so that it looks like we have a real insurance fund". The randomness is simply there to help make the fraudulent representation less obvious. The fact that the number can (very rarely) go negative is just another example of the fly-by-the-seat-of-your-pants thinking pervasive at FTX.
- chatmasta 3y agoKnowing FTX, they might have even convinced themselves that this was a legitimate hedging strategy.
- ilyt 3y agoI'd imagine that the person writing it thought the function generates numbers 7500 +/- 3000 and not anything outside this range.
- gamache 3y agoMastodon link: https://hachyderm.io/@molly0xfff/111195068493652179 https://hachyderm.io/@molly0xfff/111195068493652179
- 90-00-09 3y agoI always imagine large scale financial fraud as something requiring a great amount of financial expertise. Seeing this code snippet is surreal.
- neurostimulant 3y agoIt's the large scale financial fraud that aren't caught which requires a great amount of financial expertise.
- nlawalker 3y agoYou should check out "Madoff: the Monster of Wall Street" on Netflix, which struggles to dramatize the actual operation of his scam because the reality of it was so incredibly simplistic.
- sgjohnson 3y ago> reality of it was so incredibly simplistic. the reality of it boiled down to “Madoff was too big and important for anyone to dare question”. Yes, the fraud itself was extremely simple, but I also highly doubt that a random noname like SBF could have pulled that off at the time. You really had to be someone. Someone the SEC didn’t want to touch.
- a1o 3y agoHey, they used numpy.random.normal, it at least appears credible.
- jncfhnb 3y agoI’m really disappointed by the lack of comments explaining the logic
- rich_sasha 3y agoThere are, however, some type annotations.
- elbasti 3y agoGotta avoid bugs, imagine if they lost some customer funds due to poorly written code.
- birdyrooster 3y agoI am sorry we didn't serve your interests
- belltaco 3y agoThey mean code comments, not HN comments.
- birdyrooster 3y agooh lmao damnit, thanks for clarifying
- bigyikes 3y agoI was ready to reply with an “um actually it is an arbitrary number” but… no… it is literally a random number. How did someone commit that and sleep at night? It’s amazing that some people still defend SBF. Among his sycophants is Michael Lewis, author of Moneyball, The Big Short, and now “Going Infinite” which somehow manages to gloss over the rampant fraud happening at FTX since inception.
- monero-xmr 3y agoCan you link to anyone defending him? The Michael Lewis book was a character study. I can’t think of a single person who defends what happened.
- maxbond 3y agoHe describes it as a "letter to the jury" (which I interpret as an statement of intention to reframe the popular understanding of what happened - presumably Lewis knows that jurors aren't supposed to read editorials about the case & is speaking figuratively) and casts SBF in a sympathetic light while casting aspersions on the executives executing the bankruptcy. Like GP mentioned, it glosses over the red flags and such to present a different narrative of Lewis' choosing. I think it's fair to characterize Lewis as carrying water. It's also a character study, sure, but there's no contradiction there.
- dxf 3y agoMatt Levine's take on _Going Infinite_: "Many of the reviews that I have read of the book complain that Lewis does not sufficiently explain that Bankman-Fried is Guilty and Bad, Actually, but that is not the book that he wanted to write... If you want to read a moral condemnation of crypto theft, you can get that anywhere. You go to Michael Lewis for character and story. Also, reading those reviews you would think that the book is a defense of Bankman-Fried, but it is actually quite damning."
- benjaminwootton 3y agoI saw a few clips of an interview with Lewis here - https://youtu.be/B2z8ikGLRh8?si=pqF-jUI4SeWsI4Fg https://youtu.be/B2z8ikGLRh8?si=pqF-jUI4SeWsI4Fg The interviewer maybe edits for effect, but Lewis seems very biased towards SBF.
- Thorrez 3y agoThe line wrap on line 27 in that text editor is really confusing.
- capital_guy 3y agoI think its a screenshot from a commit in github/gitlab. I hate how gitlab makes the code viewer tiny in the review screen
- Thorrez 3y agoEven if it's tiny, it could still have the line wrap done more intelligently.
- c0balt 3y agoIt's nice to see (from a quick lock) SQLAlchemy being used in production software on such a scale. However the purpose is quite disappointing
- samtho 3y agoIsn’t the bigger issue that the fund itself was fake? If they made the decision to set aside some amount of money to be untouchable based on a random number, that is, uh, unconventional to say the least, but they very purposefully chose not to have an insurance fund despite advertising that they did which makes this all the more sinister.
- opportune 3y agoYes. This should be an instrumental price of evidence in proving that FTX leadership was not “tragically incompetent” but rather willfully and knowingly defrauded its customers.
- deleted 3y ago[deleted]
- doubloon 3y agoi think when you are trying to prove a company is lying about having a zillion dollars of insurance, it helps if you can kind of pull the curtain down and show everyone the number 'zillion' was made up by someone throwing a pair of dice, not by someone counting a pile of zillions of dollar bills.
- fnordpiglet 3y agoWell, yes, the issue is it was fake. But they compounded their fraud by publicly asserting a value of the fund, and the fact they implemented it as a random number shows malicious intent. Sometimes you can wave around incompetence etc as a mitigating factor, but this is clearly intentional deception and this proves it clearly and beyond a doubt.
- function_seven 3y agoOn the contrary, you want your fund to cover unlucky situations. By linking the size of the insurance to a random number, you cancel out unlucky external events with a lucky internal event, thereby ensuring proper coverage. So long as the random value is truly random. Were there lava lamps in the FTX server room?
- playingalong 3y agoHow is the number being random a problem?
- planetpluta 3y agoAgreed — isn’t the problem that nothing was actually being set aside for the insurance fund, not that the amount being set aside was based on a random number?
- teraflop 3y agoWhen you tell your customers that a particular number corresponds to something real (e.g. the amount of money in the insurance fund that protects their assets) but you know the number was actually chosen randomly with no connection to that allegedly real thing, that's called "lying", or in the business world "fraud", and you can go to jail for it.
- playingalong 3y agoI could imagine they could possibly choose the amount randomly and truly deposit such amount to the fund.
- JumpCrisscross 3y ago> could imagine they could possibly choose the amount randomly and truly deposit such amount to the fund This would be bad risk management. The random number makes it clear that not creating the fund wasn't an oversight, it was a willful deception.
- londons_explore 3y agoIt wouldn't be terrible risk management. The value chosen (after many days) is going to converge to being awfully close to the trading volume × 0.0075
- maxbond 3y ago
- ngoldbaum 3y agoFun to see an open source project I contribute to (numpy) used to commit some light fraud.
- sanderjd 3y agoI'd guess numpy has been used for lots of fraudulent accounting! Congratulations, I guess?
- deleted 3y ago[deleted]
- eclipticplane 3y agoAt least it's _efficient_ fraud!
- Kwpolska 3y agoIt’s getting a single random number. It would be easier, and probably similarly efficient, to use the `random` module instead.
- eastbound 3y agoForgot to put the “Use for good, not evil” clause, ey? https://web.archive.org/web/20130203112329/http://dev.hasenj.org/post/3272592502 https://web.archive.org/web/20130203112329/http://dev.hasenj...
- paulmd 3y agoBut that’s not GPL compliant, what about respecting user freedoms?
- eastbound 3y agoI thought it was obvious. But it poses a larger question: OSS can be used for war and pedophilia. It is very refreshing and surprising compared to cloud platforms being adamant that they ought to deplatform people who hold even slightly wrong views. Is it the same programmers holding very different philosophical views?
- dabeeeenster 3y agoThis is a proper disgrace to software as a discipline. Who writes this?
- pfdietz 3y agoOne advantage of source code control systems is you know who to send to prison.
- meindnoch 3y agoadmin@MacBook-Pro.local is going behind bars for a loooong time!
- pfdietz 3y agoHe's just the worst.
- ilyt 3y agoUnless you make sure to only have signed commits it's pretty easy to impersonate someone in Git repo.
- eastbound 3y agoSo the main architect goes to prison. At one point, he put the system on production, so it doesn’t matter who was the original programmer, he had to check.
- richbell 3y agoTrue, though GitHub at least tracks the authenticated user that pushed the commit.
- sneak 3y agoMost people are convinced to take plea bargains based on primarily circumstantial evidence. The idea that unsigned commits are questionable is really only a cypherpunk fantasy. If you get as far as a federal criminal trial, you're almost certainly getting convicted regardless of what cryptographic signatures do or do not exist.
- wqtz 3y agoI guess the dude who wrote that function thought, maybe I shouldn't add a docstring or any comments to that function. What is he/she even supposed to write "function to commit corporate insurance fraud."? Protip. If you are committing fraud in the future - use a compiled language, do not use offsite version control and UPLOAD ONLY THE BINARY.
- ksd482 3y agoThe bytecode of the binary could also be used to prove it was a random number generator, right?
- EMIRELADERO 3y ago> Protip. If you are committing fraud in the future. Use a compiled language, do not use offsite version control and UPLOAD ONLY THE BINARY. Until you get prosecuted and legally required to turn over the source code, as it happened here.
- tester756 3y agoI don't know python, but what is the "or" here? For me it looks like this value is used only when there was no data? Basically else part of monad
- maxbond 3y agoYeah you're barking up the right tree. >>> None or Decimal() Decimal('0') So if their aggregation returned no results they'd substitute a 0. It's a client-side `coalesce()`
- sangreal 3y agoThat’s on reading the daily volume. Basically daily_volume = daily volume or 0. It is multiplied by the random number either way
- deleted 3y ago[deleted]
- deleted 3y ago[deleted]
- tqi 3y agoIs python typically used in production trading systems?
- jiggawatts 3y agoIt is at FTX.
- deleted 3y ago[deleted]
- twic 3y agoYes, but less commonly than Excel.
- mstudio 3y agoSomeone needs to run a `git blame` on that line of code!
- fishywang 3y agoThat screenshot is already a diff view, which means this is already from either a commit or a PR.
- wmf 3y agoThey've been discussing who wrote which git commits in the trial.
- philipwhiuk 3y agoThank god for https://github.com/jayphelps/git-blame-someone-else https://github.com/jayphelps/git-blame-someone-else
- water-data-dude 3y agoOK, that got a chuckle out of me. Plus it makes me feel good about signing my commits!
- wolverine876 3y agoNotice that now prosecutors not only understand code, but feel comfortable showing to judges and juries. Not that long ago, everyone's eyes glazed over at the mention of it.
- CraigRo 3y agoNo they don't. The defense attorneys likely know it better actually (I know one). But if the guy who wrote it actually walks a prosecutor through it, it isn't that complicated
- who-shot-jr 3y agoimport fraud
- fhk 3y agoMaybe abit weird … No “import numpy as np” !?
- water-data-dude 3y agoA life of crime warps your world view a little bit at a time, until you find yourself doing things you never would have thought yourself capable of.
- joeman1000 3y ago‘_get_change’ is written so poorly
- joneholland 3y agoNot defending FTX here, but I think everyone is jumping to a conclusion that this function is used for display purposes only and not to persist the amount that another process then uses to to transfer the insurance amount. Using some randomization on the daily trading volume makes some sense for what to actually move each day during an end of day process.
- xwolfi 3y agoLook, the issue is that there is no insurance amount. When asked to show it publicly, they used a random function. Ofc many websites do that. I did one in my previous company, it's a common social gimmick. But, once a journalist asked us how it was calculated, we removed it... we knew it was wrong from the CEO to the code monkey. The rule I believe is: don't lie to your customers, yes even if that can extract more money from them.