 Research
 Open access
 Published:
Foreign exchange trading and management with the stochastic dual dynamic programming method
Financial Innovation volumeÂ 9, ArticleÂ number:Â 23 (2023)
Abstract
We present a novel tool for generating speculative and hedging foreign exchange (FX) trading policies. Our solution provides a schedule that determines trades in each rebalancing period based on future currency prices, net foreign account positions, and incoming (outgoing) flows from business operations. To obtain such policies, we construct a multistage stochastic programming (MSP) model and solve it using the stochastic dual dynamic programming (SDDP) numerical method, which specializes in solving highdimensional MSP models. We construct our methodology within an opensource SDDP package, avoiding implementing the method from scratch. To measure the performance of our policies, we model FX prices as a meanreverting stochastic process with random events that incorporate stochastic trends. We calibrate this price model on seven currency pairs, demonstrating that our trading policies not only outperform the benchmarks for each currency, but may also be close to expost optimal solutions. We also show how the tool can be used to generate more or less conservative strategies by adjusting the risk tolerance, and how it can be used in a variety of contexts and time scales, ranging from intraday speculative trading to monthly hedging for business operations. Finally, we examine the impact of increasing trade policy uncertainty (TPU) levels on our findings. Our findings show that the volatility of currencies from emerging economies rises in comparison to currencies from developed markets. We discover that an increase in the TPU level has no effect on the average profit obtained by our method. However, the risk exposure of the policies increases (decreases) for the group of currencies from emerging (developed) markets.
Objectives and contributions
Foreign exchange (FX) management may be regarded as one of the most pressing concerns of companies whose earnings (operations) are subject to FX uncertainty. FX fluctuations can result in hardtorecover losses and dramatic changes in net income, particularly in a competitive lowmargin market. To hedge against FX risk, companies could either offset gains (losses) on foreign assets with a foreign liability (and vice versa) or use derivative contracts.^{Footnote 1}
Several speculators profit from FX movements. Meanwhile, financial institutions are in between, controlling the market risk in international portfolios while also employing FXbased investment strategies. Even commercial banks must deal with FX risk. Consider a bank outside the United States that provides credit (e.g., a credit card) for international purchases in US dollars (USD). When retail clients pay such credit, they typically do so in local currency (e.g., a checking account). Thus, the FX desk of such a bank is constantly purchasing USD for their clients when making these credit payments.
This work aims to build a decision support system that can assist companies in trading in the FX market for speculative or nonspeculative purposes. We want to generate policies that deliver the amounts and times to trade over time to maximize the compromise between expected profit and the risk of obtaining such profit. A multistage stochastic programming (MSP) model is used to generate policies. The advantage of using MSP is that decisions made at each point in time consider all possible future FX prices and decisions from that point to the horizon. Instead of using the myopic singleperiod approach, we use this model because it enables a trading schedule to be planned considering the proximity to the horizon.
MSP is a popular approach for solving asset allocation problems in discrete settings, especially for longterm horizon planning. Applications to pension funds (e.g., Duarte et al. 2017; De Oliveira et al. 2017) and assetliability management in insurance companies (e.g., Carino et al. 1994; Consigli et al. 2018). More recently, Mulvey et al. (2019) and Kim et al. (2020) used MSP to build goaldriven portfolios. MSP is even being used as a pricing option. For example, Antonelli et al. (2013) developed a linear stochastic programming model to price American options in incomplete markets. HaarbrĂŒcker and Kuhn (2009) used MSP to price agreements to trade electric energy at a specific time in the future, known as swing options. Finally, Kwon and Li (2016) used stochastic semidefinite programming in regimeswitching models to derive Europeanstyle option prices.
The complexity of using MSP to solve our problem is that the number of possible outcomes grows exponentially with the number of stages considered. Because MSP typically involves multidimensional statespaces, computing the Bellman function in each state becomes intractable. To address the dimensionality issue, we employ stochastic dual dynamic programming (SDDP), a numerical method that approximates the Bellman function with linear cuts rather than computing its exact value in each state. The SDDP has been used successfully to solve large MSP models in various fields, for example, in energy planning (Pereira and Pinto 1991; Guigues 2014; Soares et al. 2017), supply chain management (Fhoula et al. 2013), and mining (Reus et al. 2019).
To the best of our knowledge, this is the first paper that uses the MSP approach to model and solve speculative FX trading. Most trading strategies are based on technical analysis, and their profitability has been studied (e.g., Abbey and Doukas 2012; Coakley et al. 2016; Zarrabi et al. 2017; Deng et al. 2020). Furthermore, trades are triggered by indicators that rely explicitly on historical patterns in those approaches. On the other hand, our approach is forwardlooking because trading decisions are based on current and future FX rate outcomes. Our model also handles FX trades made to hedge against business activities that were not previously considered in FX trading strategies. One intriguing aspect of our methodology is that we do not need to change the model structure or the resolution method when solving problems with different time frequency and horizon settings. As demonstrated in âResults with intraday tradingâ and âResults with daily tradingâ section, the system can operate from an intraday, purely speculative trading context to monthly hedging by import/export businesses.
We intend to manage FX exposure by determining the appropriate amount of FX to buy (borrow) at any given time based on future outflows (inflows) of foreign denominated currency. In this sense, our model is similar to inventory management in supply chain problems (for a more indepth account of this topic, see the survey by Andersson et al. (2010)). This provides an alternative to hedging currency risk with derivative contracts, which has been extensively researched.^{Footnote 2} The advantage of hedging with prior spot FX trades is that no money is required upfront. The disadvantage is that derivative contracts come with premium charges, which can be prohibitively expensive for small and medium businesses or businesses with low margins. Furthermore, some countries lack FX derivative markets. Nonetheless, as we will see in âMethodologyâ section, both approaches can produce comparable hedging effectiveness.^{Footnote 3} Yu et al. (2020) provided a multiperiod setting for FX, determining the optimal number of options or futures for future FX cash flows in a firm. Their solution is based on dynamic programming as well. Their own algorithm, however, is not as well documented as the SDDP, and their experiments only show the case of a single cash flow. Furthermore, the model and its solution are not intended to include speculative FX trading.
A second contribution is that our paper expands on the SDDP methodâs initial application in economic and financial fields. So far, the SDDP has only been used in portfolio management applications. KozmĂk and Morton (2015), and later DupaÄovĂĄ and KozmĂk (2017), were among the first to use the SDDP and to include an algorithm that reduces the number of scenarios required for asset returns. Guigues (2017) proposed a cut selection strategy to boost the efficiency of the dynamic dual programming algorithm when applied to a portfolio problem. ValladĂŁo et al. (2019) proposed a model that can handle multiple asset selections and trading costs. Risk constraints and Markovian timedependent returns based on a factor model and regimes are also included. Meanwhile, Guigues et al. (2020) extended the regularization method that enables the SDDP to solve nonlinear problems. The algorithm can find asset allocations under market impact costs and risk aversion measures. Finally, Guigues (2021) proposed a method for solving the SDDP with an arbitrary number of stages. The paper demonstrates the economic benefit of using the method in cases where the trading timeframe is unknown in advance.
Hence, we would like to show that the tool can be applied in another context, that is, FX trading. To do so, we solve our novel MSP model using an opensource package called âsddp.jl,â which Dowson and Kapelevich (2017) implemented in Julia. There is no longer any need to create the algorithm from scratch with this package. As a result, we encourage finance practitioners and traders to use this tool in their work. We also note that the sddp.jl package was successfully used by Reus and Prado (2021) to solve an indexbased asset allocation problem.
Third, we can obtain solutions that implicitly account for risk aversion during the solution phase. Most FX strategies reduce risk by incorporating explicit constraints (e.g., bounding positions and turnovers). The disadvantage of doing so is that good solutions may be excluded when prior constraints are imposed. Previous research (e.g., ĂlvarezDĂez et al. 2016) has used risk measures to find hedging positions in one and twostage settings. However, as HomemdeMello and Pagnoncelli (2016) discussed, using risk measures in a multistage setting is more difficult to implement. Fortunately, the sddp.jl package allows us to change the MSPâs objective function and thus reward conservative solutions based on the userâs risk tolerance, without the need for prior boundaries.
Fourth, to the best of our knowledge, this is the first paper to use the SDDP to implement a meanreverting process in a financial application. The algorithm was initially designed to work with stageindependent random variables. Following that, new research demonstrated how to incorporate Markov processes (Philpott and De Matos 2012) and autoregressive processes (Shapiro et al. 2013; Guigues 2014). The sddp.jl package can handle both types of processes, and the present study shows how to implement the Vasicek (1977) model.
Finally, we contribute to the existing literature on economic factors (information) that explain and/or influence currency movement. In this regard, Aloosh and Bekaert (2021) concluded that clustering dollar and European currencies is reasonable. They discover that trading volume and knowing whether a currency is classified as a commodity currency can explain FX dynamics better than carry. Other research focuses on macroeconomic factors. In a recent article, Pham (2019) demonstrated that a decrease in Vietnamâs money aggregate, as measured by the interest rate, results in a depreciation (appreciation) followed by an appreciation (depreciation) in the countryâs real effective exchange rate. These findings contradict the overshooting hypothesis proposed by Dornbusch (1976) and empirically supported by Sims (1992) and Eichenbaum and Evans (1995). This paper aims to investigate the impact of an increase in the trade policy uncertainty (TPU) index, as developed by Caldara et al. (2020), on the performance of the SDDP solutions. The TPU measures the frequency of occurrences of trade policy and uncertainty terms in major newspapers. Huynh et al. (2020) show that the TPU has a strong relationship with FX volatility, even when the Economic Policy Uncertainty (EPU) index is included.^{Footnote 4} Our results show that an increase in the TPU level produces an increase (decrease) in the volatility of the currencies of emerging (developed) markets. This results in an increase (decrease) in the risk of the SDDPgenerated policies in comparison to the risk obtained in periods with lower TPU levels.
The SDDPâs application in our work aligns with the growing demand for quantitative methods in finance. As Hu et al. (2015) and Kou et al. (2019) explained, the financial market is a highly interconnected and complex network. As a result, gaining a better understanding of it necessitates the use of advanced quantitative and machine learning methods to assess systemic risk and improve financial stability. The TPU index, for example, is built using text mining methods, which are commonly used to gauge market sentiment.^{Footnote 5} Incorporating risk aversion endogenously in our methodology necessitates handling and adapting risk measures, which is another key element used by statistical methods. Brownlees and Engle (2017), for example, introduced SRISK, which measures a firmâs capital shortfall in the event of a severe market decline. Agliardi (2018) explored the ambiguity of the valueatrisk when estimating capital requirements. Another known application is the use of machine learning techniques to classify the credit risk in retail banking. For example, Zhang et al. (2015) used a support vector machine to assess the default risk of SMEs when supply chain finance is included. Meanwhile, Li et al. (2021) applied the kMeans algorithm to financial data using a revised support vector data description model. Dastile et al. (2020) published a recent review on credit scoring using advanced statistical methods.
The remainder of this paper is structured as follows. âSDDP methodâ section briefly explains the SDDP method. âMethodologyâ section presents the MSP and FX price models. Then, âResults with intraday tradingâ section demonstrates the modelâs performance and policies derived from our model within an intraday trading setting, using seven currency pairs. âResults with daily tradingâ section shows the modelâs performance in a daily trading setting using the same currency pairs and demonstrates the effect of the TPU level on the performance of our solutions. Finally, âConclusion and future developmentâ secrion concludes the paper and discusses possible future extensions that could be used to improve the methodology.
SDDP method
We explain the SDDP at the practitioner level in this section, summarizing the information provided by Reus and Prado (2021). The SDDP is a numerical method for calculating MSP. To facilitate resolution, MSP are typically structured as timedependent subproblems. Let \({x}_{t}\) represent the decisions at each time period t, and \(\xi_{t}\) represent the exogeneous stochastic process. Each subproblem can be written like Philpott and De Matos (2012).
For \(t = 1\):
For \(t = 2, \ldots ,T\):
Matrix \(B_{t}\) and vector \(b_{t}\) depend on \(\xi_{t}\), while \(A_{t}\) and \(c_{t}\) do not. Note that \(x_{t}\) are obtained without knowing the values of \(\xi_{l} \forall l > t\). At period \(T\), we obtain a deterministic value for the border condition \(E\left[ {Q_{T + 1} \left( {x_{T} ,\xi_{T + 1} } \right)} \right]\).
The difficulty of solving an MSP lies in the size of the state space, that is, the possible values of \(\xi_{t}\). To find the best value, \(Q_{t}\) must be evaluated in every possible state, which can be time consuming in multistage problems. As a result, numerical techniques such as the SDDP must be used to find nearoptimal solutions.
As illustrated in Fig. 1, the main idea of the SDDP is to build an outer approximation of \(E\left[ {Q_{t + 1} \left( {x_{t} ,\xi_{t + 1} } \right)} \right]\) with linear cuts. Within the SDDP algorithm, problems (1)â(2) are approximated with the following linear programming (LP) models:
For \(t = 1\):
For \(t = 2, \ldots ,T\):
The term \(E\left[ {Q_{t + 1} \left( {x_{t} ,\xi_{t + 1} } \right)} \right]\) is replaced by variable \(\theta_{t + 1}\), which is bounded by the cuts defined by constraints (3c)â(4c). Note that the dual variables of original constraints are denoted by \(\pi_{t}\) and depend on \(\xi_{t}\).
To understand the algorithm in more details (including estimations of terms \(g_{t + 1}^{k,s}\) and \(G_{t + 1}^{k,s}\)), a pseudocode is presented below. At each iteration \(k\), we start with the forward pass. In this step, \(N\) scenarios are sampled, and problems (3)â(4) are solved sequentially at each period \(t\). Solution \(\overline{x}_{t  1}^{k,s}\) and function value \(\overline{Q}_{t} \left( {\overline{x}_{t  1}^{k,s} ,\xi_{t} } \right)\) are saved for each scenario \(s\), which is used to solve the problem in the next period. The term \(\overline{z}^{k}\) obtained can be used as a lower bound, whereas the sample average of the costs can be used as an upper bound. The stopping criterion is met if the lower bound is within the \(\alpha\)confidence interval of the upper bound.
The new cuts are generated with the backward pass step. By moving backward in time, problem (4) is solved at period \(t\) by using the stored decisions \(\overline{x}_{t  1}^{k,s}\) in the forward pass step. Both the dual variables \(\pi_{t}\) and stored terms \(\overline{Q}_{t} \left( {\overline{x}_{t  1}^{k,s} ,\xi_{t} } \right)\), are used to estimate \(g_{t}^{k,s}\) and \(G_{t}^{k,s}\). Note that the cuts generated at period \(t\) are used for period \(t  1\).
Bandarra and Guigues (2021) recently developed and tested a cut selection method for multicut decomposition algorithms on a portfolio problem. The results show that their method outperforms other cut selection methods (e.g., De Matos et al. 2015), particularly when implementing the SDDP.
The SDDP was originally designed for convex functions \(Q\), which does not apply to economic problems like our trading model. In most economic problems, the objective function is determined by revenues (costs), which are calculated by multiplying a state variable (price/cost) by an endogenous variable (quantity). Downward et al. (2020) address this issue by incorporating an idea developed by Baucke et al. (2017) to bound nonconvex value functions into the SDDP.jl.
Another enhancement to the method was the incorporation of risk measures into the objective function, as seen in Philpott et al. (2013) and Shapiro et al. (2013). In this regard, the SDDP.jl allows for the addition of risk aversion by replacing the risk neutral expected value at each stage in (2) with
where \(\beta\)âââ[0, 1], which is a convex combination of the expected value and the risk measure. The Conditional ValueatRisk (CVaR) is an example of a risk measure. CVaR was first proposed by Rockafellar et al. (2000) and has since been extended to a multistage context in several publications, including Reus et al. (2019).
Methodology
Currency trading problem (CTP)
Consider set \(t \in \left\{ {1 \ldots T} \right\}\) to be the times at which currency can be purchased or sold during a period with horizon \(T\). Assume there are scheduled exogenous flows \(f_{t}\), which are denominated in foreign currency. If \(f_{t}\) is negative (positive) then we have an expense (income). At each time, we must decide:

\(x_{t}^{ + } \left( {x_{t}^{  } } \right)\): The amount of foreign currency to be bought (sold) at time \(t\).
To make the above decisions, we need to know the value of the following state variables:

\(S_{t}\): FX price at the end of time \(t\), that is, the value in the domestic currency of one unit of foreign currency.

\(P_{t}\): Net position of foreign currency at the end of time \(t\). If the amount is positive (negative), we have a long (short) position.
The uncertainty of prices can be included in the exogenous process \(\xi_{t}\), which is the FX price increase (decrease) (%) at time \(t\).^{Footnote 6} We include the bid/ask spread with a parameter \(c\) and define \(S\) to be the price at which we buy and \(S\left( {1  c} \right)\) to be the price at which we sell. At horizon \(T\), we value positions at closing price \(S_{T}\). Initial positions and prices at the beginning of the day (\(S_{0} ,P_{0}\)) are known. The CTP can be written as follows:
For \(t = 1, \ldots ,T  1\):
For \(t = T\):
The objective function (6a) maximizes the P&L in the local currency. The function adds the market value of any open positions in the final period.^{Footnote 7} Constraints (6b) are similar to the supply chain management ending inventory equation: the position at the end of a period is the value of the position at the end of the previous period plus new purchases (sales) plus exogenous flows. The difference between physical inventory and accounting inventory is that account \(P_{t}\) can be negative. This is true, for example, of incoming flows in exports businesses, which can be hedged with short positions. Equations (6c) update the exchange rate according to its stochastic processes, with \(\xi_{t}\) a function of \(S_{t  1}\). Finally, the constraints in (6d) describe the nature of the variables. Note that function (6a) does not include the income or expenses generate by the flows, which equals \(\mathop \sum \limits_{t = 1} S_{t} f_{t}\). This term is the total P&L obtained using the ânohedgeâ policy, that is, the solution obtained by setting \(x_{t}^{ \pm } = 0 \forall t\), which is feasible in the CTP.
The model described above is the generic version of a CTP model. Evidently, each practitioner can add customized requirements. For example, a common constraint might be to limit the amount to be held in account \(P_{t}\), which can be added by imposing constraints of the type \(lp_{t} \le P_{t} \le up_{t}\). Another option is to set a limit on the number of new positions taken. As we will see in the following section, depending on the dynamics of the FX prices in Eq. (6c), new stochastic and state variables may be required.
We are said to be in a purely speculative setting when there are no flows coming from business operations to be hedged, that is, when \(f_{t} = 0 \forall t\). In the case where \(f_{t} \ge 0 \forall t\) and no speculation is allowed, then we omit variable \(x_{t}^{ + }\). This could be the case with exporting businesses that only want to hedge their future incomes. Analogously, for importing businesses looking to hedge their future expenses \(f_{t} \le 0 \forall t\), we omit variable \(x_{t}^{  }\) if the CTP is used only for nonspeculative purposes.
The CTP also admits a complete hedge (i.e. riskfree solution, RF hereafter) if we choose \(x_{1}^{ + } = \mathop \sum \limits_{{t:f_{t} < 0}}^{T} f_{t} , x_{1}^{  } = \mathop \sum \limits_{{t:f_{t} > 0}}^{T} f_{t}\) and \(x_{t}^{ \pm } = 0 \forall t > 1\). Without a derivative market, this is a natural way to completely hedge against currency volatility. The inclusion of derivative contracts is beyond the scope of this work, but forward contracts can be easily incorporated into the CTP. The price \(K_{t}^{s}\) of a forward contract purchased at time t and maturing at time s can be divided into the spot price \(S_{t}\) and forward points \(fp_{t}^{s}\). Assume that all contracts mature at the end of the horizon \(T\).^{Footnote 8} Thus, the profit in (6a) can be replaced by \(\left( {1  c} \right)K_{t}^{T} x_{t}^{  }  K_{t}^{T} x_{t}^{ + }\), which can be decomposed into the original profit and the premium for using forward contracts:
Furthermore, if we consider \(fp_{t}^{T}\) to be similar in time (as is the case for shorthorizon settings), then the second component of Eq. (8) is nearly constant when added across the entire time span, and thus it will not change the optimal hedging policy. To put it another way, using forward contracts does not always provide better hedging solutions. It aids policy implementation though.
FX price model
Empirical evidence suggests that finding a model that can fully characterize FX price dynamics is difficult, if not impossible. However, there are some facts or patterns to consider when selecting a suitable model. Several studies have found meanreversion in real exchange rates (e.g., Jorion and Sweeney 1996; Lothian 1997; Caporale and GilAlana 2004). Strategies based on a moving average and the Relative Strength index, as discussed in Manahov et al. (2014) and Svoboda et al. (2020), are common in FX trading and implicitly assume meanreversion behavior in order to work. The Geometric Brownian Motion (GBM) and extensions are another process that is commonly used when pricing currency options. Prices can be modeled as a random walk for shortterm horizons. Hong et al. (2007) and Colombo and Pelagatti (2020) explained the difficulty of finding FX models that improve such a process.
The SDDP requires that a discrete lattice represent the chosen price model. Figure 2 depicts the advantage of this structure over a scenario tree structure. The number of states that must be handled is reduced while maintaining the quality of the process representation.
Given all of the preceding considerations, we present a model that follows a Vasicek meanreverting process and can transform into a GBM in the presence of an external random shock. Vasicek dynamics can be expressed as
with \(dW_{t}\) a Brownian process. \(S_{\infty }\) is the longrun meanlevel and \(\kappa\) calibrates the reversion speed toward \(S_{\infty }\). To build the lattice, first notice that the solution to the Vasicek model in equation \(\left( 9 \right)\) can be written as:
From Eq. (10), we see that \(S_{t}\) is a Gaussian process with the following mean and variance:
With formulas in (11), we can then construct a binomial lattice with the following structure:
Besides the meanreverting structure, we add another dynamic that follows a positive or negative trend to account for specific market events that affect FX prices. To accomplish this, we can use the binomial lattice defined by Jarrow and Rudd (1983),
which approximates the GBM. The sign of \(\hat{\mu }\) determines the direction of the trend. To combine both dynamics, we add a new i.i.d. random process \(\delta_{t}\) that can take three possible values:
\(\delta_{t} \in \left\{ {0,  1,1} \right\}\). If \(\delta_{t} = 0\), then the price follows the dynamics in (12). If \(\delta_{t} =  1 \left( 1 \right)\), then the price changes its dynamics to (13) with a negative (positive) drift. The probabilities of the values are denoted by \(\pi_{0}\), \(\pi_{d}\) and \(\pi_{u}\) respectively. Since the shock that changes the dynamics is not considered as common, then \(\pi_{0} \gg \pi_{d}\) and \(\pi_{0} \gg \pi_{u}\). We also assume that there will be no more than one shock during the time period. That is, the GBM process changes only once and remains unchanged until the horizon. To incorporate the latter assumption, we add a state variable \(E_{t} \in \left\{ {0,  1,1} \right\}\) into the CTP. The day begins with price dynamics that are meanreverting (\(E_{0} = 0)\). Unless a shock occurs, the value of \(E_{t}\) equals 0. In that case, \(E_{t}\) changes toâââ1 or 1, and then remains constant until the end of the day. We add the two constraints listed below to the CTP. The first is the evolution of \(E_{t}\):
The second is the price \(S_{{t + {\Delta }t}}\), which depends on two states variables (\(E_{t}\) and \(S_{t}\)), and \(\xi_{t}\) as
Results with intraday trading
In this section, we present the CTP results in various contexts. Our research aims to demonstrate and validate the benefits of our decision support tool by referencing market data. We do not concentrate on the calibration of price dynamics or the profit value itself because each practitioner will have a unique data set when using the model.
We use Juliaâs sddp.jl package to implement the CTP in all settings (for more information, see Dowson and Kapelevich (2017)). As stated in the first section, the package enables us to solve the model without having to deal with the SDDP algorithm implementation. This means that the algorithm presented in âSDDP methodâ section does not need to be coded for the CTP. The sddp.jl uses the structure defined in models (1)â(2), which is the same structure used by the CTP. As a result, the model and input are added to the package in accordance with the formulations in (6)â(7). The modelâs solution includes a sampling procedure that can be used to define an allocation policy later on. Following some calibration, we discovered that sampling 10,000 scenarios was sufficient to represent future FX prices in all settings. Gurobi was the LP solver used in the SDDP procedure, and the experiments were carried out on a MacBook Pro with a QuadCore Intel Core i5 processor and 16 GB RAM. The CPU time required to reach each solution displayed was less than 20 min.
We calibrate the price models for seven pairs using 15min intraday prices. The first three currency pairs are from emerging economies (the Chilean peso (USDCLP), the Brazilian real (USDBRL), and the Turkish lira (USDTRY), whereas the remaining four are from developed economies (the Australian dollar (AUDUSD), the British pound (GBPUSD), Euros (EURUSD), and Japanese yen (USDJPY)). We only include trades made between 9 a.m. and 2 p.m., which is typically the busiest time in the market, particularly for currencies from developing economies. The estimates for each parameter are shown in Table 1. The values of \(\kappa\) and \(\sigma_{v}\) for the meanreverting dynamics in (12) represent the mean results obtained from statistical calibrations on each day within a historical sample. Note that \(S_{\infty }\) is not calibrated because we set \(S_{\infty } = S_{0}\). To compare currency pairs, we track the longterm volatility \(\sigma /\sqrt {2{\kappa }}\), with \(\sigma : = \sigma_{v} /S_{0}\). Figure 7 shows the calibration results in greater detail.
Setting 1: Nonspeculative trading
We start by considering a company that needs to fulfill a demand \(D\) (in foreign currency) by the end of the day, i.e. \(f_{T} =  D\) and \(f_{t} = 0 \forall t < T\). This setting is inspired by the credit payments made by an FX desk, which were discussed at the beginning of this article, but it also applies to any importing business that needs to cover a daily expense. Note that no speculation is allowed. Thus, variables \(x_{t}^{  .}\) can be removed from the CTP (which also causes the solutions to be insensitive to the bid/ask spread). If we want to repeat the same policy every day, we should end up in the same position as we started the day, that is \(P_{T} = P_{0} = 0\). Since there is no selling under this setting, we have the option to adapt the objective function to minimize costs, i.e.
We build two policies, which differ in terms of risk aversion: risk neutral (RN) and risk averse (RA). Such policies can be defined by setting a specific value for \(\beta\) in Eq. (5) (e.g. \(\beta = 1\) for RN). As an example, consider the RF policy, which purchases everything at the start of the day at a cost of \(S_{0}\). Another reference is the ânohedgeâ policy (NH hereafter). In this case, the total cost of NH equal \(S_{T} D\). Besides RF and NH, we compare both policies to two benchmark policies. The first (B1) is the expost optimal policy, which buys at the dayâs lowest price. The second (B2) buys the same amount, \(D/T\), every 15 min, thus buying at the average price of the day. The performance of every policy is measured using different statistics, applied based on the total cost (in domestic currency) per unit of foreign currency. Since \(P_{T} = 0,\) \(\mathop \sum \limits_{t = 1}^{T} x_{t}^{ + } = D\). Thus, the total cost divided by \(D\) is a weightedaverage price at which every solution buys in each period, i.e. \(\mathop \sum \limits_{t = 1}^{T} S_{t} x_{t}^{ + } /D = \mathop \sum \limits_{t = 1}^{T} S_{t} x_{t}^{ + } /\mathop \sum \limits_{t = 1}^{T} x_{t}^{ + }\). For B1, B2, RF and NH, the total costs divided by \(D\) equal \(\mathop {\min }\limits_{t} S_{t} , \mathop \sum \limits_{t = 1}^{T} S_{t} /T, S_{0}\) and \(S_{T}\) respectively. Since \(S_{\infty } = S_{0}\) in Eq. (12), \(E_{0} \left( {S_{t} } \right) = S_{0} \forall t\) if no shock occurs. Hence, the shock bias toward changing to a GBM with positive or negative trend determines whether \(E_{0} \left( {S_{t} } \right)\) is greater or less than 0. That is, if
\(\pi_{u} \ge \left( \le \right) \pi_{d}\), \(E_{0} \left( {S_{t} } \right) \ge \left( \le \right)\) \(S_{0}\). This implies that benchmark B2 is dominated by the RF policy when \(\pi_{u} \ge \pi_{d}\).
The performance of the CTP solutions and the benchmarks are shown in Table 2, with shock probabilities of \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\). The performance for the case \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {3.75\% , 1.25\% } \right)\) is shown in Table 8. Some of the findings are as follows:

1.
In terms of average costs, there is a small gap between the RF and the expost optimal policy (B1). For example, the average cost reduction is 0.8% for USDCLP, 1.3% for USDBRL, 1.8% for USDTRY, 1.0% for AUDUSD, 0.7% for GBPUSD, and 0.6% for EURUSD and USDJPY. The gap is even smaller for the case where \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {3.75\% , 1.25\% } \right)\).

2.
CTP solutions can reduce average costs to below \(S_{0}\), making them competitive with RF. When daily volumes are high (as in the case of a bankâs FX desks), the difference between RN and RF produces significant longterm savings, particularly for currencies from emerging economies. Consider the results with a daily volume of one million dollars. For USDTRY, the savings obtained with RN (relative to RF) are 1âĂâ(1âââ9.8758/10)âĂâ250 daysâ=â3.11 million USD a year.

3.
At a higher expense, we can reduce the risk of RN using RAâs policies in each currency (see \(VaR_{99\% }\) and \(CVaR_{99\% }\) measures). The option of using RA is especially desired when \(\pi_{u} > \pi_{d}\) (see Table 8). The degree of risk reduction can be handled with the chosen value for \(\beta\). Note that we could reach RF if we set \(\beta = 0\).

4.
Compared to B2, RN and RA both reduce the average costs as well as the risk of buying at high prices too. For example, the \(CVaR_{99\% }\) reduction made by RA, relative to B2, is 1âââ804.7/810.5â=â0.7% for USDCLP, 1.4% for USDBRL, 1.7% for USDTRY, 0.9% for AUDUSD, 0.5% for GBPUSD and EURUSD, and 0.9% for the USDJPY.

5.
NH allows us to quantify the consequences of not hedging at all. When we compare CTP solutions to NH, the risk reduction and average savings are significant.

6.
Volatility as a risk indicator may be deceptive. In many situations, B1 can have one of the highest volatilities, and we know it never buys above \(S_{0}\). In such a strategy, the volatility is produced by scenarios that allow one to buy at a very low price (e.g., during a downward trend), which is the inverse of what we consider risk.
In our model, currencies are characterized by the values of the parameters \(\left( {\kappa ,\sigma ,\hat{\mu },\hat{\sigma }} \right)\) seen in Table 1. Thus, the similarity (difference) in performance between the exchanges is also determined by the similarity (difference) in these parameters. This explains why the results for EURUSD, GBPUSD, and USDJPY are so similar. According to the sensitivity analysis based on USDCLP in Table 9, an increase (decrease) in \(\sigma /\sqrt {2\kappa }\) produces an increase (decrease) in the risk of every policy, except for B1. The same table shows that increasing the GBM drift \(\hat{\mu }\), decreases average costs of every policy. It also raises the risk in benchmark B2 and NH solutions, but not always in CTP solutions. Table 10 demonstrates that the risk of each policy (except B1) is sensitive to changes in the GBM volatility \(\hat{\sigma }\).
The sensitivity analysis discussed above helps to explain why CTP solutions generally offer greater potential in terms of savings from emerging economies, but with greater risk exposure. In those currencies, we have higher longterm volatility in the meanreverting process and/or shocks of bigger magnitudes (i.e., higher values of \(\hat{\mu }\) and \(\hat{\sigma }\)). We can also include the AUDUSD in this group because it is a commodity currency that performs similarly to the other commodity currencies (CLP and BRL).
Figure 3 depicts the RNâs decisions in seven representative scenarios chosen at random for illustration purposes.^{Footnote 9} One interesting finding across all 10,000 scenarios is that purchases are made sporadically throughout the day, as opposed to benchmark B2. The timing of these purchases is what distinguishes the scenarios. Clearly, a shift in FX dynamics (from meanreverting to GBM) influences future decisions. In the first two scenarios (black), the price always follows a meanreverting process. In these scenarios, the RN does not begin buying until 10:15, and then only if prices fall below a certain level. If this does not happen, the first purchase can be postponed (until 12:30 in scenario 2). Prices in scenarios 3 and 4 (green) change to follow a GBM with a downward trend at some point during the day. The RN policy, as expected, waits until the last period to purchase what is still required to meet demand (e.g., scenario 3). In Scenario 4, the shock occurs late in the day. Thus, purchases are made in accordance with the policy implemented in scenarios 1 and 2. The price process changes to a GBM with an upward trend in scenarios 5 and 6 (blue). The RN begins buying immediately after the shock (9:30 in scenario 5). In scenario 6, the shock occurs later. As a result, purchases are made in accordance with the policy implemented in scenarios 1 and 2. Finally, scenario 7 demonstrates how the RN policy results in an expensive solution. In this instance, the price dynamic shifts at 10:30. Prices are expected to fall in the coming months. As a result, the RN waits until late in the day to purchase. However, the price always rises and never falls. The RA policy buys earlier than the RN policy in every scenario, even though the best time to buy is late in the day on average (e.g., the case where prices follow a GBM with a negative trend). These choices avoid situations like the one in Scenario 7.^{Footnote 10}
We should point out that we test the CTP solutions when FX prices follow a pure random walk, which is possible with our model defined in âFX price modelâ section by setting \(\pi_{u} = 1 \left( {{\text{or }} \pi_{d} = 1} \right)\) and \(\hat{\mu } = 0\). In other words, we remove meanreversion and possible trends from the price process. As expected, the tests done using this process show us that the average cost savings for every policy (except B1) equal \(S_{0}\), because the unconditional expectation \(E\left( {S_{t} } \right) = S_{0}\) in a random walk. Since the RF policy cost is \(S_{0}\) surely, then it outperforms all other policies except B1. B1 saved 0.4% for USDCLP, 0.8% for USDBRL, 2.3% for USDTRY, 0.8% for AUDUSD, 0.4% for GBPUSD, 0.2% for EURUSD, and 0.4% for USDJPY. The latter gaps are generally smaller than the reduction seen in Setting 1 results, indicating that there is little room for improvement in the RF policy results.
Setting 2: Speculative trading
With the same price dynamics, we now do purely speculative trading within boundaries, i.e. \( L \le P_{t} \le L\). Pure trading profits (P&L) in domestic currency are divided by volume L to determine performance. We define benchmark S1 as the strategy that buys \(L\) at the dayâs lowest price and sells \(L\) at the dayâs highest price. S1 is not always expost optimal because there may be multiple opportunities to buy low and sell high throughout the day. However, it remains highly competitive and would be ideal to implement if we possessed such predictive abilities.
Table 3 displays the performance of the CTP solutions. There are some interesting findings that may differ from those seen in the previous nonspeculative setting.

1.
CTP performance is the same for trends of the same magnitude. This is not hard to explain: if we have an optimal strategy with \(\pi_{u}  \pi_{d} = a\), then the optimal policy with \(\pi_{d}  \pi_{u} = a\) is to do the opposite trade. Thus, the performance of Table 3, which is obtained with
\(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\) is identical to the case \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {3.75\% ,1.25\% } \right)\).

2.
In terms of risk, RF is not the best policy. Despite the fact that the VaR and CVaR of this policy are both zero, S1 manages to generate positive profits even in the worstcase scenarios (a bad scenario for this policy would be a flat FX rate). As a result, its VaR and CVaR are negative.

3.
As expected, the average profit of the RN policy is lower than the profit of S1 (the gap is 1âââ7.1/9.6â=â26% for USDCLP, 27% for USDBRL, 40% for USDTRY, 30% for AUDUSD, 29% for the GBPUSD, 21% for the EURUSD, and 20% for the USDJPY), and in the worstcase scenario, it results in losses. However, the RN policy still generates significant daily average profits for each currency pair. For USDCLP, for example, we can make an average profit of 0.9 cent for every USD invested. When the exposure is 1 million USD, this equates to 0.9%âĂâ1â=â9,000 USD per day. Looking at the \(CVaR_{1\% }\), we would have a daily average loss of 0.6%âĂâ1â=â6,000 USD in the worst outcomes.

4.
We can effectively reduce extreme losses with RA policies, at the expense of reducing average profits.
The difference in performance between currency pairs is due to FX process calibration. We can make more money in emergingmarket currencies, but at a higher risk (plus the AUDUSD). The currencies with the highest values of \(\sigma /\sqrt {2\kappa }\) come from this group, and according to the sensitivity analysis in Table 11, an increase in \(\sigma /\sqrt {2\kappa }\) produces better trading opportunities (to buy at lower prices and sell at higher prices), but with higher risk. Currencies with the highest drift and volatility in the shocks include the BRL, TRY, and AUD. Table 11 shows that increasing these parameters results in the greatest increase in average profits when using the CTP.
Figure 4 depicts the RN solutionâs decisions in seven scenarios (different to those chosen for Fig. 3).^{Footnote 11} The price always follows a meanreverting process in the first two scenarios (black). RN trades when the price reaches certain thresholds, which change over time. It buys when the price crosses a lower threshold (generally below \(S_{0}\)) and sells when the price crosses an upper threshold (generally above \(S_{0}\)). In scenarios 3 and 4 (green), the price process changes to a GBM with a positive drift. In both scenarios, there is a short net position before the change. When the shock occurs, the RN goes long aggressively, to the maximum allowed, and holds this to the horizon, assuming that the price will rise in the future. The price changes in scenarios 5 and 6 (blue) changes to follow a GBM with a negative drift. In scenarios three and four, the policy sells immediately after the shock and maintains a short position until the horizon because the price is expected to fall. Finally, in Scenario 7, the RN policy performs poorly. The price is expected to move in the opposite direction of a predetermined trend. When a shock occurs, RN maintains a short position. The price is expected to fall as a result of the shock, so RN waits to buy at a lower price. The latter never occurs because the price rises later.
We should point out that we also tested the CTP performance when FX prices followed a pure random walk. The CTP solutions were unable to generate profits, whereas the S1 solution generated lower profits than shown in Table 3 for the same level of risk.
Results with daily trading
Now we are in a situation where trading can be done once a day for an entire month. Similarly to previous experiments, the number of trading periods (20) determines the size of the CTP. As a result, the solutions are obtained in the same time order. This configuration is based on businesses with activities that are subject to FX uncertainty but lack the turnover and regularity of daily requirements seen on a bankâs FX desk. As a result, they are not required to trade on an intraday basis.
We divided the data into two parts based on the 75th percentile of the monthly TPU from January 2000 to December 2021.^{Footnote 12} We calibrate the price process using daily data, using a procedure similar to that used for intraday trading. The values of \(\kappa\) and \(\sigma\) for the meanreverting dynamics in (12) represent the mean results obtained from statistical calibrations each month from January 2000 to December 2021. \(S_{\infty }\) is equal to the spot price seen at the beginning of each month. For more details on the results of the calibration, see Fig. 8.
Table 4 shows the estimates of each parameter, for the two sets of data. It is interesting to note that when the TPU rises above its historical 75th percentile, currency volatility in nondeveloped economies rises significantly, in contrast to G10 currencies.
To illustrate the benefits of our tool, consider the following income structure at day \(t\):
\(f_{5} = 0.1D, f_{10} = 0.2D, f_{15} = 0.6D, f_{20} = 0.1D\) and \(f_{t} = 0\) for every \(t\). This pattern could be a simplified version of the weekly sales seen in businesses during December, with a peak demand around Christmas time. We allow speculation, but within limits: \( D \le P_{t} \le D\).
We modify the benchmark S1 from Setting 2 in previous section. S1 now buys at the lowest possible price and sells at the highest possible price every week. To compare the P&L of S1 with that of the CTP solution, we subtract the revenues generated by incoming flows from the latter, which is the P&L computed for the NH policy. Under this configuration, NHâs P&L equals \(D\left[ {0.1S_{5} + 0.2S_{10} + 0.6S_{15} + 0.1S_{20} } \right]\). We set equal shock probabilities, \(\pi_{u} = \pi_{d} = 2.5\%\), and no bid/ask spread because they are irrelevant at this trading frequency.
Besides the P&L, another metric to compare the performance of the CTP with the benchmarks B1, B2, RF and NH, could be the weightedaverage price at which each policy sells. For the CTP solution, that is \(\mathop \sum \limits_{t = 1}^{T} S_{t} \frac{{x_{t}^{  } }}{{\mathop \sum \nolimits_{t = 1}^{T} x_{t}^{  } }}\). We modify benchmarks B1 and B2 used in Setting 1 from previous section. B1 hedges at the best (highest) monthly price, so the weightedaverage selling price is \(\mathop {\max }\limits_{t} S_{t}\). B2 sells positions in proportion to incoming flows. Let \(x_{B2,t}\) denote the amount sold under policy B2 at date \(t\). Then
Applying the trades in (16), the weightedaverage selling price of B2 is
For RF and NH, the weightedaverage selling price is \(S_{0}\) and \(\left[ {0.1S_{5} + 0.2S_{10} + 0.6S_{15} + 0.1S_{20} } \right]\) respectively.
Results under normal TPU
The performance of the CTP solutions and the benchmarks is shown in Tables 5, 6. From the first table, we can see that:

1.
CTP solutions, like intraday trading in setting 2, can generate profits from speculation. Furthermore, when comparing average profits for currencies from emerging economies, RN solutions outperform S1 (CLP, BRL, TRY). Again, in worstcase scenarios, RA policies could be used to reduce losses.

2.
The highest ratios between average profit and the CVaR measure are obtained by the USDTRY (0.7087/0.0852â=â8.3), followed by the USDBRL (3.6).

3.
Adjusting for time differences, the profitrisk compromise is lower than the same compromise obtained in intraday trading. In the USDCLP case, for example, with a 1 million USD exposure, we can achieve a monthly average profit of 3.7%âĂâ1â=â37,000 USD and a monthly average loss of 2.1%âĂâ1â=â21, 000 USD in the worstcase scenarios. We obtained an average daily profit of 9,000 USD for the same volume in the intraday setting, which equals 180,000 USD per month. We get a monthly exposure by extrapolating the average loss of 6,000 USD obtained with intraday trading for the worstcase scenarios of roughly \(\sqrt {20}\)âĂâ6,000â=â26,800 USD. Evidently, the ratio 180,000/26,800 is much higher than the 37,200/21,000 obtained when trading once a day. Something similar occurs with the other currency pairs.
The parameters defining the FX processes in Table 4 could explain the latter results. First, from Table 11, we know that an increase (decrease) in \(\hat{\mu }\) produces an increase (decrease) in the average profits. The currencies with the highest values correspond to the emerging economies. There is also a difference in the values of \(\hat{\mu }\) obtained from the intraday process. For example, \(\hat{\mu }\) equals 10 pips in the USDCLP based on intraday prices, which equals 20âĂâ10â=â200 pips when extrapolated to a daily price process. This is significantly greater than the 45pip drift seen in Table 4. Note that the latter occurs with every currency. Second, if we extrapolate the longterm volatility \(\sigma /\sqrt {2\kappa }\) of the intraday process to a daily scale, we get higher (lower) values in the currencies coming from emerging (developed) economies. For example, extrapolating the longterm volatility of USDTRY \(\sqrt {20} { } \times { }\sigma /\sqrt {2\kappa } = \sqrt {20} { } \times { }0.17\% = 0.76\%\), which is bigger than the longterm volatility of 0.48% in Table 4. As we know from Table 11, the risk of each policy is directly related to \(\sigma /\sqrt {2\kappa }\).
The first thing to notice about the performance in Table 6 is that the average selling price for all policies except B1 is slightly above \(S_{0}\). For example, the RN is at most 0.6% above \(S_{0}\) (in the case of USDTRY). The average savings in the intraday setting 4.1 are higher because the time span (one day) is 20 times shorter (1 month). One of the main reasons for this is that the CTP maximizes trading revenues rather than the weightedaverage price. This is also why RA policies can have a worse \(AP_{1\% }\) on this table too. Good trading rules involve selling above the buying prices, which does not necessarily lead to selling above \(S_{0}\). Still, the CTP solutions outperform B2 and the NH strategy in terms of average selling price. CTP solutions manage to perform better in the worst scenarios (\(AP_{1\% } )\) too.
Results under high TPU
Table 7 displays the performance of the CTP solutions and benchmarks. The average profits of the CTP solution are comparable to the average profits of a normal TPU level. As a result, we continue to earn more in emergingmarket currencies. However, these profits are now lower than S1âs profits (except for EURUSD and USDJPY). In comparison to the results obtained with a normal TPU level, the risk of RN policies increases (decreases) in currencies from emerging (developed) economies. This is to be expected, given that we know from Table 4 that moving to a highTPU period increases (decreases) longterm volatility. We have not shown the weightedaverage selling price because it is very similar to the results obtained with standard TPU. This is to be expected, as it is not a measure directly optimized by the CTP.
The effect of TPU level in our results is consistent with the majority of Kidoâs (2016) findings. This paper demonstrates that the returns of highyielding currencies, such as the BRL, have a negative correlation with the US EPU index, whereas the Japanese yen has a positive correlation over time. In other words, when EPU falls (rises), highyield currencies appreciate (depreciate), whereas JPY falls (rises). Our previous findings show that when TPU levels are high, highyield currencies such as the CLP, BRL, and TRY experience increased volatility, which coincides with their depreciation, as illustrated in Fig. 5. The figure also depicts the Yenâs appreciation during periods of high TPU. Thus, TPU, in addition to other indicators proposed in previous research, such as the VIX proposed by Brunnermeier et al. (2008) or the EPU proposed by Kido (2016), could be a plausible indicator for detecting carry trade crushes.
Figure 6 depicts the RNâs decisions in five representative scenarios. In the first 2 scenarios (black), the price follows the meanreverting process in the entire month. RN generally buys when the price is below or equal to \(S_{0}\), and sell if the price is slightly above \(S_{0}\). The margin may be low, but profits may be high if those opportunities continue to occur throughout the month, as in scenario 1. The price process changes to the GBM with a positive drift in scenario 3 (green). As expected, the policy buys as much as it can following the change and maintains a long position until the horizon. Because the limit for holding more long positions has been reached, the income from operations is sold at the same time it is received. In scenario 4, the price process shifts to a GBM with negative drift. Similar to scenario 3, the policy now sells as much as possible while remaining short until the horizon. Because the price is expected to fall, this is the best decision in a riskfree scenario. The received income is also sold at the time of receipt. The reason for doing so, however, is different. We must sell as soon as possible in this case because the price is expected to fall. Scenario 5 depicts the RN producing one of its worst outcomes, which could occur when the price follows a meanreverting process for the majority of the month. The RN holds a short position in this case and waits for the price to revert (decrease) as expected. The price starts increasing instead. In this scenario, the income received is also sold at the same it is received, because the price is above \(S_{0}\), which compensates the loss. Finally the policy buys when the prices changes to a GBM with positive trend at \(t = 17\), and holds a long net position from that day. However, the price does not rise as anticipated (actually it suffers a slight decrease).
Conclusion and future development
This work provides a financial engineering tool for FX trading that differs significantly from the methodologies used in current FX strategies. Our methodology is based on techniques from the field of operations research, such as MSP and SDDP, which we use to create a disciplined and forwardthinking trading schedule. As demonstrated by the results, the CTP model provides competitive FX trading solutions in comparison to various benchmarks, in both nonspeculative and speculative environments, and across various time frequencies and currencies. However, the results obtained with random walk prices show that CTP solutions are competitive when there is meanreversion and/or a trend in the shocks.
In terms of incorporating specific trading rules and requirements, the tool is adaptable. It also enables the user to modify the FX price dynamics, risk tolerance, and time frequency, among other things, by simply changing the values of certain parameters. Furthermore, because currencies are defined by specific coordinates, we can develop trading policies and compute their performance for various combinations of these parameters in advance. As a result, we do not have to create the policy every time we calibrate a new FX process. As a result, all that remains is to assign the calibration results to the closest prebuilt combination.
Clearly, there are numerous ways to expand on this research. Allowing multiple currencies in the CTP model, that is, having incoming (outgoing) flows in different foreign currencies, could be one of them. Fortunately, the CTP structure would not change because we would simply add the same variables and requirements for each currency. The main challenge would be developing a multidimensional version of the lattice to describe the multivariate distribution of FX prices, which would increase the state space and make the problem unsolvable in terms of CPU time. Reus and Prado (2021) used the sddp.jl to implement a multiasset GBM process to solve an MSP problem.
Another extension would be to improve the pricing model by including a timevarying process for volatility, particularly in intraday environments. For example, we have Hansen et al.âs (2012) GARCH model with realized measures. The difficulty would arise when attempting to implement the model in the structure required by the SDDP method. Florescu and Viens (2008) may be a good reference point when including stochastic volatility in binomial trees. A third enhancement would be to allow stochastic flows in the CTP, which may be more suitable for certain applications. The sddp.jl allows for the inclusion of uncertainty in constraints in most settings. The difficulty arises when comparing the P&L across scenarios. Finally, it would be extremely useful if a practitioner could implement an automatic procedure that could take the SDDP solution and generate a readytouse policy, delivering a list of simplified instructions on how to trade in representative scenarios.
Availability of data and materials
The data used during the current study (FX prices) are available in the Refinitiv Eikon and Bloomberg platforms. The implementation of the CTP model is available upon request.
Notes
We also explain how we could add hedging instruments such as forward contracts to our model.
The TPU index used in Huynh et al. (2020) comes from Baker et al. (2019). The EPU index was designed by Baker et al. (2016) and measures the frequency of owncountry newspaper articles mentioning terms related to economic policy uncertainty. The literature review in AlThaqeb and Algharabali (2019) mentions the research relating the EPU index to exchange rates.
We should remark that \(\xi_{t}\) is classified as exogenous because its values are not optimized in the CTP. The SDDP generates values for \(\xi_{t}\) according to a stochastic process that is defined outside the CTP.
\(Q_{1} \left( {S_{0} ,P_{0} ,\xi_{1} } \right)\) is a scalar that can be named as \(z\). To follow the notation from problems (1) and (2), we could also write the objective function (6a) as: \(Q_{t} \left( {S_{t.  1} ,P_{t  1} ,\xi_{t} } \right) = \min  \left( {1  c} \right)S_{t} x_{t}^{  } + S_{t} x_{t}^{ + } + E\left[ {Q_{t + 1} \left( {S_{t} ,P_{t} ,\xi_{t + 1} } \right)} \right]\).
If not, we decompose \(x_{t}^{ + }\) into \(x_{t,s}^{ + }\), with \(x_{t} = \mathop \sum \limits_{s \ge t} x_{t,s}\).
To see more scenarios and details about the solution for the USDCLP and other currencies, see Fig. 9 in the appendix.
The RA policy is not shown in the Figure.
To see more scenarios and details about the solution for the USDCLP and other currencies, see Fig. 10 in the appendix.
The TPU index can be found in https://www.matteoiacoviello.com/tpu.htm#home
References
Abbey BS, Doukas JA (2012) Is technical analysis profitable for individual currency traders? J Portfolio Manag 39(1):142â150
Agliardi R (2018) Valueatrisk under ambiguity aversion. Financ Innov 4(1):1â13
AlThaqeb SA, Algharabali BG (2019) Economic policy uncertainty: a literature review. J Econ Asym 20:e00133
Allayannis G, Lel U, Miller DP (2012) The use of foreign currency derivatives, corporate governance, and firm value around the world. J Int Econ 87(1):65â79
Aloosh A, Bekaert G (2021) Currency factors. Manag Sci 68(6):4042â4064
ĂlvarezDĂez S, AlfaroCid E, FernĂĄndezBlanco MO (2016) Hedging foreign exchange rate risk: multicurrency diversification. Eur J Manag Bus Econ 25(1):2â7
Andersson H, Hoff A, Christiansen M, Hasle G, LĂžkketangen A (2010) Industrial aspects and literature survey: combined inventory management and routing. Comput Oper Res 37(9):1515â1536
Antonelli F, Mancini C, PÄ±nar MC (2013) Calibrated american option pricing by stochastic linear programming. Optimization 62(11):1433â1450
Baker S, Bloom N, Davis S (2019) The extraordinary rise in trade policy uncertainty. Reading 19:21
Baker SR, Bloom N, Davis SJ (2016) Measuring economic policy uncertainty. Q J Econ 131(4):1593â1636
Bandarra M, Guigues V (2021) Single cut and multicut stochastic dual dynamic programming with cut selection for multistage stochastic linear programs: convergence proof and numerical experiments. CMS 18(2):125â148
Baucke R, Downward A, Zakeri G (2017) A deterministic algorithm for solving multistage stochastic programming problems. Optim Online 2:68
Brownlees C, Engle RF (2017) Srisk: a conditional capital shortfall measure of systemic risk. Rev Financ Stud 30(1):48â79
Brunnermeier MK, Nagel S, Pedersen LH (2008) Carry trades and currency crashes. NBER Macroecon Annu 23(1):313â348
Caldara D, Iacoviello M, Molligo P, Prestipino A, Raffo A (2020) The economic effects of trade policy uncertainty. J Monet Econ 109:38â59
Caporale GM, GilAlana LA (2004) Fractional cointegration and real exchange rates. Rev Financ Econ 13(4):327â340
Carino DR, Kent T, Myers DH, Stacy C, Sylvanus M, Turner AL, Watanabe K, Ziemba WT (1994) The russellyasuda kasai model: an asset/liability model for a Japanese insurance company using multistage stochastic programming. Interfaces 24(1):29â49
Carroll A, OâBrien F, Ryan J (2017) An examination of european firmsâ derivatives usage: the importance of model selection. Eur Financ Manag 23(4):648â690
Cho JB, Min HG, McDonald JA (2020) Volatility and dynamic currency hedging. J Int Finan Markets Inst Money 64:101163
Coakley J, Marzano M, Nankervis J (2016) How profitable are fx technical trading rules? Int Rev Financ Anal 45:273â282
Colombo E, Pelagatti M (2020) Statistical learning and exchange rate forecasting. Int J Forecast 36(4):1260â1289
Consigli G, Moriggia V, Vitali S, Mercuri L (2018) Optimal insurance portfolios riskadjusted performance through dynamic stochastic programming. CMS 15(3â4):599â632
Coutinho JRR, Sheng HH, Lora MI (2012) The use of fx derivatives and the cost of capital: evidence of brazilian companies. Emerg Mark Rev 13(4):411â423
Dastile X, Celik T, Potsane M (2020) Statistical and machine learning models in credit scoring: a systematic literature survey. Appl Soft Comput 91:106263
De Matos VL, Philpott AB, Finardi EC (2015) Improving the performance of stochastic dual dynamic programming. J Comput Appl Math 290:196â208
De Oliveira AD, Filomena TP, Perlin MS, Lejeune M, de Macedo GR (2017) A multistage stochastic programming assetliability management model: an application to the Brazilian pension fund industry. Optim Eng 18(2):349â368
Deng S, Yu H, Wei C, Yang T, Tatsuro S (2020) The profitability of Ichimoku Kinkohyo based trading rules in stock markets and FX markets. Int J Financ Econ 26(4):5321â5336
Dornbusch R (1976) Expectations and exchange rate dynamics. J Polit Econ 84(6):1161â1176
Downward A, Dowson O, Baucke R (2020) Stochastic dual dynamic programming with stagewisedependent objective uncertainty. Oper Res Lett 48(1):33â39
Dowson O, Kapelevich L (2017) SDDP.jl: a Julia package for stochastic dual dynamic programming. Optim Online 3:744
Duarte T, ValladĂŁo D, Veiga A (2017) Asset liability management for open pension schemes using multistage stochastic programming under solvencyiibased regulatory constraints. Insurance Math Econ 77:177â188
DupacovĂĄ J, KozmĂk V (2017) SDDP for multistage stochastic programs: preprocessing via scenario reduction. CMS 14(1):67â80
Eichenbaum M, Evans CL (1995) Some empirical evidence on the effects of shocks to monetary policy on exchange rates. Q J Econ 110(4):975â1009
Fhoula B, Hajji A, Rekik M (2013) Stochastic dual dynamic programming for transportation planning under demand uncertainty. In: 2013 International conference on advanced logistics and transport, pp 550â555. IEEE
Florescu I, Viens FG (2008) Stochastic volatility: option pricing using a multinomial recombining tree. Appl Math Finance 15(2):151â181
Guigues V (2014) SDDP for some interstage dependent riskaverse problems and application to hydrothermal planning. Comput Optim Appl 57(1):167â203
Guigues V (2017) Dual dynamic programing with cut selection: convergence proof and numerical experiments. Eur J Oper Res 258(1):47â57
Guigues V (2021) Multistage stochastic programs with a random number of stages: dynamic programming equations, solution methods, and application to portfolio selection. Optim Methods Softw 36(1):211â236
Guigues V, Lejeune MA, Tekaya W (2020) Regularized stochastic dual dynamic programming for convex nonlinear optimization problems. Optim Eng 21(3):1133â1165
HaarbrĂŒcker G, Kuhn D (2009) Valuation of electricity swing options by multistage stochastic programming. Automatica 45(4):889â899
Hansen P, Huang Z, Shek H (2012) Realized GARCH: a joint model for returns and realized measures of volatility. J Appl Economet 27(6):877â906
HomemdeMello T, Pagnoncelli BK (2016) Risk aversion in multistage stochastic programming: a modeling and algorithmic perspective. Eur J Oper Res 249(1):188â199
Hong Y, Li H, Zhao F (2007) Can the random walk model be beaten in outofsample density forecasts? evidence from intraday foreign exchange rates. J Econ 141(2):736â776
Hu D, Schwabe G, Li X (2015) Systemic risk management and investment analysis with financial network analytics: research opportunities and challenges. Financ Innov 1(1):1â9
Huynh TLD, Nasir MA, Nguyen DK (2020) Spillovers and connectedness in foreign exchange markets: The role of trade policy uncertainty. Quarter Rev Econ Finance. In press
Jarrow RA, Rudd AT (1983) Option pricing. Irwin Professional Pub, Irwin
Jorion P, Sweeney RJ (1996) Mean reversion in real exchange rates: evidence and implications for forecasting. J Int Money Financ 15(4):535â550
Kido Y (2016) On the link between the us economic policy uncertainty and exchange rates. Econ Lett 144:49â52
Kim WC, Kwon DG, Lee Y, Kim JH, Lin C (2020) Personalized goalbased investing via multistage stochastic goal programming. Quant Finance 20(3):515â526
Kou G, Chao X, Peng Y, Alsaadi FE, HerreraViedma E (2019) Machine learning methods for systemic risk analysis in financial sectors. Technol Econ Dev Econ 25(5):716â742
Kou G, Chao X, Peng Y, Wang F (2022) Network resilience in the financial sectors: advances, key elements, applications, and challenges for financial stability regulation. Technol Econ Dev Econ 28(2):531â558
KozmĂk V, Morton DP (2015) Evaluating policies in riskaverse multistage stochastic programming. Math Program 152(1â2):275â300
Kwon RH, Li JY (2016) A stochastic semidefinite programming approach for bounds on option pricing under regime switching. Ann Oper Res 237(1):41â75
Li T, Kou G, Peng Y, Yu PS (2021) An integrated cluster detection, optimization, and interpretation approach for financial data. In: IEEE Transactions on Cybernetics, pp 1â14
Lothian JR (1997) Multicountry evidence on the behavior of purchasing power parity under the current float. J Int Money Financ 16(1):19â35
Manahov V, Hudson R, Gebka B (2014) Does high frequency trading affect technical analysis and market efficiency? And if so, how? J Int Finan Markets Inst Money 28:131â157
Maurer R, Valiani S (2007) Hedging the exchange rate risk in international portfolio diversification: currency forwards versus currency options. Managerial Finance 3:99
Mulvey JM, Martellini L, Hao H, Li N (2019) A factorand goaldriven model for defined benefit pensions: setting realistic benefits. J Portfolio Manag 45(3):165â177
Pereira MV, Pinto LM (1991) Multistage Stochastic optimization applied to energy planning. Math Program 52(1):359â375
Pham VA (2019) Impacts of the monetary policy on the exchange rate: case study of vietnam. J Asian Bus Econ Stud 26(2):220â237
Philpott AB, De Matos VL (2012) Dynamic sampling algorithms for multistage stochastic programs with risk aversion. Eur J Oper Res 218(2):470â483
Philpott AB, de Matos VL, Finardi EC (2013) On solving multistage stochastic programs with coherent risk measures. Oper Res 61(4):957â970
Reus L (2019) Currency risk in foreign currency accounts for small and mediumsized businesses. J Risk 22(2):59â78
Reus L, Pagnoncelli B, Armstrong M (2019) Better management of production incidents in mining using multistage stochastic optimization. Resour Policy 63:101404
Reus L, Prado R (2021) Need to meet investment goals? Track synthetic indexes with the SDDP method. Comput Econ 2:1â23
Rockafellar RT, Uryasev S et al (2000) Optimization of conditional valueatrisk. J Risk 2:21â42
Shapiro A, Tekaya W, da Costa JP, Soares MP (2013) Risk neutral and risk averse stochastic dual dynamic programming method. Eur J Oper Res 224(2):375â391
Sims CA (1992) Interpreting the macroeconomic time series facts: the effects of monetary policy. Eur Econ Rev 36(5):975â1000
Soares MP, Street A, ValladĂŁo DM (2017) On the solution variability reduction of stochastic dual dynamic programming applied to energy planning. Eur J Oper Res 258(2):743â760
Svoboda M, SponerovĂĄ M et al (2020) Random strategy versus technical analysis strategy: the case of EUR/USD intraday trading. Balkans J Emerg Trends Soc Sci 3(1):34â39
Tsai MF, Wang CJ (2017) On the risk prediction and analysis of soft information in finance reports. Eur J Oper Res 257(1):243â250
ValladĂŁo D, Silva T, Poggi M (2019) Timeconsistent riskconstrained dynamic portfolio optimization with transactional costs and timedependent returns. Ann Oper Res 282(1â2):379â405
Vasicek O (1977) An equilibrium characterization of the term structure. J Financ Econ 5(2):177â188
Yu X, Wan Z, Tu X, Li Y (2020) The optimal multiperiod hedging model of currency futures and options with exponential utility. J Comput Appl Math 366:112412
Zarrabi N, Snaith S, Coakley J (2017) FX technical trading rules can be profitable sometimes! Int Rev Financ Anal 49:113â127
Zhang L, Hu H, Zhang D (2015) A credit risk assessment model based on svm for small and medium enterprises in supply chain finance. Financ Innov 1(1):1â21
Acknowledgements
Not applicable.
Funding
No funding was provided for this research.
Author information
Authors and Affiliations
Contributions
Both authors worked jointly in the implementation of the tool in the sddp.jl. LR defined the settings and benchmark to be shown in the results and performed the analysis of the outcome obtained. LR did most of the manuscript writing as well. GSH worked on gathering the data and calibrating the FX price models, and also ran most of the experiments.
Corresponding author
Ethics declarations
Competing interests
The authors declare that they have no competing interests.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Reus, L., SepĂșlvedaHurtado, G.A. Foreign exchange trading and management with the stochastic dual dynamic programming method. Financ Innov 9, 23 (2023). https://doi.org/10.1186/s40854022004337
Received:
Accepted:
Published:
DOI: https://doi.org/10.1186/s40854022004337