Modeling fear and greed based on onchain data

wip

#1

The purpose of this research is to consider the following question: How is on-chain behavior influenced by the asset price? Usually we want to go the other way, to predict prices based on on-chain behavior, but understanding the opposite direction can be useful as well.

We’ll restrict ourselves to a single asset (Bitcoin). Then we will assume the following model:

The model (Model 1)

  1. We will consider Bitcoin holders as investors who hold positions. Each investor enters a position at a given time and exits at a later time.

    So formally to each position s we associate an owner x(s), an entry point entry(s), an exit point exit(s) and an amount in BTC amount(s)

  2. We assume that investors are only interested in trading the pair BTC/USD

  3. Each investor decides whether to close a position or not based on two parameters:

    3.1. The elapsed duration since the position has been open
    3.2. The current unrealized returns of the position

    This is a generalization of the triple barrier method where each position has the following parameters: stop-loss level, take-profit level and expiration date. If an investor follows the triple barrier method it is clear that their decision to close obeys our model

    In practice the investors’ decisions are often taken unconsciously and are driven by their emotions. From empirical evidence we can make some rough conclusions about those parameters:

    • We know that there are some positions that close very quickly, within a day (like those resulting from deposit transactions). On the other hand there are other positions that can remain open for very long.
    • There is a clear pattern of taking profit when asset price grows significantly. This is clearly shown by the mean dollar-invested age for BTC.
    • On the other hand investors do not seem to have a stop-loss level (or we can say that the stop-loss level is very low on average). This can clearly be seen by the realized cap metric – after the top of the price is reached and it starts going down, investors prefer to hold rather than to sell at a loss.

Note that we have postulated here, that the decision to close does not depend on the time when the position was opened. In reality that might not be the case. I would imagine that a BTC investor in 2013 has different take-profit expectations than an investor in 2020, since in 2020 the market is more mature and the investor probably knows this. This assumption is done for simplification.

There is a further simplification of Model 1. We can remove condition 3.1. and assume that the decision to close depends only on the unrealized returns. Lets call this simpler model Model 2. This simplified model is memoryless which might simplify analysis.

Mathemathical formulation

With the given assumptions we can model the decision to close a position as a probability distribution.

Consider the set S of all positions that have ever been opened or that will ever open and let T denote the time domain. Let X := S\times T.

There is a natural way to assign a measure on X which comes from the amount in a position. Actually there are two natural measures – one that measures the amounts in Bitcoin and one that measures the amounts in invested dollars. We’ll denote those measures by \mu^Ƀ and \mu^\$ respectively.

Those measures are induced by the standard length measure on the time interval, the amounts of BTC or dollars in the positions as well as the fact that we don’t care about a position before it has opened or after it has closed. So let s be a position that opened at time entry(s) and closed at time exit(s). Then for an interval [t_1,t_2] we have

\mu^Ƀ(s\times [t_1,t_2]) := amount(s) * (min(t_2, exit(s)) - max(t_1, entry(s))

and

\mu^\$(s\times [t_1,t_2]) := price(entry(s)) * \mu_Ƀ(s\times [t_1,t_2])

For each fixed timestamp t those measures induce measures on the set of positions S. Those measures are natural - if a position does not exist at time t its measure is 0, otherwise it is either the dollar or the bitcoin amount of the position. Formally the Bitcoin measure at time t is

\mu^Ƀ_t(s) := \begin{cases}amount(s), & \textrm{if } entry(s) < t \leq exit(s) \\ 0, & \textrm{otherwise} \end{cases}

and again \mu^\$_t(s) = price(entry(s))\mu^Ƀ_t(s). Note one small detail here – we don’t count positions that were created at time t, i.e. positions for which entry(s) = t. This choice is suitable for our current purpose of studying the exits of a positions.

Those measures that we have defined are finite. Actually \mu^Ƀ_t(S) is simply the total Bitcoin supply at time t and \mu^\$_t(S) is the realized cap at time t. Since they are finite, they define (after normalization) probability measures Pr^Ƀ_t and Pr^\$_t as follows:

Pr^Ƀ_t(A) := \frac{1}{\mu^Ƀ_t(S)}\mu^Ƀ_t(A)

for any subset A of S. (The formula for Pr^\$_t is similar.)

Having defined those measures we can now ask what is the portion of Bitcoins or invested dollars that exits at time t. For the Bitcoin measure this is

Pr^Ƀ_t(exit(s) = t) = \frac{1}{\mu^Ƀ_t(S)}\mu^Ƀ_t\left(\left\{ s | exit(s) = t \right\}\right)

(The formula for the dollar case is analogous.)

Now we can finally state our Model 1 formally. Let r(s,t) denote the unrealized return of s at time t. In other words

r(s,t) = price(t)/price(entry(s))

Let d(s,t) denote the duration of how long s has existed up to time t. Namely d(s,t) = t-entry(s). To simplify notation we’ll write Pr^Ƀ_t(r, d) instead of Pr^Ƀ_t(r(s,t) = r, d(s,t)=d).Then we have

\begin{split} Pr^Ƀ_t(exit(s) = t) &= \sum_{r,d} Pr^Ƀ_t(r, d, exit(s)=t) \\ &=\sum_{r,d} Pr^Ƀ_t(exit(s) = t | r, d)Pr^Ƀ_t(r, d) \\ &=\sum_{r,d} ex^Ƀ_t(r,d)Pr^Ƀ_t(r, d), \end{split}

where ex^Ƀ_t(r,d) is the conditional probability that a position with unrealized returns r and duration d will exit at time t. Note that this conditional probability is not defined everywhere. It is only defined for those pairs (r,d) which correspond to actual positions existing at time t.

In that case we can restate the statement in Model 1 as follows:

Model 1(Bitcoin version). There exists a function ex^Ƀ(r,d), which does not depend on t, such that for any t we have

ex^Ƀ_t(r,d) = ex^Ƀ(r,d)

for those pairs of r and d for which ex^Ƀ_t is defined.

In other words the conditional probability that a position will exit given its returns and duration is independent of the time of exit. In practice this model won’t hold. However he hope that the actual situation will be close to it. We can express this notion of closeness as follows:

Model 1ε(Bitcoin version). There exists a function ex^Ƀ(r,d), which does not depend on t, such that

ex^Ƀ_t(r,d) = ex^Ƀ(r,d) + \varepsilon(t,r,d)

where \varepsilon is a “small” function.

One can similarly state dollar-versions of Model 1. Also it’s easy to see how to state a formal version of Model 2 – simply drop the duration d in all formulas.

to be continued


#2

These are the correct assumptions, Tzanko.

Triple barrier applies only to the professionally trading individuals/firms/funds

The majority of the BTC holders(s) were of a different nature up to now.
Professional devs, enthusiasts. Very few of them were thinking in terms “stop-loss”, “time to hold”