{'fraction_non_alphanumeric': 0.0327015690539071, 'fraction_numerical': 0.013826316607115115, 'mean_word_length': 4.55675442382391, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Modeling long-range memory trading activity by stochastic differential equations

We propose a model of fractal point process driven by the nonlinear stochastic differential equation. The model is adjusted to the empirical data of trading activity in financial markets. This reproduces the probability distribution function and power spectral density of trading activity observed in the stock markets. We present a simple stochastic relation between the trading activity and return, which enables us to reproduce long-range memory statistical properties of volatility by numerical calculations based on the proposed fractal point process.


I. INTRODUCTION
There are empirical evidences that the trading activity, the trading volume and the volatility of the financial markets are stochastic variables with the power-law probability distribution function (PDF) [1,2] and the long-range correlations [3,4,5]. Most of proposed models apply generic multiplicative noise responsible for the power-law probability distribution function (PDF), whereas the long-range memory aspect is not accounted in the widespread models [6].The additive-multiplicative stochastic models of the financial mean-reverting processes provide rich spectrum of shapes for PDF, depending on the model parameters [7], however, do not describe the long-memory features. Empirical analysis confirms that the long-range correlations in volatility arise due to those of trading activity [4].
On the other hand, trading activity is a financial variable dependant on the one stochastic process, i.e.interevent time between successive market trades. Therefore, it can be modeled as event flow of the stochastic point process.
Recently, we investigated analytically and numerically the properties of the stochastic multiplicative point processes, derived formula for the power spectrum [8,9] and related the model with the multiplicative stochastic differential equations [10]. Preliminary comparison of the model with the empirical data of the power spectrum and probability distribution of stock market trading activity [11] stimulated us to work on the more detailed definition of the model. Here we present the stochastic model of the trading activity with the long-range correlations and investigate its connection to the stochastic modeling of the volatility. The proposed stochastic nonlinear differential equations reproduce the power spectrum and PDF of the trading activity in the financial markets, describe the stochastic interevent time as the fractal-based point process and can be applicable for modeling of the volatility with the long-range autocorrelation.

II. MODELING FRACTAL POINT PROCESS BY THE NONLINEAR STOCHAS-TIC DIFFERENTIAL EQUATION
Trades in financial markets occur at discrete times t 1 , t 2 , t 1 , ...t k , ... and can be considered as identical point events. Such point process is stochastic and totaly defined by the stochastic interevent time τ k = t k+1 − t k . A fractal stochastic point process results, when at least two statistics exhibit the power-law scaling, indicating that represented phenomena contains clusters of events over all scales of time [12]. The dimension of the fractal point process is a measure of the clustering of the events within the process and by the definition coincides with the exponent of the power spectral density of the flow of events.
We can model the trading activity in financial markets by the fractal point process as its empirical PDF and the power spectral density exhibit the power-law scaling [4,13]. In this paper we consider the flow of trades in financial markets as Poisson process driven by the multiplicative stochastic equation. First of all we define the stochastic rate n = 1/τ of event flow by continuous stochastic differential equation where W is a standard random Wiener process, σ denotes the standard deviation of the white noise, γ ≪ 1 is a coefficient of the nonlinear damping and µ defines the power of noise multiplicativity. The diffusion of τ should be restricted at least from the side of high values. Therefore we introduce an additional term − m 2 σ 2 τ τ 0 m τ 2µ−2 into the Eq. (1), which produces the exponential diffusion reversion in equation where m and τ 0 are the power and value of the diffusion reversion, respectively. The associated Fokker-Plank equation with the zero flow gives the simple stationary PDF with α = 2(γ σ −µ) and γ σ = γ/σ 2 . Eq. (2) describes continuous stochastic variable τ , defines the rate n = 1/τ and, after the Ito transform of variable, results in stochastic differential where η = 5 2 − µ and n 0 = 1/τ 0 . Eq. (4) describes stochastic process n with PDF and power spectrum S(f ) [8,9,10] scaling parameter σ 2 in Eq. (4) can be omitted adjusting the time scale. Here we define the fractal point process driven by the stochastic differential equation (4) or equivalently by Eq. (2), i.e., we assume τ (t) as slowly diffusing mean interevent time of Poisson process with the stochastic rate n. This should produce the fractal point process with the statistical properties defined by Eqs. (5) and (6). Within this assumption the conditional probability of interevent time τ p in the modulated Poisson point process with the stochastic rate 1/τ is Then the long time distribution ϕ(τ p ) of interevent time τ p has the integral form with C defined from the normalization, In the case of pure exponential diffusion reversion, m = 1, PDF (8) has a simple form where K α (z) denotes the modified Bessel function of the second kind. For m > 1 more complicated structures of distribution ϕ(τ p ) expressed in terms of hypergeometric functions arise.

III. ADJUSTMENT OF THE MODEL TO THE EMPIRICAL DATA
We will investigate how the proposed modulated Poisson stochastic point process can be adjusted to the empirical trading activity, defined as number of transactions in the selected time window τ d . Stochastic variable n denotes the number of events per unit time interval.
One has to integrate the stochastic signal Eq. (4) in the time interval τ d to get the number of events in the selected time window. In this paper we denote the integrated number of events as and call it the trading activity in the case of the financial market.
Detrended fluctuation analysis [13] is one of the methods to analyze the second order statistics related to the autocorrelation of trading activity. The exponents ν of the detrended fluctuation analysis obtained by fits for each of the 1000 US stocks show a relatively narrow spread of ν around the mean value ν = 0.85 ± 0.01 [13]. We use relation β = 2ν − 1 between the exponents ν of detrended fluctuation analysis and the exponents β of the power spectrum [14] and in this way define the empirical value of the exponent for the power spectral density Our analysis of the Lithuanian stock exchange data confirmed that the power spectrum of trading activity is the same for various liquid stocks even for the emerging markets [11]. The Time series generated by stochastic process (4) are fractal in the same sense.
Nevertheless, we face serious complications trying to adjust model parameters to the empirical data of the financial markets. For the pure multiplicative model, when µ = 1 or η = 3/2, we have to take γ σ = 0.85 to get β = 0.7 and γ σ = 1.7 to get λ = 4.4, i.e. it is impossible to reproduce the empirical PDF and power spectrum with the same relaxation parameter γ σ and exponent of multiplicativity µ. We have proposed possible solution of this problem in our previous publications [9,11] deriving PDF for the trading activity N where a new parameter ǫ defines crossover between two areas of n diffusion. The corresponding iterative equation for τ k in such a case is where ε k denotes uncorrelated normally distributed random variable with the zero expectation and unit variance.
Eqs. (12) and (13) define related stochastic variables n and τ , respectively, and they should reproduce the long-range statistical properties of the trading activity and of waiting time in the financial markets. We verify this by the numerical calculations. In figure 1 we present the power spectral density calculated for the equivalent processes (12) and (13) (see [9] for details of calculations). This approach reveals the structure of the power spectral density in wide range of frequencies and shows that the model exhibits not one but rather two separate power laws with the exponents β 1 = 0.33 and β 2 = 0.72. From many numerical calculations performed with the multiplicative point processes we can conclude that combination of two power laws of spectral density arise only when the multiplicative noise is a crossover of two power laws as in Eqs. (12) and (13). We will show in the next section that this may serve as an explanation of two exponents of the power spectrum in the empirical data of volatility for S&P 500 companies [15].   The power spectrum of the trading activity N has the same exponent β = 0.7 as power spectrum of n in the low frequency area for all values of τ d .
The same numerical results can be reproduced by continuous stochastic differential equation (12) or iteration equation (13). One can consider the discrete iterative equation for the interevent time τ k (13) as a method to solve numerically continuous equation The continuous equation (12)  financial markets as well as the PDF can be modeled by the continuous stochastic differential equation (12). In this model the exponents of the power spectral density, β, and of PDF, λ, are defined by one parameter γ σ = γ/σ 2 . We consider the continuous equation of the mean interevent time τ as a model of slowly varying stochastic rate 1/τ in the modulated Poisson process (7). In figure 3 we demonstrate the probability distribution functions P (τ p ) calculated from the histogram of τ p generated by Eq. (7) with the diffusing mean interevent time calculated from Eq. (14).
Numerical results show good qualitative agreement with the empirical data of interevent time probability distribution measured from few years series of U.S. stock data [16]. This enables us to conclude that the proposed stochastic model captures the main statistical properties including PDF and the long-range correlation of the trading activity in the financial markets. Furthermore, in the next section we will show that this may serve as a background statistical model responsible for the statistics of return volatility in widely accepted geometric Brownian motion (GBM) of the financial asset prices.

IV. MODELING LONG-RANGE MEMORY VOLATILITY
The basic quantities studied for the individual stocks are price p(t) and return Let us express return x(t, τ d ) over a time interval τ d through the subsequent changes δx i due to the trades i = 1, 2....N(t, τ d ) in the time interval [t, t + τ d ], We denote the variance of δx i calculated over the time interval τ d as W 2 (t, τ d ). If δx i are mutually independent one can apply the central limit theorem to sum (16). This implies that for the fixed variance where ε t is the normally distributed random variable with the zero expectation and unit variance.
Empirical test of conditional probability P (x(t, τ d )|W (t, τ d )) [4] confirms its Gaussian form, and the unconditional distribution P (x(t, τ d )) is a power-law with the cumulative exponent 3. This implies that the power-law tails of returns are largely due to those of Here we refer to the theory of price diffusion as a mechanistic random process [17,18]. For this idealized model the short term price diffusion depends on the limit order removal and this way is related to the market order flow. Furthermore, the empirical analysis confirms that the volatility calculated for the fixed number of transactions has the long memory properties as well and it is correlated with real time volatility [19]. We accumulate all these results into the assumption that standard deviation W (t, τ d ) may be proportional to the square root of the trading activity, i.e., W (t, τ d ) ∼ k N(t, τ d ). This enables us to propose a simple model of return and related model of volatility v = |x(t, τ d )| based on the proposed model of trading activity (12). We generate series of trade flow n(t) numerically solving Eq.
In figure 4 we demonstrate cumulative distribution of v and the power spectral density of v(t, τ d ) calculated from FFT. We see that proposed model enables us to catch up the main features of the volatility: the power law distribution with exponent 2.8 and power spectral density with two exponents β 1 = 0.6 and β 2 = 0.24. This is in a good agreement with the empirical data [15,19].

V. CONCLUSIONS
Starting from the concept of the fractal point processes [12] we proposed process driven by the nonlinear stochastic differential equation and based on the earlier introduced stochastic point process model [8,9,10,11]. This may serve as a