diff --git a/docs/ManPages/PricePrediction.aux b/docs/ManPages/PricePrediction.aux new file mode 100644 index 0000000..a79beaf --- /dev/null +++ b/docs/ManPages/PricePrediction.aux @@ -0,0 +1,2 @@ +\relax +\gdef \@abspage@last{3} diff --git a/docs/ManPages/PricePrediction.log b/docs/ManPages/PricePrediction.log new file mode 100644 index 0000000..09153a8 --- /dev/null +++ b/docs/ManPages/PricePrediction.log @@ -0,0 +1,227 @@ +This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022/Debian) (preloaded format=pdflatex 2024.12.25) 23 JAN 2025 16:19 +entering extended mode + restricted \write18 enabled. + %&-line parsing enabled. +**PricePrediction.tex +(./PricePrediction.tex +LaTeX2e <2022-11-01> patch level 1 +L3 programming layer <2023-01-16> +(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls +Document Class: article 2022/07/02 v1.4n Standard LaTeX document class +(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo +File: size12.clo 2022/07/02 v1.4n Standard LaTeX file (size option) +) +\c@part=\count185 +\c@section=\count186 +\c@subsection=\count187 +\c@subsubsection=\count188 +\c@paragraph=\count189 +\c@subparagraph=\count190 +\c@figure=\count191 +\c@table=\count192 +\abovecaptionskip=\skip48 +\belowcaptionskip=\skip49 +\bibindent=\dimen140 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsmath.sty +Package: amsmath 2022/04/08 v2.17n AMS math features +\@mathmargin=\skip50 + +For additional information on amsmath, use the `?' option. +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amstext.sty +Package: amstext 2021/08/26 v2.01 AMS text + +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsgen.sty +File: amsgen.sty 1999/11/30 v2.0 generic functions +\@emptytoks=\toks16 +\ex@=\dimen141 +)) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsbsy.sty +Package: amsbsy 1999/11/29 v1.2d Bold Symbols +\pmbraise@=\dimen142 +) +(/usr/share/texlive/texmf-dist/tex/latex/amsmath/amsopn.sty +Package: amsopn 2022/04/08 v2.04 operator names +) +\inf@bad=\count193 +LaTeX Info: Redefining \frac on input line 234. +\uproot@=\count194 +\leftroot@=\count195 +LaTeX Info: Redefining \overline on input line 399. +LaTeX Info: Redefining \colon on input line 410. +\classnum@=\count196 +\DOTSCASE@=\count197 +LaTeX Info: Redefining \ldots on input line 496. +LaTeX Info: Redefining \dots on input line 499. +LaTeX Info: Redefining \cdots on input line 620. +\Mathstrutbox@=\box51 +\strutbox@=\box52 +LaTeX Info: Redefining \big on input line 722. +LaTeX Info: Redefining \Big on input line 723. +LaTeX Info: Redefining \bigg on input line 724. +LaTeX Info: Redefining \Bigg on input line 725. +\big@size=\dimen143 +LaTeX Font Info: Redeclaring font encoding OML on input line 743. +LaTeX Font Info: Redeclaring font encoding OMS on input line 744. +\macc@depth=\count198 +LaTeX Info: Redefining \bmod on input line 905. +LaTeX Info: Redefining \pmod on input line 910. +LaTeX Info: Redefining \smash on input line 940. +LaTeX Info: Redefining \relbar on input line 970. +LaTeX Info: Redefining \Relbar on input line 971. +\c@MaxMatrixCols=\count199 +\dotsspace@=\muskip16 +\c@parentequation=\count266 +\dspbrk@lvl=\count267 +\tag@help=\toks17 +\row@=\count268 +\column@=\count269 +\maxfields@=\count270 +\andhelp@=\toks18 +\eqnshift@=\dimen144 +\alignsep@=\dimen145 +\tagshift@=\dimen146 +\tagwidth@=\dimen147 +\totwidth@=\dimen148 +\lineht@=\dimen149 +\@envbody=\toks19 +\multlinegap=\skip51 +\multlinetaggap=\skip52 +\mathdisplay@stack=\toks20 +LaTeX Info: Redefining \[ on input line 2953. +LaTeX Info: Redefining \] on input line 2954. +) +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amssymb.sty +Package: amssymb 2013/01/14 v3.01 AMS font symbols + +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/amsfonts.sty +Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support +\symAMSa=\mathgroup4 +\symAMSb=\mathgroup5 +LaTeX Font Info: Redeclaring math symbol \hbar on input line 98. +LaTeX Font Info: Overwriting math alphabet `\mathfrak' in version `bold' +(Font) U/euf/m/n --> U/euf/b/n on input line 106. +)) +(/usr/share/texlive/texmf-dist/tex/latex/geometry/geometry.sty +Package: geometry 2020/01/02 v5.9 Page Geometry + +(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty +Package: keyval 2022/05/29 v1.15 key=value parser (DPC) +\KV@toks@=\toks21 +) +(/usr/share/texlive/texmf-dist/tex/generic/iftex/ifvtex.sty +Package: ifvtex 2019/10/25 v1.7 ifvtex legacy package. Use iftex instead. + +(/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty +Package: iftex 2022/02/03 v1.0f TeX engine tests +)) +\Gm@cnth=\count271 +\Gm@cntv=\count272 +\c@Gm@tempcnt=\count273 +\Gm@bindingoffset=\dimen150 +\Gm@wd@mp=\dimen151 +\Gm@odd@mp=\dimen152 +\Gm@even@mp=\dimen153 +\Gm@layoutwidth=\dimen154 +\Gm@layoutheight=\dimen155 +\Gm@layouthoffset=\dimen156 +\Gm@layoutvoffset=\dimen157 +\Gm@dimlist=\toks22 +) +(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdftex.def +File: l3backend-pdftex.def 2023-01-16 L3 backend support: PDF output (pdfTeX) +\l__color_backend_stack_int=\count274 +\l__pdf_internal_box=\box53 +) +No file PricePrediction.aux. +\openout1 = `PricePrediction.aux'. + +LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 11. +LaTeX Font Info: ... okay on input line 11. +*geometry* driver: auto-detecting +*geometry* detected driver: pdftex +*geometry* verbose mode - [ preamble ] result: +* driver: pdftex +* paper: a4paper +* layout: +* layoutoffset:(h,v)=(0.0pt,0.0pt) +* modes: +* h-part:(L,W,R)=(72.26999pt, 452.9679pt, 72.26999pt) +* v-part:(T,H,B)=(72.26999pt, 700.50687pt, 72.26999pt) +* \paperwidth=597.50787pt +* \paperheight=845.04684pt +* \textwidth=452.9679pt +* \textheight=700.50687pt +* \oddsidemargin=0.0pt +* \evensidemargin=0.0pt +* \topmargin=-37.0pt +* \headheight=12.0pt +* \headsep=25.0pt +* \topskip=12.0pt +* \footskip=30.0pt +* \marginparwidth=44.0pt +* \marginparsep=10.0pt +* \columnsep=10.0pt +* \skip\footins=10.8pt plus 4.0pt minus 2.0pt +* \hoffset=0.0pt +* \voffset=0.0pt +* \mag=1000 +* \@twocolumnfalse +* \@twosidefalse +* \@mparswitchfalse +* \@reversemarginfalse +* (1in=72.27pt=25.4mm, 1cm=28.453pt) + +LaTeX Font Info: Trying to load font information for U+msa on input line 13. + +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsa.fd +File: umsa.fd 2013/01/14 v3.01 AMS symbols A +) +LaTeX Font Info: Trying to load font information for U+msb on input line 13. + + +(/usr/share/texlive/texmf-dist/tex/latex/amsfonts/umsb.fd +File: umsb.fd 2013/01/14 v3.01 AMS symbols B +) [1 + +{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] [2] [3] (./PricePrediction +.aux) ) +Here is how much of TeX's memory you used: + 2318 strings out of 477975 + 34159 string characters out of 5839280 + 1859330 words of memory out of 5000000 + 22480 multiletter control sequences out of 15000+600000 + 521080 words of font info for 66 fonts, out of 8000000 for 9000 + 59 hyphenation exceptions out of 8191 + 57i,7n,62p,231b,212s stack positions out of 10000i,1000n,20000p,200000b,200000s + +Output written on PricePrediction.pdf (3 pages, 128660 bytes). +PDF statistics: + 74 PDF objects out of 1000 (max. 8388607) + 45 compressed objects within 1 object stream + 0 named destinations out of 1000 (max. 500000) + 1 words of extra memory for PDF output out of 10000 (max. 10000000) + diff --git a/docs/ManPages/PricePrediction.pdf b/docs/ManPages/PricePrediction.pdf new file mode 100644 index 0000000..05ad343 Binary files /dev/null and b/docs/ManPages/PricePrediction.pdf differ diff --git a/docs/ManPages/PricePrediction.tex b/docs/ManPages/PricePrediction.tex new file mode 100644 index 0000000..cd7b899 --- /dev/null +++ b/docs/ManPages/PricePrediction.tex @@ -0,0 +1,145 @@ +\documentclass[12pt]{article} +\usepackage{amsmath} +\usepackage{amssymb} +\usepackage{geometry} +\geometry{a4paper, margin=1in} + +\title{LSTM Model and Stock Price Prediction} +\author{} +\date{} + +\begin{document} + +\maketitle + +\section*{Stock Price Equation} + +The price of a stock \( P(t) \) at discrete time \( t \in \{t_1, t_2, t_3, \ldots\} \) is given by: + +\[ +P(t) = P(t-1) + F_{\text{macro}}(t) + F_{\text{micro}}(t) + F_{\text{technical}}(t) + F_{\text{noise}}(t) +\] + +\begin{itemize} + \item \( P(t-1) \): Price of the stock at the previous time step. + \item \( F_{\text{macro}}(t) \): Macro-level influences. + \item \( F_{\text{micro}}(t) \): Micro-level influences. + \item \( F_{\text{technical}}(t) \): Technical analysis factors. + \item \( F_{\text{noise}}(t) \): Stochastic noise term. +\end{itemize} + +\subsection*{Macro Influences} + +\[ +F_{\text{macro}}(t) = \alpha_1 G(t) + \alpha_2 I(t) + \alpha_3 R(t) +\] + +\begin{itemize} + \item \( \alpha_i \): Weights determining the strength of each factor. + \item \( G(t) \): GDP growth/market sentiment, modeled as: + \[ + G(t) = y \sin\left(\frac{2\pi t}{T_B}\right) + N_2 Z_2(t) + \] + \item \( I(t) \): Inflation rate, modeled as: + \[ + I(t) = \Theta e^{-\lambda_0 t} + N_2 Z_2(t) + \] + \item \( R(t) \): Risk-free interest rate: + \[ + R(t) = r_0 + N_3 Z_3(t) + \] +\end{itemize} + +\subsection*{Micro Influences} + +\[ +F_{\text{micro}}(t) = \beta_1 E(t) + \beta_2 S(t) + \beta_3 C(t) +\] + +\begin{itemize} + \item \( E(t) \): Earnings per share, \( E(t) = E_0 e^{\mu t} \left[1 + \sin\left(\frac{\pi t}{T_E}\right)\right] \) + \item \( S(t) \): Scale growth rates: + \[ + S(t) = \frac{\text{Max scale level}}{1 + e^{-K_0(t-t_0)}} + N_5 Z_5(t) + \] + \item \( C(t) \): Competition index: + \[ + C(t) = \frac{1}{t + \text{Season growth cycle}} + N_6 Z_6(t) + \] +\end{itemize} + +\subsection*{Technical Factors} + +\[ +F_{\text{technical}}(t) = \delta_1 M(t) + \delta_2 V(t) +\] + +\begin{itemize} + \item \( M(t) \): Momentum, \( M(t) = P(t+1) - P(t+5) \) + \item \( V(t) \): Volatility: + \[ + V(t) = \sqrt{\frac{1}{W} \sum_{i=1}^N [P(t-i) - \overline{P}(t)]^2} + \] + where \( \overline{P}(t) = \frac{1}{N} \sum_{i=1}^N P(t-i) \). +\end{itemize} + +\subsection*{Noise Term} + +\[ +F_{\text{noise}}(t) = \sigma Z(t) +\] + +\begin{itemize} + \item \( \sigma Z(t) \): Noise term, where \( Z(t) \sim N(0, 1) \). +\end{itemize} + +\section*{LSTM Architecture} + +\begin{enumerate} + \item Feature vector \( X(t) \): + \[ + X(t) = \begin{bmatrix} + P(t-2) \\ + P(t-1) \\ + P(t) \\ + G(t) \\ + E(t) \\ + S(t) \\ + C(t) \\ + M(t) \\ + V(t) + \end{bmatrix} + \] + \item LSTM components: + \[ + f(t) = \sigma(W_f X(t) + U_f h(t-1) + b_f) + \] + \[ + i(t) = \sigma(W_i X(t) + U_i h(t-1) + b_i) + \] + \[ + \tilde{C}(t) = \tanh(W_c X(t) + U_c h(t-1) + b_c) + \] + \[ + C(t) = f(t) \cdot C(t-1) + i(t) \cdot \tilde{C}(t) + \] + \[ + o(t) = \sigma(W_o X(t) + U_o h(t-1) + b_o) + \] + \[ + h(t) = o(t) \cdot \tanh(C(t)) + \] + +\end{enumerate} + +\section*{Loss Function} + +\[ +\text{MSE} = \frac{1}{T} \sum_{t=1}^T [P(t) - \hat{P}(t)]^2 +\] +\[ +\text{MAE} = \frac{1}{T} \sum_{t=1}^T |P(t) - \hat{P}(t)| +\] + +\end{document} +