When to stop computing and start investing

Sean R. Aguilar (Computer Science, The University of Texas at El Paso, El Paso, Texas, USA)
Olga Kosheleva (Teacher Education, The University of Texas at El Paso, El Paso, Texas, USA)

Asian Journal of Economics and Banking

ISSN: 2615-9821

Article publication date: 22 June 2021

Issue publication date: 3 August 2021




The purpose of the study is to analyze when — while predicting the future price of a financial instrument — we should stop computations and start using this information for the actual investment.


We derive the explicit formulas explaining how the resulting gain depends on the duration of computations.


We provide an algorithm that enables us to decide the computation time that leads to the largest possible gain.


To the best of our knowledge, this is the first solution to the problem. Following our recommendations will allow investors to select the computation time for which the resulting gain is the largest possible.



Aguilar, S.R. and Kosheleva, O. (2021), "When to stop computing and start investing", Asian Journal of Economics and Banking, Vol. 5 No. 2, pp. 111-115. https://doi.org/10.1108/AJEB-01-2021-0004



Emerald Publishing Limited

Copyright © 2021, Sean R. Aguilar and Olga Kosheleva.


Published in Asian Journal of Economics and Banking. Published by Emerald Publishing Limited. This article is published under the Creative Commons Attribution (CC BY 4.0) licence. Anyone may reproduce, distribute, translate and create derivative works of this article (for both commercial and non-commercial purposes), subject to full attribution to the original publication and authors. The full terms of this licence maybe seen at http://creativecommons.org/licences/by/4.0/legalcode

1. Formulation of the problem

Need for predictions. The price of each stock — and, in general, of each financial instrument — reflects the investors’ prediction of how this particular instrument will change. If the market believes that the company will prosper, the price of its stock goes up; vice versa, if the market believes that the company will go into decline, the price of its stock goes down.

Of course, these general market predictions are approximate. As a result, if some agent can come up with better predictions, this agent can make money. For example, if the agent’s predictions are higher than the general market’s, then it makes sense to buy this stock and then sell it with profit when its value increases above the market’s expectations.

For this purpose, trading companies use complex prediction algorithms, ranging from simple numerical models to deep learning; see, e.g. (Goodfellow et al., 2016).

When should we stop computing? For most prediction algorithms, the more time we spend on computing, the more accurate are the predictions. For example, in machine learning algorithms — including deep learning — the more data we use for prediction, the more accurate the predictions; however, the more data we use for prediction, the longer the computations take.

At first glance, it may seem that we should aim for the maximum possible prediction accuracy. However, if we are predicting tomorrow’s price, and the computations of the most accurate prediction require more than 24 h, then this prediction is useless. If computations take 23 h, then it is also possibly useless, since by then, most of the increase or decrease in price that we are trying to predict — and which we plan to use to gain some profit —— would have already occurred.

So what is the optimal computation time? When should we stop computing and start using the results of our computations to actually invest the money?

What we do in this paper. In this paper, on the example of a somewhat simplified model, we provide an answer to this question.

We hope that our solution will encourage researchers to solve this problem in a more general (and more realistic) setting.

2. Toward formulating the problem in precise terms

What is our objective. Investments are risky. The more risk we tolerate, the more gain we can get. Usually, an investor selects how much risk he/she can tolerate and tries to maximize the expected gain under this restriction on the risk.

How can we gauge risk? Investments are risky because the actual future value of the stock is, in general, different from our prediction estimate. The future price is not uniquely determined by today’s knowledge and thus, constitutes what is called a “random variable.” There is a natural way to gauge how different the values of a random variable can be — we can estimate it by this variable’s standard deviation σ (or by its variance V = σ2).

Thus, a reasonable idea to describe an investor’s tolerance to risk is to have an upper bound σ0 on the corresponding standard deviation per-invested-dollar:


How the tolerated standard deviation depends on time-to-predicted-event. If we are predicting the price of the instrument the next day, the change in the price is usually small, and thus, the corresponding deviation is small. On the other hand, if we are predicting next year’s price, the changes may be large, and thus, the standard deviation σ will be large. In this case, the bound σ0 should be larger.

In general, the larger the time-to-predicted-event, the larger the corresponding standard deviation, and thus, the larger should be the corresponding bound. How can we describe the dependence σ0(t) of the tolerable standard deviation on the time-to-predicted-event t?

Suppose that we have two consequent time intervals of durations t1 and t2. Suppose that the investor tolerates the standard deviation σ0(t1) for predictions over the first time interval and the deviation σ0(t2) for predictions over the second time interval. The change in price over the combined interval of duration t1 + t2 is equal to the sum of the changes over the intervals of durations t1 and t2.

For stock market, fluctuations occurring during different time intervals are largely independent. It is known that the variance of the sum of two independent random variables is equal to the sum of their variances; see, e.g. (Sheskin, 2011). Thus, the variance σ02(t1+t2) is equal to the sum of the corresponding variances:


From this condition, one can easily check that σ02(t) is a linear function of time: σ02(t)=kt for some constant t. Thus, we have

where we denoted s=defk.

Let us formulate the problem in precise terms: what we know. Suppose that we have a financial instrument — e.g. a stock or a portfolio of stocks that closely follows the whole stock marker — that grows with the average rate g. This means that in a year, each invested dollar will grow by the amount g, and during the period of duration t, each invested dollar will grow by the amount


The risk corresponding to this financial instrument is usually larger than what an investor can tolerate; so, the investors do not invest all their money in this instrument. To decrease the risk, they invest some of their money into this instrument and the remaining amount of money into a no-risk instrument (such as US bonds). If these bonds grow with the rate b, then, in a year, each dollar invested in bonds will grow by the amount b, and during the period of duration t, each invested dollar will grow by the amount bt.

Suppose now that, according to the market’s expectations — which are usually obtained simply by analyzing how the price changed in the past — the standard deviation of the change in the per-invested-dollar price of the selected financial instrument during time t is equal to σm(t)=mt for some value m; the square-root dependence of this standard deviation on time can be explained the same way as the dependence of the risk bound σ0(t) on time.

Suppose also that our prediction program, when asked to predict the price of the instrument t moments in the future, after it has been computing for time tc, predicts the desired future price with accuracy σ(t, tc). The longer the computations last — i.e. the larger the computation time tc — the more accurate the predictions.

The value σ(t, tc) can be estimated based on the ability of the software to predict the already observed prices.

Let us formulate the problem in precise terms: what we want. We want to find out at what time tc we should stop the computations and use this information for investment — and what time period t should we use for predictions.

Analysis of the problem. At first, while computations are still going on, to decide which portion p of our money to invest in the given (risky) financial instrument, we can only use the general market’s estimates for this instrument’s standard deviation.

For each dollar, we invest the part p in the risky financial instrument, and the remaining part 1 − p in the bonds. Then, the expected per-invested-dollar gain is equal to


The portion p is determined by the condition that this gain should be the largest possible under the condition that the risk is bounded by value σ0(t)=st.

We use the market’s estimate of the standard deviation of 1 dollar invested in the instrument. This estimate is σm(t)=mt. So, the standard deviation of a p-dollars investment is equal to pmt. Thus, the risk-related constraint takes the form

i.e. equivalently, the form psm.

The larger the portion p invested in the risky financial instrument (such as stock(s)), the larger the expected return. Thus, under the given constraint, the largest possible value of the expected return is attained when the portion p is the largest possible, i.e. when p=sm. During the time tc — while computations are going on — we get the gain


At the moment tc, we stop the computations and get the estimate σ(t, tc). Since this is a more accurate estimate of the instrument’s standard deviation than the market estimate that we previously used, it makes sense to take this new estimate into account and correspondingly re-calculate the portion of money invested in the instrument. In this case, the risk-related constraint takes the form pσ(t,tc)st, hence pstσ(t,tc). Thus, we the new portion pnew of money invested in the stock is equal to

and the resulting gain during the remaining time t − tc is equal to

By adding up the gains (2) and (3), we get the expression for the overall gain:


In particular, if we divide this amount by the time t, we get the following gain-per-unit-time G:

The largest value of this gain is attained for the values tc and t for which the expression
attains the largest possible value.

3. Resulting recommendations

What is given.

  1. We have a risk-free investment with the expected per-invested-dollar gain b.

  2. We know how much risk the investor can tolerate. This knowledge is described by the value s such that, when investing for a time t, the standard deviation of the change in the per-invested-dollar price of a portfolio should not exceed st.

  3. We also have a financial instrument with the expected per-invested-dollar gain g. This expected gain can be determined by analyzing the previous prices (and gains) of this instrument.

  4. Based on these previous prices and gains, we can also determine the coefficient m that describes the standard deviation σ(t) of the change of the instrument’s per-invested-dollar price during the time interval t:

  • (5)

    We also have a prediction algorithm. We can use this algorithm for predicting the instrument’s price t moments into the future. We can run this algorithm for different amounts tc of computation time. Based on applying this algorithm to the previous data, for each amount tc of computation time, we estimate the standard deviation σ(t, tc) of the instrument’s future per-invested-dollar price.

Our recommendation. The largest possible gain-per-unit-time occurs for the values t and tc for which the following expression attains the largest possible value:


The resulting gain-per-dollar-and-per-unit-time is equal to



Goodfellow, I., Bengio, Y. and Courville, A. (2016), Deep Learning, MIT Press, Cambridge, MA.

Sheskin, D.J. (2011), Handbook of Parametric and Non-parametric Statistical Procedures, Chapman & Hall/CRC, London.

Corresponding author

Olga Kosheleva can be contacted at: olgak@utep.edu

Related articles