Class FxSingleTradeCalculations
- java.lang.Object
-
- com.opengamma.strata.measure.fx.FxSingleTradeCalculations
-
public class FxSingleTradeCalculations extends Object
Calculates pricing and risk measures for single FX trades.This provides a high-level entry point for FX pricing and risk measures.
Each method takes a
ResolvedFxSingleTrade
, whereas application code will typically work withFxSingleTrade
. CallFxSingleTrade::resolve(ReferenceData)
to convertFxSingleTrade
toResolvedFxSingleTrade
.
-
-
Field Summary
Fields Modifier and Type Field Description static FxSingleTradeCalculations
DEFAULT
Default implementation.
-
Constructor Summary
Constructors Constructor Description FxSingleTradeCalculations(DiscountingFxSingleTradePricer tradePricer)
Creates an instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description MultiCurrencyScenarioArray
currencyExposure(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates currency exposure across one or more scenarios.MultiCurrencyAmount
currencyExposure(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates currency exposure for a single set of market data.MultiCurrencyScenarioArray
currentCash(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates current cash across one or more scenarios.MultiCurrencyAmount
currentCash(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates current cash for a single set of market data.ScenarioArray<FxRate>
forwardFxRate(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates the forward FX rate across one or more scenarios.FxRate
forwardFxRate(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates the forward FX rate for a single set of market data.DoubleScenarioArray
parSpread(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates par spread across one or more scenarios.double
parSpread(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates par spread for a single set of market data.MultiCurrencyScenarioArray
presentValue(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value across one or more scenarios.MultiCurrencyAmount
presentValue(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value for a single set of market data.ScenarioArray<CurrencyParameterSensitivities>
pv01CalibratedBucketed(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.CurrencyParameterSensitivities
pv01CalibratedBucketed(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.MultiCurrencyScenarioArray
pv01CalibratedSum(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.MultiCurrencyAmount
pv01CalibratedSum(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.ScenarioArray<CurrencyParameterSensitivities>
pv01MarketQuoteBucketed(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.CurrencyParameterSensitivities
pv01MarketQuoteBucketed(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.MultiCurrencyScenarioArray
pv01MarketQuoteSum(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.MultiCurrencyAmount
pv01MarketQuoteSum(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.
-
-
-
Field Detail
-
DEFAULT
public static final FxSingleTradeCalculations DEFAULT
Default implementation.
-
-
Constructor Detail
-
FxSingleTradeCalculations
public FxSingleTradeCalculations(DiscountingFxSingleTradePricer tradePricer)
Creates an instance.In most cases, applications should use the
DEFAULT
instance.- Parameters:
tradePricer
- the pricer forResolvedFxSingleTrade
-
-
Method Detail
-
presentValue
public MultiCurrencyScenarioArray presentValue(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value across one or more scenarios.- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the present value, one entry per scenario
-
presentValue
public MultiCurrencyAmount presentValue(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value for a single set of market data.- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the present value
-
pv01CalibratedSum
public MultiCurrencyScenarioArray pv01CalibratedSum(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.This is the sensitivity of present value to a one basis point shift in the calibrated curves. The result is the sum of the sensitivities of all affected curves.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the present value sensitivity, one entry per scenario
-
pv01CalibratedSum
public MultiCurrencyAmount pv01CalibratedSum(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.This is the sensitivity of present value to a one basis point shift in the calibrated curves. The result is the sum of the sensitivities of all affected curves.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the present value sensitivity
-
pv01CalibratedBucketed
public ScenarioArray<CurrencyParameterSensitivities> pv01CalibratedBucketed(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.This is the sensitivity of present value to a one basis point shift in the calibrated curves. The result is provided for each affected curve and currency, bucketed by curve node.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the present value sensitivity, one entry per scenario
-
pv01CalibratedBucketed
public CurrencyParameterSensitivities pv01CalibratedBucketed(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.This is the sensitivity of present value to a one basis point shift in the calibrated curves. The result is provided for each affected curve and currency, bucketed by curve node.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the present value sensitivity
-
pv01MarketQuoteSum
public MultiCurrencyScenarioArray pv01MarketQuoteSum(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.This is the sensitivity of present value to a one basis point shift in the market quotes used to calibrate the curves. The result is the sum of the sensitivities of all affected curves.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the present value sensitivity, one entry per scenario
-
pv01MarketQuoteSum
public MultiCurrencyAmount pv01MarketQuoteSum(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.This is the sensitivity of present value to a one basis point shift in the market quotes used to calibrate the curves. The result is the sum of the sensitivities of all affected curves.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the present value sensitivity
-
pv01MarketQuoteBucketed
public ScenarioArray<CurrencyParameterSensitivities> pv01MarketQuoteBucketed(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates present value sensitivity across one or more scenarios.This is the sensitivity of present value to a one basis point shift in the market quotes used to calibrate the curves. The result is provided for each affected curve and currency, bucketed by curve node.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the present value sensitivity, one entry per scenario
-
pv01MarketQuoteBucketed
public CurrencyParameterSensitivities pv01MarketQuoteBucketed(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates present value sensitivity for a single set of market data.This is the sensitivity of present value to a one basis point shift in the market quotes used to calibrate the curves. The result is provided for each affected curve and currency, bucketed by curve node.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the present value sensitivity
-
parSpread
public DoubleScenarioArray parSpread(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates par spread across one or more scenarios.- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the par spread, one entry per scenario
-
parSpread
public double parSpread(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates par spread for a single set of market data.- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the par spread
-
currencyExposure
public MultiCurrencyScenarioArray currencyExposure(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates currency exposure across one or more scenarios.The currency risk, expressed as the equivalent amount in each currency.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the currency exposure, one entry per scenario
-
currencyExposure
public MultiCurrencyAmount currencyExposure(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates currency exposure for a single set of market data.The currency risk, expressed as the equivalent amount in each currency.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the currency exposure
-
currentCash
public MultiCurrencyScenarioArray currentCash(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates current cash across one or more scenarios.The sum of all cash flows paid on the valuation date.
- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the current cash, one entry per scenario
-
currentCash
public MultiCurrencyAmount currentCash(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates current cash for a single set of market data.The sum of all cash flows paid on the valuation date.
- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the current cash
-
forwardFxRate
public ScenarioArray<FxRate> forwardFxRate(ResolvedFxSingleTrade trade, RatesMarketDataLookup lookup, ScenarioMarketData marketData)
Calculates the forward FX rate across one or more scenarios.- Parameters:
trade
- the tradelookup
- the lookup used to query the market datamarketData
- the market data- Returns:
- the current cash, one entry per scenario
-
forwardFxRate
public FxRate forwardFxRate(ResolvedFxSingleTrade trade, RatesProvider ratesProvider)
Calculates the forward FX rate for a single set of market data.- Parameters:
trade
- the traderatesProvider
- the market data- Returns:
- the current cash
-
-