Keywords

1 Introduction

In options trading, the contract's value depends on the underlying (stock or commodity) value. The present discussion is centred on options of stocks. There are two types of option trades: call option and put option. In the call option, buyer of the contract can exercise the right or drop the purchasing of stocks on the maturity date at a fixed rate. On the other side, there is put option. In the put option, the buyer of the contract can exercise the right to sell the stocks at a fixed rate or drop the contract. The other party involved is called writer or seller of contract. Contracts are usually made of different lot sizes that may vary from few hundred to thousand. For example, in a call option for some “ABC” share, the buyer may purchase the right of buying 100 shares at a rate of 30$ on 15 January 2020 by paying the cost of 700$. On maturity date, the buyer has two options: in the first option, the buyer drops the idea of purchasing because shares of underlying stock are trading at lower than 30$. Therefore, in this case, buyer loses the money (700$). In the second option, buyer may exercise the right to purchase the shares at a fixed rate because the market price of underlying stock is trading higher than 30$ say 39$. Therefore, buyer makes the profit 100 * (39 − 30)−700 = 200$.

In options trading [23], any contract may be a combination of various trades. Some may be call option, others may be put option. For example, there are multiple strategies like bull call spread, bear spread, etc. In these strategies, one might buy a call option and sell another call option of the same underlying asset. Many features of option trading [24] attract researchers to develop an efficient system that draws conclusions about the movement of index or stock so that more and more accurate decisions might be made for trading. The use of AI in finance is growing rapidly, and the recent years saw many investors begin to use it in a variety of ways, though it is unclear how many of them are using it specifically for options trading. Advances in artificial intelligence (AI) have a more significant impact even in medicine and bolster the power of medical interventions and diagnostic tools as used by authors in [20]. In the financial community, Big Data is making more of a splash than a ripple. Technology is advancing at an alarming pace, with far-reaching repercussions. Industry operations are being transformed by increasing complexity and data generation, and the finance industry is no exception. AI can efficiently sift through large quantities of Big Data to generate data predictions and cost-effective energy optimization solutions to fuel Smart City technologies such as the one used by authors in [21].

2 Constraint Programming and the CLP Scheme

Complex problems can be represented concisely in constraint solving because the properties can be represented implicitly without bindings to other variables. Constraint logic programming (CLP) provides a foundation for programming language class by combining constraint-solving and logic programming concepts. CLP(R) language is implementation of constraint logic programming approach in domain of real numbers. For example, the constraint X ≥ 1, X < X + 2 is always solvable in CLP(R) [1, 17].

A CLP(R) clause has the form as

$$ p\left(\dots \right):-{p}_1,\kern0.62em {p}_2,\dots \kern0.62em {p}_n $$

where n ≥ 0 and pi represents constraints or predicates.

Constraints can have many relations (≥, ≤, >, =). CLP(R) has natural inference mechanism and declarative power of logic programming [18].

2.1 The Binomial Option Pricing Formula

In the model of binomial pricing, value is calculated for the underlying stock. In this analysis, it is assumed that the underlying stock’s value can either move up or move down at the end of one-time unit. According to this assumption, value of underlying stock can be formulated as

$$ C\kern0.83em =\kern0.83em \max \kern0.83em \left(S\;\varDelta +P,\kern0.83em S-Q\right) $$

provided

$$ uS\varDelta + rP\kern0.62em =\kern0.62em \max \kern0.62em \left(0,\kern0.62em uS-Q\right) $$
$$ dS\varDelta + rP\kern0.62em =\kern0.62em \max \kern0.62em \left(0,\kern0.62em dS-Q\right) $$

where S represents price of stock, Δ stands for rate of change in option value with relation to change in the underlying stock, P stands for amount of currency in riskless bonds, Q stands for strike price of option contract, r is the value of interest rate +1, and u, d represent the up/down return rates +1.

The above formulas represent the constraints that can directly yield the CLP(R) rule as

Valuation (C, S, Delta, P, R, Q, Up, Down):

$$ \mathrm{Up}\ast S\ast \mathrm{Delta}+R\ast P\kern0.62em =\kern0.62em \max \left(0,\kern0.62em \mathrm{Up}\ast S-Q\right), $$
$$ \mathrm{Down}\ast S\ast \mathrm{Delta}+R\ast P\kern0.62em =\kern0.62em \max \left(0,\kern0.62em \mathrm{Down}\ast S-Q\right), $$
$$ C\kern0.83em =\kern0.83em \max \left(S\ast \mathrm{Delta}+P,\kern0.83em S-Q\right). $$

The goal can evaluate the option price for given values of S, Q, R, Up, Down. For obtaining the value of C, CLP(R) solves several linear equations and produces answers. By iterating the evaluation rule backward for a period of time, binomial pricing model is obtained. An option value tree is computed by CLP(R) clauses using above recursion [1, 19].

2.2 The Black-Scholes Model

The formula of the Black-Scholes model is limit case of formula for binomial pricing. It is based on continuous model of option trading. It represents the theoretical price of a call option in terms of strike price (k), stock price (s), the current interest rate (risk-free) r, the time to expiration t, and volatility v for the stock calculated as square v root of variance by the following equation[2]:

Theoretical value for option price = sN(d1) − kertN(d2)

$$ {\displaystyle \begin{array}{l}{d}_1=\frac{lnln\;\left(\frac{s}{k}\right)\kern0.62em +\left(r+\frac{v^2}{2}\right)t\;}{v}\sqrt{t}\\ {}{d}_2={d}_1-v\sqrt{t}\end{array}} $$

where ln stands for natural log and N(y) stands for cumulative normal distribution [7, 8].

3 Complexity in Options Market

Complex adaptive system theory gives a new way to study economics. This suggests that an economic system having proactive and adaptive individuals is process-based and evolving and self-organizing rather than predictable, mechanical, and established. To optimize trading, information is exchanged, and the members in the system accumulate this knowledge [15].

The market of options [25] is very complex in terms of adaptability. It depends upon the behaviour of investors and their decision-making approach. Market and investors both are affecting each other and thus changing continuously. Following is the discussion of a simulation of agent-based model.

3.1 The Architecture and Environment of Agent-Based Model

There is a mechanism very common in the market known as Continuous Double Auction (CDA). In this model, each participant is given a role that may be of buyer or of seller. In the process of trading, the seller gives a bid for a stock. This bid can be seen by all participants of the market. An investor analyses the bid given by seller. If it might maximize the gain for the investor, then bid given by the seller is accepted, and thus a transaction is completed [16, 26].

In this model, many experimental methods are chosen for a particular trading approach. Thus, this model is very helpful in simulating a continuous double auction market. This model considers the fact that investors are not aware of any information regarding valuation and cost of entity.

3.2 Agent Strategies (Zero Intelligence Plus Model)

ZIP is machine learning-based approach that determines optimal strategy by experience. It adapts according to open auction market environment which helps to make decisions about strategies to be followed. Any agent i in this model has profit margin μi(t) and limit profit αi. An agent can submit a bidding price pi(t) as [3]

$$ {p}_i(t)={\alpha}_i\left(1-{\mu}_i(t)\right) $$

and the seller can submit asking price as

$$ {p}_i(t)={\alpha}_i\left(1+{\mu}_i(t)\right) $$

An agent i is selected randomly and asking or bidding price pi(t) is the same as equal to the current price in market qi(t). If the asking or bidding price is lesser than (or more than) the current price in the market, then the transaction may happen. Whether a transaction happens or not, all agents update the profit margin μi(t) according to learning algorithm [9, 10].

3.2.1 Model Parameters

Every agent is allotted some parameter in this model – parameter for learning rate βi, profit margin μi(t) and dynamic parameter ψi. Genetic algorithm is used for the optimization of transaction process. Many issues are considered whether the underlying price goes up or down, movement of option price, asking or bidding price is less or more than the current market price, etc. According to these issues, market state is analysed, and on the basis of market state, strategies are formed to either increase or maintain the profit.

If the profit increases for a particular strategy, then it is believed by agent that strategy was optimal that market state and thus the probability of using that strategy again increases. On the other hand, if the profit decreases, it leads the agent to believe that strategy was not appropriate in that market state and the probability of using that strategy again is reduced. Thus, using this learning approach, the agent gets to choose strategies for making profit.

3.2.2 Optimizing Strategies Using Monte Carlo Simulation

In the market, strategies get affected by current market price and the future prices of stock. In Monte Carlo simulation, random sampling is used for state variables. The first random sample path is generated for stock price under consideration as p1, p2, p3, … pT over a relevant time horizon. Assuming the Brownian motion, the price for the underlying stock is [3]:

$$ \frac{dS}{S}=\mu dt+\beta dz $$

where dS represents increment in stock price, μ stands for asset return, β represents the price volatility, dz stands for Wiener increment, where z is a Wiener process. Assuming the risk of neutral condition, the above formula can be rewritten as:

$$ \frac{dS}{S}=\left(\mu -\frac{\beta^2}{2}\right) dt+\beta dz $$

In the above derivation of formula, assume the time interval is divided into X sub-intervals having length Δt = T/X. Thus, a new formula can be written as

$$ \ln \kern0.83em {S}_i-\ln \kern0.83em {S}_{i-1}=\left(\mu -\frac{\beta^2}{2}\right)\;\varDelta t+\beta \sqrt{\varDelta t}\kern0.83em .\kern0.83em {\varepsilon}_i $$

where εi represents standard normal distribution. If underlying price S0 is given, then price Si can be calculated as

$$ {S}_i=\exp \Big(\ln \kern0.83em {S}_0+\left(i\kern0.83em .\kern0.83em \left[\left(\mu -\frac{\beta^2}{2}\right)\kern0.83em \varDelta t+\beta \sqrt{\varDelta t}\kern0.83em .\kern0.83em {\varepsilon}_i\right]\right) $$

Simulating the above formula many times and averaging it, underlying price can be calculated [13, 14].

3.2.3 Process of Strategy Formation

As it is clear from the above analysis, strong relationship exists between underlying and option price. Given the price distribution of underlying, option’s life is divided into several small units. Random sampling is done on samples of distributions. With the help in simulation of price changes, movement of price’s path can be predicted. Thus, value for the price of option can be calculated. By taking a random sample from the set of terminal values, the result can be analysed.

Model of equilibrium for rational expectations can be very helpful here. Over a particular period, it is assumed that xi,j stands for shares of underlying stock that are holed by buying agent I who is willing to accept the writer’s asking price and yi,j stands for the writer who is willing to accept the bidding price. ψi,j represents the demand for underlying stock, then the following relationship holds among them,

$$ {x}_{i,j}={\psi}_{i,j}-{\psi}_{i,j-1}\kern2.1em \mathrm{if}\;{\psi}_{i,j}\ge {\psi}_{i,j-1} $$

Otherwise, xi,j is 0

$$ {y}_{i,j}={\psi}_{i,j-1}-{\psi}_{i,j}\kern2.1em \mathrm{if}\;{\psi}_{i,j}<{\psi}_{i,j-1} $$

Otherwise, yi,j is 0

$$ {X}_t=\sum \limits_N^{i=1}{x}_{i,j} $$
$$ {Y}_t=\sum \limits_N^{i=1}{y}_{i,j} $$

where Xt denotes number of holders and Yt stands for number of writers. The α represents the difference function between Xt and Yt. α can be expressed as regulation speed of price as

$$ \alpha \left( Xt- Yt\right)\left)=\right\{\tan h\left(\alpha \left( Xt- Yt\right)\right), Xt\ge Yt\;\tan h\tan h\;\left(\alpha \left( Xt- Yt\right)\right), Xt< Yt $$

and

$$ \tan h(x)=\frac{e^x+{e}^{-x}}{e^x-{e}^{-x}} $$

The price prediction for underlying price can be formulated as [3]

$$ {S}_{t+1}={S}_t\left(1+\alpha \left({X}_t-{Y}_t\right)\right) $$

From other paths, different random samples are taken. After repetition of this procedure hundreds of times, the set of options at a particular time is obtained. Averaging over different sample paths, calculation of option price is done. Agents tend to make a decision by comparison of market and calculated option price. This helps also in assessing the profit scenario for trader. Thus, the agents can determine whether to write or hold the options. Repetition of this process very much reflects the market situation.

To choose the opening prices, a method can be used which optimizes the potential profit of the makers of the market. This method can be used to offset the imbalances in public order with few limits on the allowed deviation for implied volatilities. In this method, set of implied volatilities σ over some range of possible values of implied volatilities.

Corresponding prices are examined for each element in this set. This helps in determining the side responsible for imbalances in the public order. For each imbalance in the buying side, an upward move is followed from price pi in the set σi. For each price greater than pi, product of buying imbalances is calculated, which helps determine the profit potential in the market.

A similar process is followed for the imbalances in selling side. There is a difference when followed for selling side; instead of moving forward, stepping down is followed in prices. A price can be found in each series for which profit potential can be maximum but a bound which is exchange specified for a deviation which is maximum from price pi should also be considered.

Opening prices are picked by exploring over the sets for implied volatilities σ. The above procedure results in sets of prices that helps in maximizing the traded volume.

3.2.4 Enhancement of Model Based on Delta-Gamma Parameters

Option price can be calculated using Black-Scholes formula as

$$ {\displaystyle \begin{array}{l}{C}_t\triangleq {C}^{(BS)}\left({S}_t,T-t,{\sigma}_t,{r}_t,K\right)\\ {}={S}_t\phi \left({d}_{+}\right)-K\exp \left(-{r}_t-\left(T-t\right)\right)\;\phi \left({d}_{-}\right)\end{array}} $$

where St is the price of underlying, T represents maturity time, implied volatility is represented by σt, rt whose value is greater than zero represents the prevailing rate of interest, K represents the striking price of option, ϕ represents the cumulative distribution function and d+, d are described as

$$ {d}_{+}/{d}_{-}=\frac{1}{\sigma t}\left(\ln \left({S}_t/K\right)+{r}_t\left(T-t\right)\right) $$

Option price can be represented as

$$ {V}_t\triangleq \left({S}_t-{S}_0\right)/{S}_0 $$

where Vt stands for linear return of stock price during the time (0,t) and S0 stands for underlying price at beginning.

According to risk or position (in both cases) management, change in option price can be represented as

$$ {C}_t-{C}_0={C}^{(BS)}\left({S}_t,\kern0.62em T-t,\kern0.62em {\sigma}_t,\kern0.62em {r}_t,\kern0.62em K\right)-{C}^{(BS)}\left({S}_0,\kern0.62em T,\kern0.62em {\sigma}_0,\kern0.62em {r}_0,\kern0.62em K\right) $$

Some modifications can be made as

$$ {C}_t-{C}_0={C}^{(BS)}\left({S}_t,\kern0.62em T-t,\kern0.62em {\sigma}_t,\kern0.62em {r}_0,\kern0.62em K\right)-{C}^{(BS)}\left({S}_0,\kern0.62em T,\kern0.62em {\sigma}_0,\kern0.62em {r}_0,\kern0.62em K\right) $$

assuming that interest rate is uniform mostly.

On assuming that volatility is also constant, then above equation can be modified further as

$$ {C}_t-{C}_0={C}^{(BS)}\left({S}_t,\kern0.62em T-t,\kern0.62em {\sigma}_0,\kern0.62em {r}_0,\kern0.62em K\right)-{C}^{(BS)}\left({S}_0,\kern0.62em T,\kern0.62em {\sigma}_0,\kern0.62em {r}_0,\kern0.62em K\right). $$

It can be observed that option price calculation based on approximation of delta gamma parameters drops as change in underlying stock price increases for all the parameters which are considered here. This behaviour becomes more important as the value of volatility decreases (Fig. 1).

Fig. 1
figure 1

Change in implied volatility and asset price [2]

The reason for the above changes is that approximation is made at beginning while approximation becomes more accurate if it is made at t time. This modification leads to a new concept called extended delta gamma approximation.

Thus, according to extended delta gamma approximation, the above equations get modified as

$$ {C}_t-{C}_0={C}^{(BS)}\left({S_t}^{\ast },\kern0.62em T-t,\kern0.62em {\sigma}_t,\kern0.62em {r}_0,\kern0.62em K\right)-{C}^{(BS)}\left({S_t}^{\ast },\kern0.62em T,\kern0.62em {\sigma}_0,\kern0.62em {r}_0,\kern0.62em K\right) $$

Using functional data analysis, change in stock prices can be predicted (Fig. 2).

Fig. 2
figure 2

Comparison of EDGA and DGA [2]

The performance relies on accuracy of prediction in the changes of underlying. In this method, modelling the scalar response as linear model as

$$ X=\alpha +\underset{T}{\overset{0}{\int }}X\kern0.62em .\kern0.62em \alpha \kern0.62em .\kern0.62em ds+\varepsilon $$

where all the variables have their usual meaning.

α can be expanded as

$$ \alpha =\sum \limits_K^{\left(k=1\right)}{b}_k $$

Covariate functions can also be expanded as

$$ X(s)= C\psi (s) $$

So the model can be expressed as

$$ X=\beta + CJ $$

where J is expressed as,

$$ J=\int \psi (s)\kern0.62em .\kern0.62em \alpha $$

Thus, using above expressions, accurate prediction can be made for underlying asset price (Fig. 3).

Fig. 3
figure 3

Absolute vs relative error forecast [2]

Delta plays a vital role in analysing the situation of market dynamics. It represents the relationship between sensitivity of underlying price and price of option. Delta can be seen as measure of the change in the underlying price. The delta is calculated by change in price of option divided by change in the underlying price [11].

Concept of gamma is used to study the delta values. Gamma is used to measure the closeness of market price to the option price. As the closeness of these two prices increase, value of gamma goes higher. Gamma is also related to expiration date. As the maturity date comes closer, value of gamma increases as well.

Change in call option price can be predicted using delta and gamma approximation as

$$ {C}_t\hbox{--} {C}_0\approx \varDelta {v}_t{S}_0+\varGamma {\left({v}_t{S}_0\right)}^2 $$

where Ct and C0 are option prices and S0 is underlying price, vt is linear change in underlying asset price and Δ, Γ are parameters related to probability function and distributive function [12].

4 Estimating the Price Movement with Normal Distribution Curve of Underlying Asset

As the above calculation suggests, the price of underlying can be assessed by random sampling taken over different samples. Normal distribution curves can help to conclude the price movement over a specific time period. The Gaussian distribution curve is based on the central limit theorem. According to this theorem, random variables are identically distributed and independent when calculated average values show the same Gaussian (normal) distribution [4] (Fig. 4).

Fig. 4
figure 4

Graph showing the behaviour of an arbitrary stock [6]

As it can be seen from the above diagram that within the first standard deviation, roughly 70% variation in underlying price occurs. If the transactions are based on a strike price which are very close to the values in first deviation, then probability of market price ending on the price higher or closer to option value increases.

The learning algorithm can be modified in such a way to exhibit these relations of option price of assets. Figure 2 shows the behaviour of some most commonly traded stocks and indexes. It is evident from figure that variation in prices of stocks are showing the similarity between Gaussian distribution and their price variation over a period of time. Strike price vary according to moneyness of options. If the prices are chosen according to precalculated values based on standard deviation and variance, then it increases the probability of profit in the transaction (Fig. 5).

Fig. 5
figure 5

Normal distribution curves of some stocks and indexes [5]

The Gaussian distribution curve for asset price can be used to predict price changes of the underlying. The kurtosis and skewness helps us to determine how different is the behaviour of the underlying asset from Gaussian distribution. Zero skewness curves are very similar to ideal distribution, and thus prediction is more accurate. Negative or less than zero skewness indicate that distribution is not even and biased toward the left area. Similarly positive or more than zero skewness value represents flatness of distribution in the right side. The more symmetric the curve, more accuracy can be achieved in predicting results.

As it can be concluded from above examples of normal distribution curves, if price estimation is between the first standard deviation, it can be used to optimize the profit because price movement is supposed to be under this range unless the market shows very strange behaviour. This calculation can be more accurate using the Monte Carlo simulation based on option pricing formula.

The planet is currently producing 2.5 quintillion bytes of data per day, which represents a once-in-a-lifetime resource for encoding, analysing, and using the data in useful ways. Machine learning and algorithms are rapidly being used in securities trading to process large amounts of data and make forecasts and judgments that humans cannot. Accurate insights into corporate decision-making models are critical in finance and trading. Humans have traditionally crunched numbers and taken choices based on inferences derived from measured risks and patterns. Computers have taken over this role today. They can compute on a large scale and pull data from a variety of sources to arrive at more precise results almost instantly. As implemented by authors in [22], even AI technologies provide promising solutions for end-to-end optimization of wireless networks. Financial analytics is no longer limited to the analysis of markets and price behaviour; it also encompasses the values that influence prices, as well as social and political patterns and the determination of degrees of support and opposition.