We often face the problem of having to sell an asset within a specified period of time. This problem worsens if we also lack information about our asset’s historical prices. Under this circumstance, *when should we sell our asset?*

In this post I’ll resolve this dilemma based on the classic *Secretary Problem* – also known as *The Sultan’s Dowry Problem*. This problem owes its name to the situation that a manager encounters when he wants to hire the best applicant for the vacant secretary position in his firm. He sequentially interviews each applicant for the job. Immediately after each interview, the manager must decide whether to reject the applicant or hire them. Once rejected, an applicant cannot be recalled.

Our problem is identical. Let’s imagine I’m in possession of a share whose prices have gotten so unstable that** its historical price information is no longer useful**. My financial advisors have warned me against trading it, at least until the dust has finally settled. However, it seems that this situation will linger much longer than I’m willing to be involved in it for. So I’ve come to a decision: **I’m selling this share within the next 100 days**.

Each day, my share takes a different price and I can decide to sell it, or hold in hopes of finding a better price. I don’t want to settle for less, so I’m aiming to sell it for **the best price of all** among the next 100 prices. Thus, just as the manager from the Secretary Problem, I have to decide when to stop looking through new applicant prices and sell my asset.

# Let’s start *recruiting*!

On ** day 1**, I check my share price \(p_{1}\). I feel that if I sell it right now – and taking into account our hypotheses – I’m betting that none of the next 99 prices will beat the current one. I’d better wait until tomorrow.

On ** day 2**, I gladly find that today’s price \(p_{2}\) beats \(p_{1}\). “

*Good news I didn’t sell yesterday!*” I say to myself. Should I sell now? Should I hold? I feel I’m on a roll so I hold, at least, until tomorrow.

On * day 3*, I get a dose of reality when I find that my share’s price has dropped even lower than

*day 1*price. I can’t go on with this game. It’s only

*day 3*and I might have lost the chance of selling the share for the best price.

# Time to put our math to work

At this point, I notice several aspects of my problem:

**Selling too soon**reduces the chance of finding the best price.**Waiting too long**increases the chance of looking past the best price and rejecting it.

The solution to this problem consists of checking the first \(k\) prices, \(p_{1}\), \(p_{2}\),…, \(p_{k}\) and rejecting them, regardless. After that, we should sell our share for the first price that beats those. In case none of the latter beats them – this happens when the best price is among the first \(k\) prices – we’ll have to sell it for the last price \(p_{N}\). The aim of our problem is to choose the optimal number of prices, \(k\), that we have to reject no matter what, in order to maximise the odds of choosing the best price of all.

In short, the steps we’ll follow are:

- Begin checking and rejecting the first \(k\) prices.
- After the \(k\)-th price is known:
- If the current price beats all the previous ones: Sell the share.
- Else: Reject current price and keep checking.

- If we reach the last price, we’ll have to sell our share for that price.

In order to compute the optimal \(k\), we’ll denote the probability of choosing the best price among the \(N\) available, rejecting prices up until \(k\) just as mentioned before by \(P_{N}(S_{k})\). From the formula of total probability:

$$P_{N}(S_{k}) = \sum_{i=1}^{N} P(A_{i})\cdot P_{N}(S_{k}|A_{i})$$

Where \(A_{i}\) is the event of the best price being in the \(i\)-th position, and \(N\) is the maximum number of prices we can check. In our case \(N\)=100.

We’ll assume that the events \(A_{i}\) are equally possible for every \(i\). Thus,\(P(A_{i})={\frac{1}{N}} \forall i\). We also know that we’ll only choose the best price if it’s posterior to the \(k\)-th position, so \(P_{N}(S_{k}|A_{i}) = 0\) for \(i=1,…,k\). This means that:

$$P_{N}(S_{k}) = {\frac{1}{N}} \sum_{i=k+1}^{N} P_{N}(S_{k}|A_{i})$$

The best price located at the \(i\)-th position (\(i>k\)) will be chosen if, and only if, the highest price prior to it has been rejected, i.e. if the highest of the \(i-1\) already seen prices is among the \(k\) first prices. The odds of this happening are \({\frac{k}{i-1}}\). Substituting in the previous formula:

$$P_{N}(S_{k}) = {\frac{1}{N}} \sum_{i=k+1}^{N} {\frac{k}{i-1}} = {\frac{k}{N}}\sum_{i=k+1}^{N} {\frac{1}{i-1}} = {\frac{k}{N}} [ \, {\frac{1}{k}}+{\frac{1}{k+1}}+…+{\frac{1}{N-1}}] \,$$

# Back to our problem

If we plot this probability with \(N=100\), for every \(k=1,…,99\) we get:

We can see that \(k=37\) maximizes the chances of success. According to my calculations, **I’ll choose the best price with a probability of 37.10%** if I follow the strategy of rejecting the first 37 prices. Not bad!

Nevertheless, I can’t help noticing that my hypotheses imply that prices follow no pattern and this wild behaviour will remain for at least 100 days.

**In which other situations could I benefit from this strategy?**