## 3 Principles of Price Forecasting Combined with GAN
### Data Generation  
TimeGAN can generate time-series data that retain the intricate temporal dynamics inherent to the original data. It merges the adaptability of the unsupervised GAN framework with the controllability of supervised learning using autoregressive models. The TimeGAN model mainly encompasses four components--the Embedding Network, the Recovery Network, the Generator, and the Discriminator--as illustrated in Figure 2.  
The Embedding Network serves a crucial purpose, namely, establishing an invertible mapping between features and feature representations of the latent layer, which contributes to reducing the dimensionality of data in an adversarial learning space. The embedding function is shown in Equation (1):  
\[ \begin{cases}h_{\mathbf{S}}&=e_{\mathbf{S}}(s)\\ h_{t}&=e_{\mathbf{\chi}}(h_{\mathbf{S}},h_{t-1},x_{t})\end{cases} , \tag{1}\]  
where the feature spaces are denoted by \(\mathbf{S}\) and \(\mathbf{\chi}\), while the corresponding latent vector spaces are represented by \(H_{\mathbf{s}}\) and \(H_{\mathbf{\chi}}\) respectively. \(S\) represents the static features \(S\in\mathbf{S}\), whereas \(X,X\in\mathbf{\chi}\) indicate temporal features in the time-series. The tuples \((S,X_{1:T})\)  
Figure 1: Framework of price forecasting. conform to a certain joint distribution \(P\), where \(T\) is a random variable. Meanwhile, \(S,X\) are instantiated as \(s,x\), and the set \(X\) contains \(n\) feature vectors, where \(n\in(1\cdots N)\). Here, \(s\) represents the high-dimensional static eigenvectors of trading data, \(h_{s}\) indicates the mapped low-dimensional static eigenvectors, \(x_{t}\) represents the high-dimensional temporal eigenvectors at time \(t\), \(h_{t}\) represents the low-dimensional temporal eigenvectors at time \(t\), and \(e\) is the embedding function implemented via recurrent networks. The training data set is denoted as \(TR=\left\{\left(S,x_{1:T}^{n}\right)\right\}_{n=1}^{N}\). The recovery function reconstructs the original high-dimensional static and temporal features from the low-dimensional feature vectors of the data. The recovery function is represented as shown in Equation (2):  
\[ \begin{split}\tilde{s}&=r_{\mathbf{S}}(h_{\mathbf{s }})\\ \tilde{x}_{t}&=r_{\mathbf{\chi}}(h_{t})\end{split} \, \tag{2}\]  
where \(r_{\mathbf{s}}\) and \(r_{\mathbf{\chi}}\) serve as the recovery Embedding Networks for the static and temporal embeddings, respectively; \(\tilde{s}\) represents the recovered high-dimensional static feature vector; and \(\tilde{x}_{t}\) represents the recovered high-dimensional temporal feature vector at time \(t\). The loss function for the embedding and recovery functions during the construction of the low-dimensional feature space for the data and recovery of the high-dimensional feature space is shown in Equation (3):  
\[L_{ER}=\mathbb{E}_{s,x_{1:T}\sim p}\left[\left\|s-\tilde{s}\right\|_{2}+\sum_{ t}\left\|x_{t}-\tilde{x}_{t}\right\|_{2}\right]. \tag{3}\]  
The output results of the Generator, along with the low-dimensional feature vectors from the embedded functions, are inputted into the Discriminator through joint encoding, as illustrated in Equation (4). For the purpose of generating data, it is necessary to enter the output of the Generator into the Discriminator. We have  
\[ \begin{split}\hat{h}_{\mathbf{s}}=g_{\mathbf{s}}(\,z_{s})\\ \hat{h}_{t}=g_{\mathbf{\chi}}\left(\hat{h}_{\mathbf{s}},\hat{h}_{t-1},z_{t}\right),\end{split}  \tag{4}\]  
where \(Z_{\mathbf{s}}\) and \(Z_{\mathbf{\chi}}\) represent the static and temporal vector spaces for known distributions, respectively; \(z_{s}\in Z_{\mathbf{S}}\) and \(z_{t}\in Z_{\mathbf{\chi}}\) are random noise, where \(z_{s}\) is sampled from a Gaussian distribution and \(z_{t}\) follows the Wiener process; \(\hat{h}_{\mathbf{s}}\) and \(\hat{h}_{t}\) denote the generated static feature vectors and temporal feature vectors, respectively; and \(g\) is a generating function.