Skip to main content

Foreign exchange trading and management with the stochastic dual dynamic programming method

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 high-dimensional MSP models. We construct our methodology within an open-source SDDP package, avoiding implementing the method from scratch. To measure the performance of our policies, we model FX prices as a mean-reverting 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 ex-post 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 hard-to-recover losses and dramatic changes in net income, particularly in a competitive low-margin 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 FX-based 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 non-speculative 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 single-period 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 long-term horizon planning. Applications to pension funds (e.g., Duarte et al. 2017; De Oliveira et al. 2017) and asset-liability 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 goal-driven 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 regime-switching models to derive European-style 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 state-spaces, 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 forward-looking 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 in-depth 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 time-dependent 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 non-linear 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 open-source 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 index-based 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., Álvarez-Díez et al. 2016) has used risk measures to find hedging positions in one- and two-stage settings. However, as Homem-de-Mello 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 mean-reverting process in a financial application. The algorithm was initially designed to work with stage-independent 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 SDDP-generated 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 value-at-risk 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 k-Means 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 time-dependent 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\):

$$\begin{aligned} & z = \mathop {\min }\limits_{{x_{1} \ge l_{1} }} c_{1} x_{1} + E\left[ {Q_{2} \left( {x_{1} ,\xi_{2} } \right)} \right] \\ & {\text{subject}}\;{\text{to}}:A_{1} x_{1} = b_{1} - B_{1} x_{0} \\ \end{aligned}$$
(1)

For \(t = 2, \ldots ,T\):

$$\begin{aligned} & Q_{1} \left( {x_{t - 1} ,\xi_{t} } \right) = \mathop {\min }\limits_{{x_{t} \ge l_{t} }} c_{t} x_{t} + E\left[ {Q_{t + 1} \left( {x_{t} ,\xi_{t + 1} } \right)} \right] \\ & {\text{subject}}\;{\text{to}}:A_{t} x_{t} = b_{t} - B_{t} x_{t - 1} \\ \end{aligned}$$
(2)

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 near-optimal 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:

Fig. 1
figure 1

Linear approximations (dashed lines) of the exact value of function Q

For \(t = 1\):

$$z = \mathop {\min }\limits_{{\theta_{2} ,x_{1} \ge l_{1} }} c_{1} x_{1} + \theta_{2}$$
(3a)
$${\text{subject}}\;{\text{to}}:A_{1} x_{1} = b_{1} - B_{1} x_{0} [\pi_{1} ]$$
(3b)
$$\theta_{2} \ge g_{2}^{k,s} + G_{2}^{k,s} x_{1} , k = 1, \ldots ,K, s = 1, \ldots ,N$$
(3c)

For \(t = 2, \ldots ,T\):

$$z = \mathop {\min }\limits_{{\theta_{t + 1} ,x_{t} \ge l_{t} }} c_{t} x_{t} + \theta_{t + 1}$$
(4a)
$${\text{subject}}\;{\text{to}}:A_{t} x_{t} = b_{t} - B_{t} x_{t - 1} \left[ {\pi_{t} } \right]$$
(4b)
$$\theta_{t + 1} \ge g_{t + 1}^{k,s} + G_{t + 1}^{k,s} x_{t} , k = 1, \ldots ,K, s = 1, \ldots ,N$$
(4c)

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 pseudo-code 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\).

figure a

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 non-convex 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

$$\rho \left( X \right) = \beta E\left[ X \right] + \left( {1 - \beta } \right)RM\left[ X \right],$$
(5)

where \(\beta\) ∈ [0, 1], which is a convex combination of the expected value and the risk measure. The Conditional Value-at-Risk (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\):

$$Q_{t} \left( {S_{t - 1} ,P_{t - 1} ,\xi_{t} } \right) = \max \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]$$
(6a)
$$\begin{aligned} & {\text{subject}}\;{\text{to}}: \\ & P_{t} = P_{t - 1} + x_{t}^{ + } - x_{t}^{ - } + f_{t} \forall t \ge 1 \\ \end{aligned}$$
(6b)
$$S_{t} = \xi_{t} \left( {S_{t - 1} } \right) \forall t \ge 1$$
(6c)
$$x_{t}^{ + } ,x_{t}^{ - } \ge 0 \forall t \ge 1$$
(6d)

For \(t = T\):

$$\begin{aligned} & Q_{T} \left( {S_{T - 1} ,P_{T - 1} ,\xi_{T} } \right) = \max \left( {1 - c} \right)S_{T} x_{T}^{ - } - S_{T} x_{T}^{ + } + P_{T} S_{T} \left( {1 - c} \right) \\ & {\text{subject}}\;{\text{to}}:\left( {{\text{6b}}} \right),\left( {{\text{6c}}} \right),\left( {{\text{6d}}} \right) \\ \end{aligned}$$
(7a)

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 “no-hedge” 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 non-speculative purposes.

The CTP also admits a complete hedge (i.e. risk-free 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:

$$\left( {1 - c} \right)K_{t}^{T} x_{t}^{ - } - K_{t}^{T} x_{t}^{ + } = \left[ {\left( {1 - c} \right)S_{t} x_{t}^{ - } - S_{t} x_{t}^{ + } } \right] + \left[ {\left( {1 - c} \right)fp_{t}^{T} x_{t}^{ - } - fp_{t}^{T} x_{t}^{ + } } \right]$$
(8)

Furthermore, if we consider \(fp_{t}^{T}\) to be similar in time (as is the case for short-horizon 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 mean-reversion in real exchange rates (e.g., Jorion and Sweeney 1996; Lothian 1997; Caporale and Gil-Alana 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 mean-reversion 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 short-term 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.

Fig. 2
figure 2

Scenario structure for price movements when \(T = 5\). (Left): General scenario tree. The number of states (nodes) is equal to \(\frac{{2^{5} - 1}}{2 - 1} = 31\). (Right): Lattice. The number of states (nodes) is equal to \(\mathop \sum \limits_{k = 1}^{5} k = 15\)

Given all of the preceding considerations, we present a model that follows a Vasicek mean-reverting process and can transform into a GBM in the presence of an external random shock. Vasicek dynamics can be expressed as

$$dS_{t} = \kappa \left( {S_{\infty } - S_{t} } \right)dt + \sigma_{v} dW_{t}$$
(9)

with \(dW_{t}\) a Brownian process. \(S_{\infty }\) is the long-run mean-level 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:

$$S_{{t + {\Delta }t}} = S_{t} e^{{ - \kappa {\Delta }t}} + S_{\infty } \left( {1 - e^{{ - \kappa {\Delta }t}} } \right) + \sigma_{v} e^{{ - \kappa {\Delta }t}} \mathop \smallint \limits_{t}^{{t + {\Delta }t}} e^{{ - \kappa \left( {{\text{t}} - {\text{u}}} \right)}} dW_{u}$$
(10)

From Eq. (10), we see that \(S_{t}\) is a Gaussian process with the following mean and variance:

$$\begin{aligned} & \mu_{S,t} = E\left( {S_{t + \Delta t} } \right) = S_{t} e^{ - \kappa \Delta t} + S_{\infty } \left( {1 - e^{ - \kappa \Delta t} } \right) \\ & \sigma_{S}^{2} = V\left( {S_{t + \Delta t} } \right) = \frac{{\sigma_{v}^{2} }}{2\kappa }\left( {1 - e^{ - 2\kappa \Delta t} } \right) \\ \end{aligned}$$
(11)

With formulas in (11), we can then construct a binomial lattice with the following structure:

$$S_{{t + {\Delta }t}} = \left\{ {\begin{array}{*{20}l} {\mu_{S,t} + \sigma_{S} } \hfill & {if\;\xi_{t} = 1, P\left( {\xi_{t} = 1} \right) = \frac{1}{2}} \hfill \\ {\mu_{S,t} - \sigma_{S} } \hfill & {if\;\xi_{t} = 0, P\left( {\xi_{t} = 0} \right) = \frac{1}{2}} \hfill \\ \end{array} } \right.$$
(12)

Besides the mean-reverting 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),

$$S_{{t + {\Delta }t}} = \left\{ {\begin{array}{*{20}l} {S_{t} e^{{\hat{\mu }{\Delta }t + \hat{\sigma }\sqrt {{\Delta }t} }} ,} \hfill & {P\left( {\xi_{t} = 1} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{\hat{\mu }{\Delta }t - \hat{\sigma }\sqrt {{\Delta }t} }} ,} \hfill & {P\left( {\xi_{t} = 0} \right) = \frac{1}{2}} \hfill \\ \end{array} } \right.$$
(13)

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 mean-reverting (\(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}\):

$$E_{t} = \left\{ {\begin{array}{*{20}l} {E_{t - 1} ,} \hfill & {if\;E_{t - 1} = \pm 1} \hfill \\ {\delta_{t} } \hfill & {if\;E_{t - 1} = 0} \hfill \\ \end{array} } \right.$$
(14)

The second is the price \(S_{{t + {\Delta }t}}\), which depends on two states variables (\(E_{t}\) and \(S_{t}\)), and \(\xi_{t}\) as

$$S_{{t + {\Delta }t}} = \left\{ {\begin{array}{*{20}l} {S_{t} e^{{ - \kappa {\Delta }t}} + S_{\infty } \left( {1 - e^{{ - \kappa {\Delta }t}} } \right) + \frac{{\sigma_{v} }}{{\sqrt {2\kappa } }}\sqrt {1 - e^{{ - 2\kappa {\Delta }t}} } ,} \hfill & {{\text{if}}\;E_{t} = 0, \xi_{t} = 1, P\left( {\xi_{t} = 1\left| {E_{t} = 0} \right.} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{ - \kappa {\Delta }t}} + S_{\infty } \left( {1 - e^{{ - \kappa {\Delta }t}} } \right) - \frac{{\sigma_{v} }}{{\sqrt {2\kappa } }}\sqrt {1 - e^{{ - 2\kappa {\Delta }t}} } ,} \hfill & { {\text{if}}\;E_{t} = 0, \xi_{t} = 0, P\left( {\xi_{t} = 0\left| {E_{t} = 0} \right.} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{\hat{\mu }{\Delta }t + \hat{\sigma }\sqrt {{\Delta }t} }} ,} \hfill & {{\text{if}}\;E_{t} = 1, \xi_{t} = 1, P\left( {\xi_{t} = 1\left| {E_{t} = 1} \right.} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{\hat{\mu }{\Delta }t - \hat{\sigma }\sqrt {{\Delta }t} }} ,} \hfill & {{\text{if}}\;E_{t} = 1, \xi_{t} = 0, P\left( {\xi_{t} = 0\left| {E_{t} = 1} \right.} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{ - \hat{\mu }{\Delta }t + \hat{\sigma }\sqrt {{\Delta }t} }} ,} \hfill & {{\text{if}}\;E_{t} = - 1, \xi_{t} = 1, P\left( {\xi_{t} = 1\left| {E_{t} = - 1} \right.} \right) = \frac{1}{2}} \hfill \\ {S_{t} e^{{ - \hat{\mu }{\Delta }t - \hat{\sigma }\sqrt {{\Delta }t} }} , } \hfill & {{\text{if}}\;E_{t} = - 1, \xi_{t} = 0, P\left( {\xi_{t} = 0\left| {E_{t} = - 1} \right.} \right) = \frac{1}{2}} \hfill \\ \end{array} } \right.$$
(15)

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 Quad-Core 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 15-min 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 mean-reverting 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 long-term volatility \(\sigma /\sqrt {2{\kappa }}\), with \(\sigma : = \sigma_{v} /S_{0}\). Figure 7 shows the calibration results in greater detail.

Table 1 Estimates of parameters \({\kappa }\) and \(\sigma_{v}\) defining the mean-reverting process in (12) are obtained from a sample containing 15-min intraday prices from 9 a.m. to 2 p.m. within the period January 2020 to December 2021

Setting 1: Non-speculative 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.

$$Q_{t} \left( {S_{t - 1} ,P_{t - 1} ,\xi_{t} } \right) = \min S_{t} x_{t}^{ + } + E\left[ {Q_{t + 1} \left( {S_{t} ,P_{t} ,\xi_{t + 1} } \right)} \right]$$
$$Q_{T} \left( {S_{T - 1} ,P_{T - 1} ,\xi_{T} } \right) = \min S_{T} x_{T}^{ + }$$

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 “no-hedge” 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 ex-post 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 weighted-average 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:

Table 2 Performance of CTP solutions RN and RA versus benchmark policies (B1, B2 and NH), when \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\)
  1. 1.

    In terms of average costs, there is a small gap between the RF and the ex-post 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. 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 long-term 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. 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. 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. 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. 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 long-term volatility in the mean-reverting 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 mean-reverting to GBM) influences future decisions. In the first two scenarios (black), the price always follows a mean-reverting 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

Fig. 3
figure 3

RN solutions for seven representative scenarios. The first plot shows the value of state variable \(E_{t}\), which tracks whether there is a change in the FX price dynamics: 0 if prices follow the mean-reverting process of Eq. (12) and 1 (− 1) if prices follow the GBM of Eq. (13) with an upward (downward) trend. The second plot shows the evolution of the FX prices and the third plot shows the fraction purchased (amount purchased from total demand of D = 1)

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 mean-reversion 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 ex-post 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 non-speculative setting.

  1. 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. 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 worst-case scenarios (a bad scenario for this policy would be a flat FX rate). As a result, its VaR and CVaR are negative.

  3. 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 worst-case 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. 4.

    We can effectively reduce extreme losses with RA policies, at the expense of reducing average profits.

Table 3 Performance results of CTP solutions (RN and RA) versus S1, when \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\)

The difference in performance between currency pairs is due to FX process calibration. We can make more money in emerging-market 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 mean-reverting 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.

Fig. 4
figure 4

RN solution for 7 representative scenarios. The position is bounded by L = 1, i.e., \(- 1 \le P_{t} \le 1\)

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 mean-reverting 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 non-developed economies rises significantly, in contrast to G-10 currencies.

Table 4 Estimates of parameters \({\kappa }\) and \(\sigma_{v}\) defining the mean-reverting process in (12) are obtained from daily prices within the period January-2000 to December-2021

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 weighted-average 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 weighted-average 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

$$x_{B2,t} = \left\{ {\begin{array}{*{20}l} {\frac{{f_{5} }}{5} + \frac{{f_{10} }}{10} + \frac{{f_{15} }}{15} + \frac{{f_{20} }}{20} = \frac{5.1D}{{60}},} \hfill & {if\;t :1..5} \hfill \\ {\frac{{f_{10} }}{10} + \frac{{f_{15} }}{15} + \frac{{f_{20} }}{20} = \frac{3.9D}{{60}},} \hfill & {if\;t :6..10} \hfill \\ {\frac{{f_{15} }}{15} + \frac{{f_{20} }}{20} = \frac{2.7D}{{60}},} \hfill & {if\;t :11..15} \hfill \\ {\frac{{f_{20} }}{20} = \frac{0.3D}{{60}},} \hfill & {if\;t :16..20} \hfill \\ \end{array} } \right.$$
(16)

Applying the trades in (16), the weighted-average selling price of B2 is

$$\mathop \sum \limits_{t = 1}^{T} S_{t} \frac{{x_{B2,t} }}{D} = \frac{1}{60}\left[ {5.1\mathop \sum \limits_{t = 1}^{5} S_{t} + 3.9\mathop \sum \limits_{t = 6}^{10} S_{t} + 2.7\mathop \sum \limits_{t = 11}^{15} S_{t} + 0.3\mathop \sum \limits_{t = 16}^{20} S_{t} } \right]$$
(17)

For RF and NH, the weighted-average 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. 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 worst-case scenarios, RA policies could be used to reduce losses.

  2. 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. 3.

    Adjusting for time differences, the profit-risk 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 worst-case 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 worst-case 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.

Table 5 P&L of CTP solutions (RN and RA) versus benchmark policy S1
Table 6 Weighted-average selling price of CTP solutions (RN and RA) versus benchmark policies B1, B2 and NH

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 45-pip drift seen in Table 4. Note that the latter occurs with every currency. Second, if we extrapolate the long-term 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 long-term volatility of USDTRY \(\sqrt {20} { } \times { }\sigma /\sqrt {2\kappa } = \sqrt {20} { } \times { }0.17\% = 0.76\%\), which is bigger than the long-term 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 weighted-average 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 emerging-market 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 high-TPU period increases (decreases) long-term volatility. We have not shown the weighted-average 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.

Table 7 P&L of CTP solutions (RN and RA) versus benchmark policy S1

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 high-yielding 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), high-yield currencies appreciate (depreciate), whereas JPY falls (rises). Our previous findings show that when TPU levels are high, high-yield 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.

Fig. 5
figure 5

Historical exchange rates under normal and high levels of TPU. The shaded areas correspond to periods of high TPU. The threshold is defined by the 75th percentile of the sample, which is at level 47, approximately

Figure 6 depicts the RN’s decisions in five representative scenarios. In the first 2 scenarios (black), the price follows the mean-reverting 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 risk-free 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 mean-reverting 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).

Fig. 6
figure 6

RN solution for 5 representative scenarios in a daily trading setting, with the following income structure: \(f_{1} = 0.1D, f_{10} = 0.2D, f_{15} = 0.6D, f_{20} = 0.1D\) and \(f_{t} = 0\) otherwise. Speculation is allowed with positions bounded by L = 1, i.e.\(- 1 \le P_{t} \le 1\). The total income equals D = 1

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 forward-thinking trading schedule. As demonstrated by the results, the CTP model provides competitive FX trading solutions in comparison to various benchmarks, in both non-speculative 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 mean-reversion 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 multi-asset GBM process to solve an MSP problem.

Another extension would be to improve the pricing model by including a time-varying 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 ready-to-use 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

  1. See the use and effect of FX derivatives in Allayannis et al. (2012), Carroll et al. (2017), Coutinho et al. (2012)

    and references therein.

  2. See Álvarez-Díez et al. (2016) and Reus (2019) for small and medium businesses (SMB). See Maurer and Valiani (2007) and Cho et al. (2020) and references therein for the hedging of international portfolios.

  3. We also explain how we could add hedging instruments such as forward contracts to our model.

  4. 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 own-country newspaper articles mentioning terms related to economic policy uncertainty. The literature review in Al-Thaqeb and Algharabali (2019) mentions the research relating the EPU index to exchange rates.

  5. See Kou et al. (2022) for details about the resilience of financial networks and Tsai and Wang (2017) to know more about text mining methods in finance.

  6. 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.

  7. \(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]\).

  8. If not, we decompose \(x_{t}^{ + }\) into \(x_{t,s}^{ + }\), with \(x_{t} = \mathop \sum \limits_{s \ge t} x_{t,s}\).

  9. To see more scenarios and details about the solution for the USDCLP and other currencies, see Fig. 9 in the appendix.

  10. The RA policy is not shown in the Figure.

  11. To see more scenarios and details about the solution for the USDCLP and other currencies, see Fig. 10 in the appendix.

  12. 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

    Article  Google Scholar 

  • Agliardi R (2018) Value-at-risk under ambiguity aversion. Financ Innov 4(1):1–13

    Article  Google Scholar 

  • Al-Thaqeb SA, Algharabali BG (2019) Economic policy uncertainty: a literature review. J Econ Asym 20:e00133

    Google Scholar 

  • 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

    Article  Google Scholar 

  • Aloosh A, Bekaert G (2021) Currency factors. Manag Sci 68(6):4042–4064

    Article  Google Scholar 

  • Álvarez-DĂ­ez S, Alfaro-Cid E, FernĂĄndez-Blanco MO (2016) Hedging foreign exchange rate risk: multi-currency diversification. Eur J Manag Bus Econ 25(1):2–7

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Antonelli F, Mancini C, Pınar MC (2013) Calibrated american option pricing by stochastic linear programming. Optimization 62(11):1433–1450

    Article  Google Scholar 

  • Baker S, Bloom N, Davis S (2019) The extraordinary rise in trade policy uncertainty. Reading 19:21

    Google Scholar 

  • Baker SR, Bloom N, Davis SJ (2016) Measuring economic policy uncertainty. Q J Econ 131(4):1593–1636

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Baucke R, Downward A, Zakeri G (2017) A deterministic algorithm for solving multistage stochastic programming problems. Optim Online 2:68

    Google Scholar 

  • Brownlees C, Engle RF (2017) Srisk: a conditional capital shortfall measure of systemic risk. Rev Financ Stud 30(1):48–79

    Article  Google Scholar 

  • Brunnermeier MK, Nagel S, Pedersen LH (2008) Carry trades and currency crashes. NBER Macroecon Annu 23(1):313–348

    Article  Google Scholar 

  • Caldara D, Iacoviello M, Molligo P, Prestipino A, Raffo A (2020) The economic effects of trade policy uncertainty. J Monet Econ 109:38–59

    Article  Google Scholar 

  • Caporale GM, Gil-Alana LA (2004) Fractional cointegration and real exchange rates. Rev Financ Econ 13(4):327–340

    Article  Google Scholar 

  • Carino DR, Kent T, Myers DH, Stacy C, Sylvanus M, Turner AL, Watanabe K, Ziemba WT (1994) The russell-yasuda kasai model: an asset/liability model for a Japanese insurance company using multistage stochastic programming. Interfaces 24(1):29–49

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Cho J-B, Min H-G, McDonald JA (2020) Volatility and dynamic currency hedging. J Int Finan Markets Inst Money 64:101163

    Article  Google Scholar 

  • Coakley J, Marzano M, Nankervis J (2016) How profitable are fx technical trading rules? Int Rev Financ Anal 45:273–282

    Article  Google Scholar 

  • Colombo E, Pelagatti M (2020) Statistical learning and exchange rate forecasting. Int J Forecast 36(4):1260–1289

    Article  Google Scholar 

  • Consigli G, Moriggia V, Vitali S, Mercuri L (2018) Optimal insurance portfolios risk-adjusted performance through dynamic stochastic programming. CMS 15(3–4):599–632

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Dastile X, Celik T, Potsane M (2020) Statistical and machine learning models in credit scoring: a systematic literature survey. Appl Soft Comput 91:106263

    Article  Google Scholar 

  • De Matos VL, Philpott AB, Finardi EC (2015) Improving the performance of stochastic dual dynamic programming. J Comput Appl Math 290:196–208

    Article  Google Scholar 

  • De Oliveira AD, Filomena TP, Perlin MS, Lejeune M, de Macedo GR (2017) A multistage stochastic programming asset-liability management model: an application to the Brazilian pension fund industry. Optim Eng 18(2):349–368

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Dornbusch R (1976) Expectations and exchange rate dynamics. J Polit Econ 84(6):1161–1176

    Article  Google Scholar 

  • Downward A, Dowson O, Baucke R (2020) Stochastic dual dynamic programming with stagewise-dependent objective uncertainty. Oper Res Lett 48(1):33–39

    Article  Google Scholar 

  • Dowson O, Kapelevich L (2017) SDDP.jl: a Julia package for stochastic dual dynamic programming. Optim Online 3:744

    Google Scholar 

  • Duarte T, ValladĂŁo D, Veiga A (2017) Asset liability management for open pension schemes using multistage stochastic programming under solvency-ii-based regulatory constraints. Insurance Math Econ 77:177–188

    Article  Google Scholar 

  • DupacovĂĄ J, KozmĂ­k V (2017) SDDP for multistage stochastic programs: preprocessing via scenario reduction. CMS 14(1):67–80

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Guigues V (2014) SDDP for some interstage dependent risk-averse problems and application to hydro-thermal planning. Comput Optim Appl 57(1):167–203

    Article  Google Scholar 

  • Guigues V (2017) Dual dynamic programing with cut selection: convergence proof and numerical experiments. Eur J Oper Res 258(1):47–57

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Guigues V, Lejeune MA, Tekaya W (2020) Regularized stochastic dual dynamic programming for convex nonlinear optimization problems. Optim Eng 21(3):1133–1165

    Article  Google Scholar 

  • HaarbrĂŒcker G, Kuhn D (2009) Valuation of electricity swing options by multistage stochastic programming. Automatica 45(4):889–899

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Homem-de-Mello T, Pagnoncelli BK (2016) Risk aversion in multistage stochastic programming: a modeling and algorithmic perspective. Eur J Oper Res 249(1):188–199

    Article  Google Scholar 

  • Hong Y, Li H, Zhao F (2007) Can the random walk model be beaten in out-of-sample density forecasts? evidence from intraday foreign exchange rates. J Econ 141(2):736–776

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • 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

    Google Scholar 

  • Jorion P, Sweeney RJ (1996) Mean reversion in real exchange rates: evidence and implications for forecasting. J Int Money Financ 15(4):535–550

    Article  Google Scholar 

  • Kido Y (2016) On the link between the us economic policy uncertainty and exchange rates. Econ Lett 144:49–52

    Article  Google Scholar 

  • Kim WC, Kwon D-G, Lee Y, Kim JH, Lin C (2020) Personalized goal-based investing via multi-stage stochastic goal programming. Quant Finance 20(3):515–526

    Article  Google Scholar 

  • Kou G, Chao X, Peng Y, Alsaadi FE, Herrera-Viedma E (2019) Machine learning methods for systemic risk analysis in financial sectors. Technol Econ Dev Econ 25(5):716–742

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • KozmĂ­k V, Morton DP (2015) Evaluating policies in risk-averse multi-stage stochastic programming. Math Program 152(1–2):275–300

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • 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) Multi-country evidence on the behavior of purchasing power parity under the current float. J Int Money Financ 16(1):19–35

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Maurer R, Valiani S (2007) Hedging the exchange rate risk in international portfolio diversification: currency forwards versus currency options. Managerial Finance 3:99

    Google Scholar 

  • Mulvey JM, Martellini L, Hao H, Li N (2019) A factor-and goal-driven model for defined benefit pensions: setting realistic benefits. J Portfolio Manag 45(3):165–177

    Article  Google Scholar 

  • Pereira MV, Pinto LM (1991) Multi-stage Stochastic optimization applied to energy planning. Math Program 52(1):359–375

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Philpott AB, De Matos VL (2012) Dynamic sampling algorithms for multi-stage stochastic programs with risk aversion. Eur J Oper Res 218(2):470–483

    Article  Google Scholar 

  • Philpott AB, de Matos VL, Finardi EC (2013) On solving multistage stochastic programs with coherent risk measures. Oper Res 61(4):957–970

    Article  Google Scholar 

  • Reus L (2019) Currency risk in foreign currency accounts for small and medium-sized businesses. J Risk 22(2):59–78

    Google Scholar 

  • Reus L, Pagnoncelli B, Armstrong M (2019) Better management of production incidents in mining using multistage stochastic optimization. Resour Policy 63:101404

    Article  Google Scholar 

  • Reus L, Prado R (2021) Need to meet investment goals? Track synthetic indexes with the SDDP method. Comput Econ 2:1–23

    Google Scholar 

  • Rockafellar RT, Uryasev S et al (2000) Optimization of conditional value-at-risk. J Risk 2:21–42

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • Sims CA (1992) Interpreting the macroeconomic time series facts: the effects of monetary policy. Eur Econ Rev 36(5):975–1000

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

  • 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

    Google Scholar 

  • Tsai M-F, Wang C-J (2017) On the risk prediction and analysis of soft information in finance reports. Eur J Oper Res 257(1):243–250

    Article  Google Scholar 

  • ValladĂŁo D, Silva T, Poggi M (2019) Time-consistent risk-constrained dynamic portfolio optimization with transactional costs and time-dependent returns. Ann Oper Res 282(1–2):379–405

    Article  Google Scholar 

  • Vasicek O (1977) An equilibrium characterization of the term structure. J Financ Econ 5(2):177–188

    Article  Google Scholar 

  • Yu X, Wan Z, Tu X, Li Y (2020) The optimal multi-period hedging model of currency futures and options with exponential utility. J Comput Appl Math 366:112412

    Article  Google Scholar 

  • Zarrabi N, Snaith S, Coakley J (2017) FX technical trading rules can be profitable sometimes! Int Rev Financ Anal 49:113–127

    Article  Google Scholar 

  • 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

    Article  Google Scholar 

Download references

Acknowledgements

Not applicable.

Funding

No funding was provided for this research.

Author information

Authors and Affiliations

Authors

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

Correspondence to Lorenzo Reus.

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.

Appendix

Appendix

See Figs. 7, 8, 9, 10 and Table 8.

Fig. 7
figure 7

\(\kappa\) and \(\sigma\) (%) estimations for the intraday price dynamics following the Vasicek model of Eq. (12). These values are obtained by calibrating the model with daily data and their average are the values shown in Table 1

Fig. 8
figure 8

\(\kappa\) and \(\sigma\) (%) estimations for the daily price dynamics following the Vasicek model of Eq. (12). These values are obtained by calibrating the model with daily data and their average are the values shown in Table 4

Fig. 9
figure 9figure 9

Sample of the RN solution described in "Setting 1: Non-speculative trading" section. FX price follows the dynamics in (15). Scenarios in grey follow the Vasicek model during the entire day. Scenarios in green and red have a shock during the day, which changes the dynamics to a GBM model with negative(green) or positive(red) drift

Fig. 10
figure 10figure 10

Sample of the RN solution described in "Setting 2: Speculative trading" section. FX price follows the dynamics in (15). The figure shows the results from 4 exchanges: USDCLP, USDTRY, GBPUSD and USDJPY. Scenarios in grey follow the Vasicek model during the entire day. Scenarios in green and red have a shock during the day, which changes the dynamics to a GBM model with negative(green) or positive(red) drift

Table 8 Performance of CTP solutions RN and RA versus benchmark policies B1, B2 and NH. The subscript in RN and RA is the ÎČ used in Eq. (5), which defines the degree of risk aversion

Sensitivity analysis on setting 1: non-speculative trading

See Tables 9, 10.

Table 9 (Up): Sensitivity analysis of the long-term volatility \(\sigma /\sqrt {2\kappa }\) in the mean reverting intraday price process for USDCLP
Table 10 Sensitivity analysis of \(\hat{\sigma }\) in the GBM intraday price process for the USDCLP. The rest of the parameters are kept unchanged and we set \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\)

Sensitivity analysis on setting 2: speculative trading

See Table 11.

Table 11 (Up): Sensitivity analysis in the intraday mean-reverting price process for USDCLP. When one parameter changes, the rest are kept unchanged and we set \(\left( {\pi_{u} , \pi_{d} } \right) = \left( {1.25\% , 3.75\% } \right)\)

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/.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Reus, L., SepĂșlveda-Hurtado, G.A. Foreign exchange trading and management with the stochastic dual dynamic programming method. Financ Innov 9, 23 (2023). https://doi.org/10.1186/s40854-022-00433-7

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1186/s40854-022-00433-7

Keywords