Forum Posts

Giovanni Santostasi
May 23, 2021
In Market (Mis)Behavior
On May 22 2010 Laszlo Hanyecz, from Jacksonville, FL, agreed to pay 10,000 Bitcoins for two delivered Papa John's pizzas. He sent the BTC to another online BTC early adopter and this person used USD to buy the pizzas and asked the pizza parlor to deliver them to Laszlo. History was made. It was one of the earliest recorded transactions in BTC and maybe the first physical object bought using cryptocurrency (even if in an indirect manner). It is often used as a way to show how much value BTC gained over the years. At a point this year BTC reached a high of $63,000 so, the two pizzas were worth $630 million when BTC reached its all-time high. While this way of converting the value of BTC in dollars has some usefulness, showing that BTC is a strongly anti-inflationary asset (most goods need more dollars to be bought as time pass by) it is also a not perfectly fair way to estimate how good of a deal the Pizza Acquisition was. We need to find a way to estimate the value of BTC at that time to understand if the transaction was a decent deal or not, given the fair market value of BTC then and not now. The first BTC exchange created was MtGox on July 18, 2010. These transactions were recorded and relatively easy to find online. There were few registered BTC transactions earlier than this date that converted BTC into fiat currencies. It is not easy to find them but I plotted 2 of these early transactions on the graph above. The first one happened on October 12, 2009, where New Liberty Standard buys a total of 5050 BTC from an online user called Sirius for an amount of $ 5.02 through PayPal. Here is a good reference about the early history of BTC transactions: https://academy.bit2me.com/en/history-exchanges-bitcoin-trading/ The graph above is a power-law BTC price model I have worked on for quite some time now. I have been one of the first people over the years pointing out that BTC has a predictable, mathematically interesting price pattern that is not found in other assets. This was much before the Stock to Flow (S2F) price model became popular. You can find two of my early posts here (username Econophysicist1 on reddit): https://www.reddit.com/r/Bitcoin/comments/29snjh/logistic_model_of_btc_price/?utm_content=media&utm_medium=post_embed&utm_name=ff1d40802f1e468186e822eff9b4cea2&utm_source=embedly&utm_term=29snjh and also here with a better model given I had more data: https://www.reddit.com/r/Bitcoin/comments/9cqi0k/bitcoin_power_law_over_10_year_period_all_the_way/ also, you can watch this video, where I explain more about the model: I will elaborate more on BTC mathematical behavior in subsequent forum posts. But to summarize the model plots the price of BTC on a log-log plot (log on the x-axis, and log on the y-axis). This is very unusual. It is the case that assets that have grown by several orders of magnitude in a given period of time are plotted in what is called a semi-log graph, which is a log of the y axis (usually price, or market cap) only. I never saw any asset price history plotted in this way before. The reason to do this is that it can reveal if the asset has a power-law growth. Power laws are very common in nature in particular when there are multiplicative forces in action (instead of linear processes) and this is typical of systems that are the result of many agents interacting in nonlinear ways. Power law manifest often in natural and human phenomena like rivers and mountains formation, cities expansion and growth, distribution of wealth in a population, and so on. A good book on this topic is Scale by physicist J. West. The model was constructed using the earliest consistent BTC transactions available, data from the first BTC exchanges. These data points are the black line in the graph. I then fitted a straight line using a regression model through the log of the price and the log of the time, this is the red line in the graph. The idea is that if a phenomenon shows power-law properties it will look like a straight line in a log-log graph. The fit is very good and the R^2, a measure of goodness of fit, is very high, at about 0.94 (that means 94 % of the behavior of BTC can be explained by this model). We will go into the math of that in another post. I also reorganized the data point to be represented as days from the Genesis Block that is the day the first BTC was created, on January 3rd, 2009. I also added, as explained above some of the first recorded transactions that didn't happen on a real exchange with purple dots. The Pizza Deal is the third purple dot as indicated in the graph. What is interesting to notice is that the other 2 dots are quite close to the general trend line (the red curve). In other words, these transactions, even if they happened early on, were relatively fair. The 2 pizzas were bought for about $25 dollars giving a value to BTC at about $0.0025. If we use the trend line as a better reference point the value of BTC would have been $0.051 or 20 times more. Laszlo could have bought 40 pizzas instead of 2 if he asked for a more fair deal. Being Italian I approve of the choice of using pizza as the physical mean of exchange but it was still a very bad deal. Of course, the value of this transaction is more historical and a proof of concept given the two pizzas were some of the first items ever bought with BTC or any cryptocurrency at all, so for sure an event worth celebrating and memorializing forever. Happy Pizza Day to all crypto enthusiasts!
Was the BTC Pizza Deal a good deal?  content media
0
0
351
Giovanni Santostasi
May 22, 2021
In Strategy Theory Discussion
T This model of gold was created by taking the last 75 years of data for the production of gold and inflation-adjusted prices. There is a nice power-law relationship (it shows as a straight line in a log-log graph) between Stock to Flow and price. One then can fit the data with regression and extract the power of the law. The power is 2.94 close to the one observed for BTC that is 3.1. You can use then the power to construct a predictive model of gold prices with one single factor. This is amazingly remarkable and gives credibility to the S2F model of BTC. I tried this for many different commodities and it holds in a pretty universal way (tried for Silver, Platinum, Copper, Salt, Diamonds, Zinc is crazy, not sure why). From the power of that particular commodity, you can derive a lot of information. For example, stores of value commodities has positive power laws, and the higher the power more valuable the commodity is. Commodities that have industrial uses, like copper or salt, have negative power laws. All these relationships though are statistically significant (for gold R^2 is 0.75)
Commodities have Stock to Flow power laws, like BTC (Gold power law 2.95, similar to BTC 3)
 content media
0
0
23
Giovanni Santostasi
May 22, 2021
In Strategy Theory Discussion
I posted earlier on how powerful Online Portfolio Selection can be as a trading strategy when its essential elements are understood and implemented. I worked with OLPS for several years and extracted what I think is the essential idea: use a metric of performance (you can invent your own or test the ones in the literature) to rank assets in a given universe and forget about predicting individual assets behavior but focus on the group dynamics. The algo I use here is similar in nature to the one described in my earlier post. I basically look at a very short scale (few days) how stocks in NASDAQ 100 behaved and I sort them with a metric of performance that is supposed to be predictive of the following day ranking of the stocks in terms of the returns. I then switch between a mean return and a momentum strategy (basically betting on the first or last stock once they are sorted from 1 to 100). This algo has basically no parameters (in the title I mention 2 parameters to be conservative given the switching between the mean return and momentum is also done on an independent time scale from the sorting time scale) besides the time scale used for the performance evaluation. The scale is chosen among a dozen via a walk-forward optimization. I actually trade with this algo so I know it is not just some theoretical result but exactly how the real cumulative curve looks like (slippage is about 0.02 % per trade so a rounding error given the daily average gains).
A 2 parameter OLPS with almost 100x cumulative return in 3 years. content media
0
0
53
Giovanni Santostasi
May 22, 2021
In Strategy Theory Discussion
Spencer Wheatley, Didier Sornette, Tobias Huber, Max Reppen, Robert N. Gantner We develop a strong diagnostic for bubbles and crashes in bitcoin, by analyzing the coincidence (and its absence) of fundamental and technical indicators. Using a generalized Metcalfe's law based on network properties, a fundamental value is quantified and shown to be heavily exceeded, on at least four occasions, by bubbles that grow and burst. In these bubbles, we detect a universal super-exponential unsustainable growth. We model this universal pattern with the Log-Periodic Power Law Singularity (LPPLS) model, which parsimoniously captures diverse positive feedback phenomena, such as herding and imitation. The LPPLS model is shown to provide an ex-ante warning of market instabilities, quantifying a high crash hazard and probabilistic bracket of the crash time consistent with the actual corrections; although, as always, the precise time and trigger (which straw breaks the camel's back) being exogenous and unpredictable. Looking forward, our analysis identifies a substantial but not unprecedented overvaluation in the price of bitcoin, suggesting many months of volatile sideways bitcoin prices ahead (from the time of writing, March 2018). Comments: Sornette is a physicist that has worked in the field of econophysics and made important contributions in the prediction of market crashes using sophisticated nonlinear methods. Reference: Main article: https://arxiv.org/abs/1803.05663 Sornette's book: https://www.amazon.com/Why-Stock-Markets-Crash-Financial/dp/0691175950
Are Bitcoin Bubbles Predictable? Combining a Generalized Metcalfe's Law and the LPPLS Model content media
1
0
211
Giovanni Santostasi
May 19, 2021
In Strategy Theory Discussion
I have posted before on Online Portfolio Selection, which is my favorite trading family of strategies. I use, in real trading, much more sophisticated metrics (with much better results, like 2x easily per year) but with a very similar general trading philosophy as in the following interesting and pedagogical exercise. OLPS rely on a predictive measure of performance to dynamically select weights for the next trading period for each asset in the portfolio. Some OLPS use a mean return and other a trend following approach. The weights are proportional to the predictive measure and they are updated at each iteration. In this exercise, I wanted to see if the simplest possible predictive measure could work. What could be the simplest possible predictive measure? Of course, the price change today = the price change tomorrow. I took the stocks in NASDAQ 100 and then sorted the stocks in terms of their price ratio (the price of the stock today vs yesterday). Then I used both a mean return and momentum following strategy. Instead of weights, I selected the best performing and worst performing stock according to this simple-minded metric. By themselves, each of these strategies does not work very well (try it). But then you can optimize (using the walk-forward optimization) between the two strategies (mean return and momentum). Basically test continuously on short time scales which one is doing better (mean return or momentum following) in recent market conditions and select the stock from the best performing strategy in that testing interval. Such a simple and almost parameterless strategy gives surprisingly good results: a cool 5x in about 3 years, which is much better than most ETFs. Not necessarily the best algo trading in the world but a decent Sharpe and gains and an exercise to demonstrate how a simple, robust approach can give a strong performance that outperforms easily the market (the fully market efficiency theory is clearly wrong in short time scales). Try this exercise yourself and I think you will gain a lot of intuition. Let me know if you need help in setting up the algo.
Beating the market with the simplest metric content media
1
0
86
Giovanni Santostasi
May 19, 2021
In Strategy Theory Discussion
I made a post in the r/algotrading subreddit sometime ago about how one can use the simplest possible predictive metric, i. e. price change today = price change tomorrow (some people use the term alphas for what I call metrics) and showed that you can beat the market easily without too much risk of overfitting (there is only one parameter) and how this disproves strongly the Efficient Market Hypothesis (EMH). It is also interesting to have statistical ways to show that the metric is indeed predictive. I'm a visual guy so I need to see to believe. I developed many ways to show that a metric has the power to predict the market behavior. I never see this demonstrated in finance papers I have read (100s). If you are aware of any paper that shows how their approach is predictive both visually and statistically please link these papers in the comments. Anyway, here is one of these ways to visualize the predictive power of the metric and what I did. I use the metric above price change today = predictor, price change tomorrow = target. Using the "predictor" I then rank chosen 98 stocks in NASDAQ 100 from 1 to 98. The metric described, let's call it SM1 (simple metric 1), is supposed to be a "trend following metric", because we are expecting (it is just our initial hypothesis) the winners today will be the winners tomorrow (same for the losers). But let's see what really happened. The graph here shows a histogram of the distribution of the actual ranking vs the predictor ranking. The actual ranking is the actual price change for the following day. We notice that: There are clear clusterings around the corners. EMH would imply a completely flat (random) distribution. We have clear hits when predictors in positions 1 and 98 correspond to an actual ranking in positions 1 and 98 respectively. This is when the predictor correctly predicted the largest win today will be also the largest win tomorrow (and vice versa). If we went long with the predicted winner we will have had a pretty nice gain. We could also have shorted position 1 and also did well. There are clusterings around the peaks at the corners. If the predictor was 98 and the actual change in price (return) was in any position between let's say 90 to 98 it was not a perfect hit but still probably a decent gain (again same if we shorted 1 and it landed in any actual position between 1 and 10 the following day). We also notice that often positions 1 and 98 correspond to actual positions for the following day 98 (or about) and 1 (or about) respectively. What this means that our metric is actually both "trend following" and "mean reverting". Sometimes it picks the biggest winners and sometimes the biggest predicted winners are actually the biggest losers (and vice versa). This is very interesting and in the beginning, could be a problem because if we choose consistently 1 (short) and 98 (long) our gains will be decreased by the fact that sometimes 98 is actually a good short and vice-versa. But one can devise clever ways to switch between mean reversion and trend following and by doing that I can get easily 17x in 3 years. By the way, you can do statistical tests on the distribution and show that the peaks and the other points around them deviate in a statically significant way from the average count in the distribution. We need more ways to show our trading strategies are actually predictive (and not just reactive) of market behavior. This is one of the most powerful way to show we are not overfitting (or the risk of overfitting is reduced) and we indeed have alpha. In my book, alpha needs to be predictive and not reactive to the market.
A simple way to show a predictive metric is indeed predictive
 content media
1
0
44
 
Giovanni Santostasi
Admin
More actions