<!DOCTYPE article PUBLIC "-//NLM//DTD JATS (Z39.96) Journal Archiving and Interchange DTD v1.0 20120330//EN" "JATS-archivearticle1.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink">
  <front>
    <journal-meta>
      <journal-title-group>
        <journal-title>Networks. August</journal-title>
      </journal-title-group>
    </journal-meta>
    <article-meta>
      <title-group>
        <article-title>USING TENSORFLOW TO SOLVE THE PROBLEMS OF FINANCIAL FORECASTING FOR HIGH-FREQUENCY TRADING</article-title>
      </title-group>
      <contrib-group>
        <contrib contrib-type="author">
          <string-name>A.V. Bogdanov</string-name>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <contrib contrib-type="author">
          <string-name>A.S. Stankus</string-name>
          <email>alexey@stankus.ru</email>
          <xref ref-type="aff" rid="aff0">0</xref>
        </contrib>
        <aff id="aff0">
          <label>0</label>
          <institution>St. Petersburg State University</institution>
          ,
          <addr-line>University Embankment 7-9, St. Petersburg, 199034</addr-line>
          ,
          <country country="RU">Russia</country>
        </aff>
      </contrib-group>
      <pub-date>
        <year>2018</year>
      </pub-date>
      <volume>27</volume>
      <issue>2015</issue>
      <fpage>513</fpage>
      <lpage>517</lpage>
      <abstract>
        <p>The use of neural networks significantly expands the possibilities of analyzing financial data and improves the quality indicators of the financial market. In article we examine various aspects of working with neural networks and Frame work TensorFlow, such as choosing the type of neural networks, preparing data and analyzing the results. The work was carried out on the real data of the financial instrument Si-6.16 (futures contract on the US dollar rate).</p>
      </abstract>
      <kwd-group>
        <kwd>Artificial Intelligence</kwd>
        <kwd>recurrent neural network (RNN)</kwd>
        <kwd>financial market forecasting</kwd>
        <kwd>TensorFlow</kwd>
      </kwd-group>
    </article-meta>
  </front>
  <body>
    <sec id="sec-1">
      <title>1. Neural network selection</title>
      <p>With an increase in the power of computing resources, it became possible to predict the price
movement of stock markets using artificial neural networks (ANN). The most common form of ANN
used to predict the stock market is a direct transfer network, using the back -propagation error
algorithm to update network weights. These networks are commonly referred to as reverse error
propagation networks. Another form of ANN, which is more suitable for price prediction, is a
recurrent neural network (RNN) [1] or a time delay neural network (TDNN) [2]. Examples of RNN
and TDNN are the networks of Elman, Jordan, and Elman-Jordan.</p>
      <p>RNN was created with the ability to process long serial data and solve problems with the
distribution of context in time. The model processes one element in a sequence in one-time step. After
the calculation, the updated state is transmitted to the next step in time to facilitate the calculation of
the next element.</p>
      <p>
        However, simple networks that linearly combine the current input element and the last output
element can easily lose long-term dependencies. To solve this problem, researchers created a special
neuron with a much more complex internal structure to remember the long-term context, called the
Long-Short Term Memory (LSTM) cell. He is smart enough to find out how long he has to memorize
old information, when to use new data and how to combine old memory with new input [
        <xref ref-type="bibr" rid="ref1">3</xref>
        ].
      </p>
      <p>Stock prices are time series of length N, defined as p0, p1, ..., pN-1, in which pi is the closing
price in the period i, 0≤i &lt;N. We have a sliding window of fixed size w), and we move it to the right
by w so that there is no overlap between the data in all sliding windows.</p>
      <p>The RNN model we are building has LSTM cells as major hidden elements. We use the values
from the very beginning of the training in the first sliding window W0 to the window Wt at time t:
to forecast prices in the next Wt + 1 window:
Essentially, we are trying to find an approximation function, f (W0, W1, ..., Wt) ≈Wt + 1.</p>
      <p>Considering how Backpropagation through time, BPTT [4] works, we usually train RNN in a
“detailed” version, so we don’t need to back propagate too far in time and increase the complexity of
learning.</p>
      <p>Before conducting the experiments, a comparison of the popular framework was carried out in
order to select the optimal tool for predicting price movements (data are tabulated).</p>
      <sec id="sec-1-1">
        <title>Framework</title>
      </sec>
      <sec id="sec-1-2">
        <title>Distributed</title>
        <p>execution</p>
      </sec>
      <sec id="sec-1-3">
        <title>Architecture</title>
        <p>optimization</p>
      </sec>
      <sec id="sec-1-4">
        <title>Visualization</title>
      </sec>
      <sec id="sec-1-5">
        <title>Community support</title>
      </sec>
    </sec>
    <sec id="sec-2">
      <title>2. Data preparation</title>
      <p>The cost of the financial instrument Si-6.16 increases with time, which leads to the fact that
most of the values in the test set are out of allowable limits, and thus the model must predict values
that it has never seen before. In this situation, the network ceases to behave adequately (Figure 4).
To solve the problem with the scale, it is necessary to normalize prices in each sliding
window. Now the task is to predict the relative levels of change instead of absolute values. In the
normalized sliding window W't at the moment of time t all values are divided by the last unknown
price - the last price in Wt-1:
As a result of the data normalization, we get the following price movement:</p>
    </sec>
    <sec id="sec-3">
      <title>3. Experimental results</title>
      <p>When conducting experiments, the following values were used in the TensorFlow settings:
As a result of experiments on forecasting financial instrument Si-6.16, we obtained the following
results:</p>
      <p>As you can see, the result of forecasting coincides quite well with the change in the price of a
financial instrument.</p>
    </sec>
    <sec id="sec-4">
      <title>4. Conclusion</title>
      <p>Experiments have shown the possibility of predicting the price movements of stock markets
using artificial neural networks.</p>
      <p>However, at the moment, we can only predict the direction of price movement, rather than a
specific value, which increases the probability forecasting.</p>
      <p>The accuracy of prediction of the price movement ≈ 62%.
[1] Recurrent neural network - https://en.wikipedia.org/wiki/Recurrent_neural_network;
[2] Network with a time delay - https://en.wikipedia.org/wiki/Time_delay_neural_network;
[4] Backpropagation through time - https://en.wikipedia.org/wiki/Backpropagation_through_time</p>
    </sec>
  </body>
  <back>
    <ref-list>
      <ref id="ref1">
        <mixed-citation>
          [3]
          <string-name>
            <given-names>Understanding</given-names>
            <surname>LSTM</surname>
          </string-name>
          Understanding-LSTMs/
        </mixed-citation>
      </ref>
    </ref-list>
  </back>
</article>