Method for realizing exchange rate prediction profit maximization based on hybrid prediction model
By adopting a hybrid prediction model in exchange rate prediction, combining long and short-term memory networks, convolutional neural networks and fully connected neural networks, and introducing attention mechanisms and adversarial training mechanisms, the problems of poor adaptability and insufficient data utilization of single models of exchange rate prediction methods in the existing technology are solved, and higher precision and adaptable exchange rate prediction are achieved.
Patent Information
- Application Number
- CN202510067134.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-16
- Publication Date
- 2025-05-13
AI Technical Summary
The existing exchange rate prediction methods have problems such as poor adaptability of a single model, insufficient data utilization, and unreasonable feature extraction and model construction, and it is difficult to provide high-precision predictions in the complex and changeable exchange rate market.
A method based on a hybrid prediction model is adopted, combining long and short-term memory networks, convolutional neural networks and fully connected neural networks, and an attention mechanism and adversarial training mechanism are introduced to construct a comprehensive feature set for prediction.
It significantly improves the accuracy and adaptability of exchange rate prediction, can more effectively integrate multi-source data, deeply explore exchange rate change characteristics, thereby providing enterprises and investors with a reliable profit maximization strategy.
Smart Images

Figure CN119991289A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of financial data analysis, and in particular to a method for maximizing exchange rate prediction profits based on a hybrid prediction model. Background Art
[0002] In the global economic environment, exchange rate fluctuations have a vital impact on multinational companies, import and export trade, financial investment and other fields. Accurately predicting exchange rate trends can help companies and investors make reasonable decisions and maximize profits. However, traditional exchange rate forecasting methods often have many limitations.
[0003] For example, the prior art with patent number CN202410457757.7 discloses a method, device, storage medium and electronic device for predicting the exchange rate of foreign exchange settlement and sale. The patent uses the Transformer model to predict the exchange rate of foreign exchange settlement and sale. The Transformer model is a single model with certain limitations in data utilization and model adaptability. Although it can capture the linear trend of exchange rate data to a certain extent, it is difficult to effectively capture the complex nonlinear characteristics in the exchange rate market, such as exchange rate jumps and the impact of complex interactions between macroeconomic indicators on exchange rates. Because it only relies on historical exchange rate data itself and ignores rich external correlation information, the prediction accuracy is greatly reduced when facing the complex and changeable actual exchange rate market, and it cannot accurately reflect the real trend of the exchange rate, which makes the decisions made by enterprises and investors based on the prediction often deviate from the optimal solution, seriously affecting profit acquisition.
[0004] For example, the technical solution with patent number CN202410994019.6 discloses a foreign exchange market risk quantification and early warning method based on the long short-term memory model, which predicts the exchange rate by establishing an LSTM model. However, in reality, the economic systems of various countries are interrelated and complex, and the fluctuation of exchange rates is not simply determined by a few macroeconomic indicators. Moreover, when encountering situations such as the signing or tearing up of major trade agreements, this method is completely unable to predict the impact on the exchange rate, resulting in a huge deviation between the predicted results and the actual exchange rate trend. The import and export strategies and investment layouts made by enterprises and investors based on this are very likely to fall into a loss dilemma.
[0005] For example, the existing patent with patent number CN202310007920.5 discloses an exchange rate prediction method and device, which uses simple neural network technology. It has poor adaptive learning ability for input sequences of different lengths and cannot fully explore the long-term and short-term dependencies in the exchange rate data, resulting in poor quality of model input data, further restricting the prediction accuracy, and it is difficult to meet the urgent needs of enterprises and investors for accurate exchange rate predictions to maximize profits in actual operations.
[0006] In summary, the existing exchange rate forecasting methods have problems such as poor adaptability of a single model, insufficient data utilization, unreasonable feature extraction and model construction, and so on. There is an urgent need for an innovative and high-precision exchange rate forecasting method that can integrate multi-source data, use an advanced hybrid forecasting model architecture, and deeply explore the characteristics of exchange rate changes, thereby providing companies and investors with reliable exchange rate forecasts and helping them formulate accurate profit maximization strategies. Summary of the invention
[0007] The purpose of this application is to provide a method for maximizing exchange rate forecasting profits based on a hybrid forecasting model to solve the technical problems raised in the above background.
[0008] To achieve the above purpose, the present application discloses the following technical solution: a method for maximizing exchange rate forecasting profit based on a hybrid forecasting model, the method comprising the following steps:
[0009] Data collection: Based on big data, historical exchange rate data, macroeconomic indicator data and market emergency event-related data are collected from financial data sources. The time span of the historical exchange rate data is no less than ten years. The macroeconomic indicator data includes the country's GDP growth rate, inflation rate and interest rate. The market emergency event-related data includes the time of event occurrence, event type and impact rating;
[0010] Data preprocessing: Clean the collected data, remove data with missing values exceeding the set threshold, and use linear interpolation to supplement the missing values; adopt the 3σ principle based on statistical distribution, regard data that deviates from the mean by 3 times the standard deviation as outliers, and correct the local trend of the data time series corresponding to the outliers; standardize different types of data to make the characteristics of each data in the same dimension;
[0011] Feature engineering processing: extract the principal components from the pre-processed macroeconomic indicator data, use the principal component analysis algorithm, and retain the principal components whose cumulative contribution rate reaches the set proportion as the key economic features; quantify and encode the data related to market emergencies, assign scores according to the event type and impact rating, and construct market event feature vectors; decompose the historical exchange rate data into trend items, cycle items and random items according to the time series, and extract trend features and cycle features respectively; combine the trend features, the cycle features, the key economic features, and the market event feature vectors to form a comprehensive feature set;
[0012] Model construction: Construct a hybrid forecasting model. The bottom layer of the hybrid forecasting model is composed of a long short-term memory network and a convolutional neural network in parallel. The long short-term memory network is used to capture the time series dependency of exchange rate data. The number of neurons in the hidden layer of the long short-term memory network is adaptively adjusted according to the length of the input sequence. The adjustment formula is: NLSTM =log2(L)+k, where N LSTM is the number of neurons, L is the input sequence date, and k is an empirical constant; the convolutional neural network is used to extract local features of exchange rate data, and the convolution kernel size of the convolutional neural network adopts a combination of multiple sizes, the step size is 1, and the filling method is the same; the top layer of the hybrid prediction model adopts a fully connected neural network to fuse the outputs of the long short-term memory network and the convolutional neural network and further learn features, the number of layers of the fully connected neural network is 2, the number of neurons in each layer gradually decreases, and ReLU is used as the activation function;
[0013] Model training: the comprehensive feature set is divided into a training set, a validation set and a test set in chronological order; the hybrid prediction model is trained using the training set, and an adaptive learning rate strategy is adopted. The initial learning rate is set to lr0. After each RND training round, according to the change of the loss value of the hybrid prediction model on the validation set, if the loss value does not decrease for two consecutive rounds, the learning rate of the next training round is Among them, lr0∈lr old ; The mean square error is used as the loss function during the training process, and the training termination condition is that the loss value of the hybrid prediction model on the validation set converges or reaches the maximum training round;
[0014] Model evaluation: Use the test set to evaluate the performance of the trained hybrid prediction model, and use multiple evaluation indicators to determine whether the model performance meets the preset requirements. If not, adjust the model hyperparameters and retrain. The evaluation indicators include root mean square error, mean absolute error, and determination coefficient.
[0015] Exchange rate prediction: the newly collected real-time data is input into the trained hybrid prediction model after the data preprocessing and feature engineering processing to obtain a sequence of exchange rate prediction values in the future;
[0016] Strategy formulation: Based on the exchange rate forecast value sequence corresponding to the predicted exchange rate trend, combined with the current asset allocation, cost structure and risk tolerance of the enterprise or investor, and introducing a risk-return assessment model to comprehensively consider potential returns and risk losses, formulate a profit maximization strategy;
[0017] Transaction execution: According to the formulated strategy, real-time trading operations are carried out in the financial market through the automated trading system; during the transaction execution process, market feedback information is continuously collected. If there are sudden major changes in the market, the emergency adjustment mechanism is triggered to suspend or adjust the current trading strategy to ensure the safety of funds;
[0018] Profit calculation and optimization: After each trading cycle, the actual profit situation is calculated, the predicted profit is compared with the actual profit, and the cause of the error is analyzed; according to market changes and model performance monitoring, the hybrid forecasting model and profit maximization strategy are regularly optimized and updated. The optimization process includes one or more of re-collecting data, adjusting model structure or parameters, and improving strategy rules.
[0019] Preferably, in the data collection, the financial data sources include databases of internationally renowned financial information institutions, official websites of central banks of various countries, and market data interfaces of major global stock exchanges. The collected data is stored in a distributed file system and backed up using a redundant backup mechanism.
[0020] Preferably, in the data preprocessing, complex missing values that cannot be supplemented by linear interpolation are repaired by combining a seasonal adjustment method based on time series decomposition. The seasonal adjustment method is: first separate the seasonal components, and then use the mean of the same season data in adjacent periods to fill the missing values.
[0021] Preferably, in the feature engineering process, an autoencoder model is used to perform dimensionality reduction processing on the market event feature vector, so as to compress the high-dimensional feature vector into a low-dimensional hidden layer representation.
[0022] Preferably, in the model construction, an attention mechanism module is added between the bottom layer and the top layer of the hybrid prediction model, and the attention mechanism module is used to dynamically allocate weights according to the importance of the input features. The formula of the attention mechanism adopted by the attention mechanism module is:
[0023]
[0024] Among them, Q is the query matrix, K is the key matrix, V is the value matrix, and d k is the dimension of the key, K T is the transpose of the key matrix.
[0025] Preferably, in the model training, an adversarial training mechanism is also introduced, wherein the adversarial training mechanism is to construct a discriminator based on the hybrid prediction model to perform adversarial game, wherein the adversarial game is used to enable the hybrid prediction model to generate prediction results that are difficult to be distinguished by the discriminator during training, and the loss function L of the adversarial training mechanism is total Obtained by the following formula:
[0026] L total =w g *L g +w d *L d
[0027] Among them, Lg is the generator loss, w g is the generator loss weight, L d is the discriminator loss, w d is the discriminator loss weight.
[0028] Preferably, in the strategy formulation, the risk-return assessment model adopts a multi-objective optimization algorithm, and the function of the multi-objective optimization algorithm is:
[0029]
[0030] Among them, x is the strategy variable, μ(x) is the expected return, λ is the risk aversion coefficient, α is the confidence level, CvaR α (x) is the conditional value at risk.
[0031] Preferably, during the execution of the transaction, the automated trading system adopts a microservice architecture, splits the functional modules corresponding to transaction orders, market monitoring, and order management into independent microservices, and performs data interaction through a lightweight communication protocol.
[0032] Preferably, in the profit accounting and optimization, a machine learning algorithm is used to automatically classify and analyze the causes of errors.
[0033] Preferably, the method further comprises: building a visual monitoring platform, wherein the visual monitoring platform is used to display data collection status, model training progress, exchange rate forecast trends, strategy execution effects and profit accounting results in real time.
[0034] Beneficial effects: The method of realizing profit maximization of exchange rate forecasting based on hybrid forecasting model in this application overcomes the defects of traditional exchange rate forecasting methods through a series of steps such as multi-source data collection, fine preprocessing, innovative feature engineering, hybrid model construction and training, intelligent strategy formulation and real-time optimization. Compared with the existing technology, it can more accurately predict exchange rate trends, provide enterprises and investors with highly adapted profit maximization strategies, and significantly improve economic benefits and risk response capabilities in the complex and changing international financial market environment, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0036] Figure 1A flow chart of a method for maximizing exchange rate forecasting profits based on a hybrid forecasting model provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.
[0038] In this article, the term "comprising" is intended to cover non-exclusive inclusion, so that a process, method, article or device that includes a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of more restrictions, the elements defined by the sentence "comprising..." do not exclude the presence of other identical elements in the process, method, article or device that includes the elements.
[0039] This embodiment discloses a Figure 1 The method for maximizing exchange rate prediction profits based on a hybrid prediction model shown in the figure includes the following steps: S1-data collection, S2-data preprocessing, S3-feature engineering processing, S4-model construction, S5-model training, S6-model evaluation, S7-exchange rate prediction, S8-strategy formulation, S9-transaction execution and S10-profit accounting and optimization.
[0040] Below, this method is introduced in detail in combination with the specific content of each step, mainly taking medium-sized enterprises that import raw materials from abroad, process and export finished products, and engage in international trade as the application objects.
[0041] S1-Data Collection: Based on big data, historical exchange rate data, macroeconomic indicator data and market emergency data are collected from financial data sources. The time span of historical exchange rate data is no less than ten years. Macroeconomic indicator data include national GDP growth rate, inflation rate and interest rate. Market emergency data include event time, event type and impact rating. In particular, financial data sources include databases of internationally renowned financial information institutions, official websites of central banks of various countries and market data interfaces of global mainstream stock exchanges. The collected data is stored in a distributed file system and backed up using a redundant backup mechanism.
[0042] Based on the application object, in terms of data collection, a stable data transmission channel is built from the Bloomberg database, the Federal Reserve's official website, and the New York Stock Exchange quotation interface. For historical exchange rate data, the time span is accurately set to nearly 15 years to ensure that it covers multiple economic cycle fluctuations to capture the changing patterns of exchange rates under different market environments. In terms of macroeconomic indicator data, not only the GDP growth rate, inflation rate, and interest rate data of the United States and major trading partners are collected, but also auxiliary indicators such as employment data and industrial production index are expanded to deeply explore economic fundamentals information. The collection of international market event data is particularly detailed. For trade frictions, detailed records are recorded for the product categories involved, the extent of tariff adjustments, and the implementation time. Based on the evaluation of professional analysts, various market events are marked with precise impact ratings, quantifying their potential impact on the exchange rate market from 1 to 5. The collection frequency is strictly implemented on a daily basis, and a real-time early warning linkage is established with news and information agencies. Once there is a major economic policy adjustment or sudden market event, such as an emergency interest rate cut by the central bank, an additional 3 to 5 collection moments will be added on the day of the event to accurately capture the market's immediate reaction. The collected data is stored in a distributed file system based on Hadoop, and the advanced Reed-So lomon encoding algorithm is used to achieve triple redundant backup to ensure data reliability. Even if some storage nodes fail, the data integrity will not be affected in the slightest.
[0043] S2-Data preprocessing: Clean the collected data, remove the data with missing values exceeding the set threshold, and use linear interpolation to supplement the missing values; adopt the 3σ principle based on statistical distribution, regard the data that deviates from the mean by 3 times the standard deviation as outliers, and correct the local trend of the data time series corresponding to the outliers; standardize different types of data to make various data features in the same dimension. The formula for standardization is Among them, X std is the standardized value, X is the original value, is the mean, σ is the standard deviation.
[0044] Among them, complex missing values that cannot be supplemented by linear interpolation are repaired by combining a seasonal adjustment method based on time series decomposition. The seasonal adjustment method is: first separate the seasonal component, and then use the mean of the same season data in adjacent periods to fill the missing values. Specifically, an exemplary seasonal adjustment method is:
[0045] First, we use time series decomposition techniques, such as the classic additive model or multiplicative model, to decompose the data series containing missing values (taking historical exchange rate data as an example) into trend terms T t , Seasonal ItemS t and the residual term R t For example, for the time series Y t , under the additive model, we have Yt =T t +S t +R t , and Y in the multiplicative model t =T t *S t *R t Here, professional time series analysis algorithms, such as the moving average method and the X-11 algorithm, are used to accurately separate the seasonal component S t .
[0046] Next, determine the seasonal period in which the missing value is located. For example, if the data is collected on a quarterly basis, and the data at the end of a quarter is missing, then determine the seasonal period to which it belongs. Then, find the data of the same season in the adjacent period, that is, refer to the data at the end of the same quarter in the past few years. Assuming that the missing data is the exchange rate data at the end of the fourth quarter of the nth year, collect the exchange rate data at the end of the fourth quarter of the n-1th year, the n-2th year, and so on.
[0047] After that, the mean of these adjacent period and season data is calculated. Suppose the collected m adjacent period and season data are x1, x2, x3, ... x m , then calculate the mean Finally, the mean x is filled into the missing value position to complete the repair of complex missing values, ensuring the temporal and logical continuity of the data sequence, providing a complete and reliable data basis for subsequent model training, and enabling the model to accurately capture the characteristics of exchange rate changes based on high-quality data, thereby improving the accuracy of overall forecasting and profit maximization strategy formulation.
[0048] Based on the application object, in the data preprocessing step, the data cleaning tool is used to remove nearly 2% of the records with a large number of missing values that cannot be supplemented by reasonable speculation through multiple rounds of data quality screening. For a small number of missing values, linear interpolation combined with seasonal adjustment is used for repair. Taking the missing exchange rate data at the end of a quarter as an example, the time series decomposition technology is first used to decompose the historical exchange rate data into trend, season, and residual components, and the seasonal components are accurately separated. Referring to the seasonal fluctuation law of the data at the end of the same quarter in adjacent years, combined with the exchange rate trend of the current quarter, the weighted average algorithm is used to adjust and supplement the missing values to ensure the consistency and rationality of the data. After the outliers are corrected according to the 3σ principle, the Z-score standardization method is used to normalize all types of data to a standard normal distribution interval with a mean of 0 and a standard deviation of 1, laying a solid foundation for subsequent model training.
[0049] S3-Feature Engineering Processing: Extract the principal components from the pre-processed macroeconomic indicator data, use the principal component analysis algorithm, and retain the principal components whose cumulative contribution rate reaches the set ratio as the key economic features; quantify and encode the data related to market emergencies, assign scores according to the event type and impact rating, and construct the market event feature vector; decompose the historical exchange rate data into trend items, cycle items and random items according to the time series, and extract trend features and cycle features respectively; combine trend features, cycle features, key economic features, and market event feature vectors to form a comprehensive feature set. In particular, in the feature engineering process, the autoencoder model is used to reduce the dimensionality of the market event feature vector, compress the high-dimensional feature vector into a low-dimensional hidden layer representation, reduce the amount of calculation while retaining the main information, and improve the efficiency of subsequent model operation.
[0050] Based on the application object, in the feature engineering stage, the PCA algorithm in Python's Scikit-learn library is used to extract the principal components of macroeconomic indicator data. Through repeated tests, the components with a cumulative contribution rate of 87% are determined as key economic features, which effectively reduces the data dimension and reduces the model calculation burden. The data related to market emergencies are quantified and encoded, and the market event feature vector is constructed. The autoencoder (AE) model based on deep learning is introduced, and the network structure of the encoder and decoder is carefully designed. The encoder compresses the high-dimensional market event feature vector into a low-dimensional hidden layer representation. The decoder is used to verify the information loss during the compression process. The model parameters are continuously optimized through back propagation, while retaining the main information. The amount of calculation is reduced, and the subsequent model operation efficiency is improved. Subsequently, the exchange rate data is decomposed to obtain trend and cycle characteristics, which are combined with key economic characteristics and the reduced-dimensional market event feature vector through feature splicing technology to form a comprehensive feature set.
[0051] S4-Model construction: Construct a hybrid prediction model. The bottom layer of the hybrid prediction model is composed of a long short-term memory network LSTM and a convolutional neural network CNN in parallel. The long short-term memory network is used to capture the time series dependency of the exchange rate data. The number of neurons in the hidden layer of the long short-term memory network is adaptively adjusted according to the length of the input sequence. The adjustment formula is: N LSTM =log2(L)+k, where N LSTMis the number of neurons, L is the input sequence date, and k is an empirical constant; the convolutional neural network is used to extract local features of the exchange rate data. The convolution kernel size of the convolutional neural network uses a combination of multiple sizes, with a step size of 1 and the same filling method; the top layer of the hybrid prediction model uses a fully connected neural network FCN to fuse the outputs of the long short-term memory network and the convolutional neural network and further learn features. The number of layers of the fully connected neural network is 2, and the number of neurons in each layer gradually decreases. ReLU is used as the activation function. In particular, an attention mechanism module is added between the bottom and top layers of the hybrid prediction model. The attention mechanism module is used to dynamically assign weights according to the importance of the input features. The attention mechanism formula used by the attention mechanism module is:
[0052]
[0053] Among them, Q is the query matrix, K is the key matrix, V is the value matrix, and d k is the dimension of the key, K T is the transpose of the key matrix.
[0054] Based on the application object, when building the model, the underlying LSTM and CNN parallel structure is built based on the TensorFlow framework. For LSTM, according to the input sequence length, according to the formula N LSTM =log2(L)+k (where the empirical constant k is set to 5 based on multiple experiments) to accurately calculate the number of neurons in the hidden layer to ensure that it can fully capture the time series dependency of the exchange rate data. For the CNN part, a combination of two sizes of convolution kernels, 3×3 and 5×5, is used. The step size is fixed to 1, and the filling method is the same. Through parallel convolution operations of convolution kernels of different sizes, the local features of the exchange rate data are extracted in all directions. An attention mechanism module is added between the LSTM and CNN parallel structure and the top 2-layer FCN to dynamically assign weights based on the importance of the input features. The generation of query, key, and value matrices is based on the linear transformation of the features, and the softmax function is combined with the scaling factor. (d k The attention weights are calculated based on the feature dimensions to make the model more focused on key feature information and improve prediction accuracy. The number of neurons in each layer of the top FCN gradually decreases, ReLU is used as the activation function, and batch normalization is introduced to accelerate model convergence and prevent gradient disappearance or explosion.
[0055] S5-Model training: The comprehensive feature set is divided into training set, validation set and test set in chronological order; the hybrid prediction model is trained with the training set, and an adaptive learning rate strategy is adopted. The initial learning rate is set to lr0. After each RND training round, according to the change of the loss value of the hybrid prediction model on the validation set, if the loss value does not decrease for two consecutive rounds, the learning rate of the next training round is Among them, lr0∈lr old ; The mean square error is used as the loss function during the training process, and the training termination condition is that the loss value of the hybrid prediction model on the validation set converges or reaches the maximum training round. In particular, in the model training, it also includes the introduction of an adversarial training mechanism. The adversarial training mechanism is to build a discriminator based on the hybrid prediction model for adversarial game. The adversarial game is used to make the hybrid prediction model generate prediction results that are difficult for the discriminator to distinguish during training. The loss function L of the adversarial training mechanism total Obtained by the following formula:
[0056] L total =w g *L g +w d *L d
[0057] Among them, L g is the generator loss, the generator is a hybrid prediction model responsible for generating prediction results, w g is the generator loss weight, L d is the discriminator loss, w d is the discriminator loss weight. The goal of the discriminator is to distinguish as much as possible between real data (such as historical exchange rate data and its corresponding real labels) and "pseudo data" generated by the generator (model prediction results disguised as samples similar to real data). It improves the discrimination ability by minimizing the discrimination error, which is the discriminator loss. In this way, when back-propagating to update the model parameters, according to this total loss function, the parameters of the model (including the generator and discriminator parts) will be optimized in the direction of minimizing the overall loss, and ultimately improve the generalization ability of the model, so that it can better cope with complex and changeable exchange rate market data, give more accurate exchange rate prediction results, and provide strong support for the realization of profit maximization strategy. Through the loss function design under this adversarial training mechanism, compared with the traditional method that only relies on a single model and a simple loss function, it can dig out deeper features of the data, enhance the adaptability of the model to different market conditions, and thus improve the performance of the entire exchange rate prediction system.
[0058] Based on the application object, in the model training stage, the comprehensive feature set is divided into training set, validation set and test set in a ratio of 7:2:1 using Python's Keras library. The initial learning rate is set to 0.01. After every 5 rounds of training, based on the change in the mean square error loss value on the validation set, if the loss does not decrease for 2 consecutive rounds, an exponential decay strategy is adopted, and the learning rate decays to half of the original value, that is, The training process uses MSE as the loss function, and the formula is: Where n is the number of samples, y i is the true value, The Adam optimizer is used to iteratively update the model parameters to predict the value. The training termination condition is that the loss value of the model on the validation set converges (the change in the loss value for 10 consecutive rounds is less than the set threshold of 0.001) or the maximum number of training rounds is 100.
[0059] S6-Model evaluation: Use the test set to evaluate the performance of the trained hybrid prediction model, and use multiple evaluation indicators to determine whether the model performance meets the preset requirements. If not, adjust the model hyperparameters and retrain. The evaluation indicators include root mean square error, mean absolute error and determination coefficient.
[0060] Based on the application object, in the model evaluation stage, the test set evaluation uses multiple evaluation indicators, including the root mean square error RMSE, which is used to measure the average deviation between the predicted value and the true value, the mean absolute error MAE, which directly reflects the average absolute value of the prediction error, and the determination coefficient R, which is used to evaluate the goodness of fit of the model to the data. 2 . According to the evaluation indicators, it is judged whether the model performance meets the preset requirements (such as RMSE is less than the set threshold of 0.05, R 2 If it is not reached, the model hyperparameters such as the number of neurons in the LSTM hidden layer, the size of the CNN convolution kernel, the number of FCN layers and neurons are fine-tuned and retrained.
[0061] When the model evaluation meets the criteria, the exchange rate forecast is performed.
[0062] S7-Exchange rate prediction: The latest real-time data collected is input into the trained hybrid prediction model after data preprocessing and feature engineering, and a sequence of exchange rate prediction values for the future time is obtained.
[0063] S8-Strategy formulation: Based on the exchange rate forecast value sequence corresponding to the forecasted exchange rate trend, combined with the current asset allocation, cost structure and risk tolerance of the enterprise or investor, and introducing a risk-return assessment model to comprehensively consider potential returns and risk losses, formulate a profit maximization strategy; among them, for import and export companies, if the exchange rate is predicted to rise, the import volume of raw materials will be increased in advance when the cost is controllable; if the exchange rate is predicted to fall, imports will be controlled and finished product exports will be accelerated; for financial investors, if the exchange rate is predicted to fluctuate greatly and have an upward trend, foreign exchange long positions will be increased, and a certain proportion of hedging tools will be configured at the same time. The risk-return assessment model is introduced in the strategy formulation process to comprehensively consider potential returns and risk losses to ensure the robustness of the strategy.
[0064] In particular, in strategy formulation, the risk-return assessment model adopts a multi-objective optimization algorithm based on conditional value at risk to maximize expected returns and minimize CVaR at the same time under a given confidence level.
[0065] The function of the multi-objective optimization algorithm is:
[0066]
[0067] Among them, x is the strategy variable, μ(x) is the expected return, λ is the risk aversion coefficient, α is the confidence level, CvaR α (x) is the conditional value at risk.
[0068] Based on the application object, in the strategy formulation stage, the latest collected real-time data is input into the trained hybrid model after preprocessing and feature engineering, and a sequence of exchange rate forecast values for the next week with daily intervals is obtained. According to the forecast, if the company sees an upward trend in the exchange rate, it will increase the import volume of raw materials in advance while ensuring that the cost is controllable, taking into account factors such as raw material inventory costs, transportation cycles and capital turnover, and formulate strategies using a risk-return model based on CVaR. The model accurately calibrates the risk aversion coefficient λ based on the company's historical transaction data, financial statements and market risk preference questionnaires. At a given confidence level (such as 95%), it solves the optimization objective function Formulate the best strategies for raw material procurement, product pricing and foreign exchange hedging. Use the real-time market data interface in transactions to update market information every second, monitor the market, and in case of emergencies, such as sudden major natural disasters that cause panic in the global financial market, trigger the emergency adjustment mechanism, suspend or adjust the current trading strategy according to the preset risk threshold and emergency plan to ensure the safety of funds.
[0069] S9-Trading Execution: According to the formulated strategy, real-time trading operations are carried out in the financial market through the automated trading system. The trading system has the functions of real-time monitoring of market conditions, quick order placement and order management to ensure that the strategy can be executed in a timely and accurate manner; during the trading execution process, market feedback information is continuously collected. If there are sudden major changes in the market, the emergency adjustment mechanism is triggered to suspend or adjust the current trading strategy to ensure the safety of funds. In particular, during the trading execution, the automated trading system adopts a microservice architecture, splits the functional modules corresponding to trading orders, market monitoring, and order management into independent microservices, and interacts with data through lightweight communication protocols to improve the scalability and fault tolerance of the system and ensure efficient and stable execution of transactions. Through the execution of the automated trading system based on the microservice architecture, the trading system splits the functional modules such as trading orders, market monitoring, and order management into independent microservices, and interacts using the gRPC lightweight communication protocol to achieve efficient asynchronous communication and load balancing, ensuring efficient and stable execution of transactions.
[0070] S10- Profit accounting and optimization: After each trading cycle, the actual profit situation is calculated, the predicted profit is compared with the actual profit, and the cause of the error is analyzed; according to market changes and model performance monitoring, the hybrid forecasting model and profit maximization strategy are optimized and updated regularly, wherein the optimization process includes one or more of re-collecting data, adjusting the model structure or parameters, and improving the strategy rules. In profit accounting and optimization, machine learning algorithms are used to automatically classify and analyze the causes of errors, such as building an error analysis model based on a decision tree algorithm (which can be any of the existing technologies), quickly locating profit errors caused by factors such as model prediction deviations, market anomalies, or improper strategy execution, and targeted optimization and improvement. It is feasible that this method also includes: building a visual monitoring platform, which is used to display data collection, model training progress, exchange rate forecast trends, strategy execution effects, and profit accounting results in real time.
[0071] Based on the application object, in the profit accounting and optimization stage, the profit is calculated monthly, and the actual profit data is obtained through accurate reconciliation of the financial system and transaction records. The predicted profit is compared with the actual profit. The error analysis model built based on the decision tree algorithm is used to deeply analyze the cause of the error from multiple dimensions such as model prediction deviation, market sudden abnormality, and improper strategy execution. If the error is caused by model prediction deviation, further trace the model training data, hyperparameter settings and special engineering links, and optimize them in a targeted manner; if it is caused by market sudden abnormalities, such as policy mutations or black swan events, the market event feature library and economic indicator weights are updated in a timely manner; if the strategy is improperly executed, the order execution logic and risk control parameters of the trading system are optimized, and the model and strategy are updated. The visual monitoring platform developed internally by the enterprise displays the data collection situation, model training progress, exchange rate forecast trend, strategy execution effect and profit accounting results in real time throughout the process, providing operators with intuitive and comprehensive information, facilitating timely discovery of problems and adjustments and optimizations.
[0072] In summary, the method for maximizing exchange rate forecasting profits based on a hybrid forecasting model provided in this embodiment can effectively cope with complex exchange rate markets, and overcome the defects of traditional exchange rate forecasting methods through a series of steps such as multi-source data collection, fine preprocessing, innovative feature engineering, hybrid model construction and training, intelligent strategy formulation and real-time optimization. Compared with the existing technology, it can more accurately predict exchange rate trends, provide enterprises and investors with highly adapted profit maximization strategies, and significantly improve economic benefits and risk response capabilities in the complex and changing international financial market environment, and has broad application prospects.
[0073] In the embodiments provided in the present application, it should be understood that the embodiments described herein can be implemented in hardware, software, firmware, middleware, code or any other appropriate combination. For hardware implementation, the processor can be implemented in one or more of the following units: application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing device (DSPD), programmable logic device (PLD), field programmable gate array (FPGA), processor, controller, microcontroller, microprocessor, other electronic units designed to implement the functions described herein or their combination. For software implementation, part or all of the process of the embodiment can be completed by instructing the relevant hardware through a computer program. When implemented, the above program can be stored in a computer-readable storage medium or transmitted as one or more instructions or codes on a computer-readable storage medium. Computer-readable storage media include computer storage media and communication media, wherein the communication medium includes any medium that is convenient for transmitting a computer program from one place to another. The storage medium can be any available medium that a computer can access. The computer-readable storage medium can include, but is not limited to, RAM, ROM, EEPROM, CD-ROM or other optical disk storage, disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of an instruction or data structure and can be accessed by a computer.
[0074] Finally, it should be noted that the above is only a preferred embodiment of the present application and is not intended to limit the present application. Although the present application has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for maximizing exchange rate forecasting profits based on a hybrid forecasting model, characterized in that: The method comprises the following steps: Data collection: Based on big data, historical exchange rate data, macroeconomic indicator data and market emergency event-related data are collected from financial data sources. The time span of the historical exchange rate data is no less than ten years. The macroeconomic indicator data includes the country's GDP growth rate, inflation rate and interest rate. The market emergency event-related data includes the time of event occurrence, event type and impact rating; Data preprocessing: Clean the collected data, remove data with missing values exceeding the set threshold, and use linear interpolation to supplement the missing values; adopt the 3σ principle based on statistical distribution, regard data that deviates from the mean by 3 times the standard deviation as outliers, and correct the local trend of the data time series corresponding to the outliers; standardize different types of data to make the characteristics of each data in the same dimension; Feature engineering processing: extract the principal components from the pre-processed macroeconomic indicator data, use the principal component analysis algorithm, and retain the principal components whose cumulative contribution rate reaches the set proportion as the key economic features; quantify and encode the data related to market emergencies, assign scores according to the event type and impact rating, and construct market event feature vectors; decompose the historical exchange rate data into trend items, cycle items and random items according to the time series, and extract trend features and cycle features respectively; combine the trend features, the cycle features, the key economic features, and the market event feature vectors to form a comprehensive feature set; Model construction: Construct a hybrid forecasting model. The bottom layer of the hybrid forecasting model is composed of a long short-term memory network and a convolutional neural network in parallel. The long short-term memory network is used to capture the time series dependency of exchange rate data. The number of neurons in the hidden layer of the long short-term memory network is adaptively adjusted according to the length of the input sequence. The adjustment formula is: N LSTM =log2(L)+k, where N LSTM is the number of neurons, L is the input sequence date, and k is an empirical constant; the convolutional neural network is used to extract local features of exchange rate data, and the convolution kernel size of the convolutional neural network adopts a combination of multiple sizes, the step size is 1, and the filling method is the same; the top layer of the hybrid prediction model adopts a fully connected neural network to fuse the outputs of the long short-term memory network and the convolutional neural network and further learn features, the number of layers of the fully connected neural network is 2, the number of neurons in each layer gradually decreases, and ReLU is used as the activation function; Model training: the comprehensive feature set is divided into a training set, a validation set and a test set in chronological order; the hybrid prediction model is trained using the training set, and an adaptive learning rate strategy is adopted. The initial learning rate is set to lr0. After each RND training round, according to the change of the loss value of the hybrid prediction model on the validation set, if the loss value does not decrease for two consecutive rounds, the learning rate of the next training round is Among them, lr0∈lr old ; The mean square error is used as the loss function during the training process, and the training termination condition is that the loss value of the hybrid prediction model on the validation set converges or reaches the maximum training round; Model evaluation: Use the test set to evaluate the performance of the trained hybrid prediction model, and use multiple evaluation indicators to determine whether the model performance meets the preset requirements. If not, adjust the model hyperparameters and retrain. The evaluation indicators include root mean square error, mean absolute error, and determination coefficient. Exchange rate prediction: the newly collected real-time data is input into the trained hybrid prediction model after the data preprocessing and feature engineering processing to obtain a sequence of exchange rate prediction values in the future; Strategy formulation: Based on the exchange rate forecast value sequence corresponding to the predicted exchange rate trend, combined with the current asset allocation, cost structure and risk tolerance of the enterprise or investor, and introducing a risk-return assessment model to comprehensively consider potential returns and risk losses, formulate a profit maximization strategy; Transaction execution: According to the formulated strategy, real-time trading operations are carried out in the financial market through the automated trading system; during the transaction execution process, market feedback information is continuously collected. If there are sudden major changes in the market, the emergency adjustment mechanism is triggered to suspend or adjust the current trading strategy to ensure the safety of funds; Profit calculation and optimization: After each trading cycle, the actual profit situation is calculated, the predicted profit is compared with the actual profit, and the cause of the error is analyzed; according to market changes and model performance monitoring, the hybrid forecasting model and profit maximization strategy are regularly optimized and updated. The optimization process includes one or more of re-collecting data, adjusting model structure or parameters, and improving strategy rules.
2. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the data collection, the financial data sources include databases of internationally renowned financial information institutions, official websites of central banks of various countries, and market data interfaces of major global stock exchanges. The collected data is stored in a distributed file system, and a redundant backup mechanism is used for data backup.
3. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the data preprocessing, complex missing values that cannot be supplemented by linear interpolation are repaired by combining a seasonal adjustment method based on time series decomposition. The seasonal adjustment method is: first separate the seasonal components, and then use the mean of the same season data in adjacent periods to fill the missing values.
4. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the feature engineering process, an autoencoder model is used to perform dimensionality reduction processing on the market event feature vector, compressing the high-dimensional feature vector into a low-dimensional hidden layer representation.
5. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the model construction, an attention mechanism module is added between the bottom layer and the top layer of the hybrid prediction model. The attention mechanism module is used to dynamically allocate weights according to the importance of the input features. The formula of the attention mechanism adopted by the attention mechanism module is: Among them, Q is the query matrix, K is the key matrix, V is the value matrix, and d k is the dimension of the key, K T is the transpose of the key matrix.
6. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the model training, an adversarial training mechanism is also introduced. The adversarial training mechanism is to build a discriminator on the basis of the hybrid prediction model to perform adversarial game. The adversarial game is used to make the hybrid prediction model generate prediction results that are difficult to distinguish by the discriminator during training. The loss function L of the adversarial training mechanism is total Obtained by the following formula: L total =w g *L g +w d *L d Among them, L g is the generator loss, w g is the generator loss weight, L d is the discriminator loss, w d is the discriminator loss weight.
7. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the strategy formulation, the risk-return assessment model adopts a multi-objective optimization algorithm, and the function of the multi-objective optimization algorithm is: Among them, x is the strategy variable, μ(x) is the expected return, λ is the risk aversion coefficient, α is the confidence level, CvaR α (x) is the conditional value at risk.
8. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: During the transaction execution, the automated trading system adopts a microservice architecture, splits the functional modules corresponding to transaction orders, market monitoring, and order management into independent microservices, and performs data interaction through a lightweight communication protocol.
9. The method for maximizing exchange rate forecasting profits based on a hybrid forecasting model according to claim 1, characterized in that: In the profit accounting and optimization, a machine learning algorithm is used to automatically classify and analyze the causes of errors.
10. The method for maximizing exchange rate forecasting profit based on a hybrid forecasting model according to claim 1, characterized in that: The method also includes: building a visual monitoring platform, which is used to display data collection status, model training progress, exchange rate forecast trends, strategy execution effects and profit accounting results in real time.
Citation Information
Patent Citations
Exchange rate prediction method and device
CN116308780A
Exchange settlement and sale rate prediction method and device, storage medium and electronic equipment
CN118261707A
Foreign exchange market risk quantification and early warning method based on long and short term memory model
CN119250954A