Hacker News new | ask | show | jobs
by friend_and_foe 977 days ago
Wait... I'm very much academically interested in the math you did. Particularly, how a standard deviation calculation being wrong can give you an edge. Do you understand the bug enough to know how it changed things and why it worked? I'm not asking you what the edge is, it's just that from my understanding of how these things work something like that shouldn't be possible.
2 comments

Take what he's saying with a grain of salt. This post activated my spidey sense from another thread a year back, about SHA hashes being poorly distributed compared to MD5, and sure enough, it's the same dude.

https://news.ycombinator.com/item?id=32409168

Yes, and at the risk of this sounding like a personal attack, why even bring this up? Did you read the thread you linked to?

> soooo basically there is no bias

> Looks like it. Though I think md5 is faster, which is maybe what I’m remembering, now that I think about it. This was years ago, funny how memory gets tainted.

I brought it up because without remembering the name from that exchange a year ago, the similarly casual misunderstanding-proffered-as-fact in the post here led me to guess it would be the same person, and it was. Which is just to say that I suspect you have the details wrong in this case, too. That's all.
Fair enough, I guess. People got hung up on the details of the bot and big numbers, which in retrospect, is to be expected here. I was just trying to point out that you stand to lose a shit ton of money when doing a side-project that touches money. Bugs can really bite you in the ass in a very tangible way. The bot details are interesting, I'm not hiding anything there -- at first I was a bit cagey with the algorithm, but that was mostly because I couldn't even remember what branch in what repo it was hiding in. Then I found it, and was able to read the code.
Looking at the code, the purpose was to locate the nearest resistance by analyzing current orders in the market, and the slope of the orders around each resistance point, over time. This was used as one signal on whether or buy/sell. Std Deviation was calculated with this code:

    public static decimal StdDeviation(IEnumerable<decimal> data, decimal mean)
    {
         var sumOfSquares = data.Select(x => (x - mean) * (x - mean)).Sum();
         return (decimal) Math.Sqrt((double) sumOfSquares / (data.Count() - 1));
    }
It was written at 1:30am, according to git blame ... there's even a potential division by 0 hiding in there, so this is some shit code 'just to see what happens'. Anyway, that `data.Count() - 1` is the part that is "wrong" and tbh, I have no idea how it changes things.

The mean passed to it wasn't even a true mean either, it was a sliding window mean, of a specific area of resistance multiplied by reciprocal of an "influence" coefficient. Yeah... I have no idea how this shit worked. This is nearly 5 years old at this point and hasn't run in 3+ years.

It used to output a realtime graph that was visible from the web, it would show the output of all this math. From what I remember, this signal shows as a line on the buy side, sloping up/down. That slope indicated whether a specific resistance line was at risk of dissolving or a new one being created with the idea being to buy as much as possible before the resistance line actually dissolved.