Mean-reversion on the price of OldSchool Runescape Lobsters.
Drawing price from OSRS Wikipedia page using a REST API. Posting the result to Netlify blobs, and then using another REST API to display it on page
Mean-reversion refers to a financial market assumption that an asset's price will converge to its
average value given enough time. This assumption is best applied to stable data, for example body temperature;
even though there may be spikes in temperature it will always eventually return to its true average. Or, more topically,
stable asset prices.
The algorithm is implemented (see Maths section below) so that when the price drops far enough
below the moving average, we buy. And when it climbs
far enough above, we go short. Finally, when the price returns
to the middle, it closes and waits.
It may be worth noting that this
is impossible to replicate in game because there is no broker in game from
whom you can borrow the lobster asset thus making shorts impossible.\n Prices come from the OSRS Wikipedia real-time API.
Graph depicting the price of lobsters. The dashed line is the 2-hourly average; the blue band is the entry threshold (corresponding to a Z-score of 1.5) and the green band is the exit threshold (corresponding to a Z-score of 0.3). The centre dashed line depicts the monthly average.
Waiting for the first price tick…