Struct FxForward
pub struct FxForward {
pub base: Currency,
pub quote: Currency,
pub base_amount: f64,
pub quote_amount: f64,
pub value_date: NaiveDate,
pub settlement: Settlement,
pub base_collateral: CollateralSpec,
pub quote_collateral: CollateralSpec,
}Expand description
An outright FX forward.
Fields§
§base: CurrencyThe base currency — the one unit being priced.
quote: CurrencyThe quote currency — what one unit of base costs.
base_amount: f64Signed base-currency amount; positive receives (buys) base.
quote_amount: f64Signed quote-currency amount, opposite in sign to base_amount.
value_date: NaiveDateThe exchange (settlement) date.
settlement: SettlementPhysical or cash settlement.
base_collateral: CollateralSpecThe collateral key the base-currency leg discounts under.
quote_collateral: CollateralSpecThe collateral key the quote-currency leg discounts under.
Implementations§
§impl FxForward
impl FxForward
pub fn new(
base: Currency,
quote: Currency,
base_amount: f64,
contract_rate: f64,
value_date: NaiveDate,
) -> Self
pub fn new( base: Currency, quote: Currency, base_amount: f64, contract_rate: f64, value_date: NaiveDate, ) -> Self
A physically settled forward buying base_amount of base (selling
when negative) against base_amount·contract_rate of quote on
value_date, each leg discounting on its own currency’s cash collateral.
pub fn contract_rate(&self) -> f64
pub fn contract_rate(&self) -> f64
The contract rate, quote per one base.
pub fn cash_settled(
self,
index: impl Into<FixingSource>,
fixing_date: NaiveDate,
settle: Currency,
) -> Result<Self, FxError>
pub fn cash_settled( self, index: impl Into<FixingSource>, fixing_date: NaiveDate, settle: Currency, ) -> Result<Self, FxError>
This forward cash-settled at index’s fixing on fixing_date, paid
in settle. index is one FX key or a FixingSource cross.
The leg that is never paid discounts on its offshore curve,
{CCY}-CSA-USD — the dollar-collateralised curve NDF outrights mark —
and the settlement leg on its own; a later
with_collateral still overrides.
§Errors
FxError::SettlementOutsidePair if settle is neither currency;
FxError::SourceOutsidePair for a cross that does not fix this
pair’s quote per base in its base.
pub fn with_collateral(
self,
base: CollateralSpec,
quote: CollateralSpec,
) -> Self
pub fn with_collateral( self, base: CollateralSpec, quote: CollateralSpec, ) -> Self
This forward with both legs discounting under the given collateral keys.
pub fn reoriented(&self) -> Self
pub fn reoriented(&self) -> Self
The same forward quoted the other way round: the quote currency as
base, each amount and collateral key kept with its currency, the
settlement unchanged — a cash settlement’s key or cross is read
inverted for it (FixingsView::observe_for_pair).
pub fn reversed(&self) -> Self
pub fn reversed(&self) -> Self
The forward with both amounts negated — the other side of the trade.
Trait Implementations§
§impl<R: Scalar> Priceable<R> for FxForward
impl<R: Scalar> Priceable<R> for FxForward
§fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
fn npv(&self, view: &PricingView<'_, R>) -> Result<R, PricingError>
Value in currency: for a
physical forward, the base leg converted at spot plus the quote leg,
each discounted on its own curve, in the quote currency; for a
cash-settled forward, the net at the fixing — published if its date
has passed or has printed today, else the parity forward — paid and
valued in the settlement currency.
§fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_rate(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
fn par_spread(&self, _view: &PricingView<'_, R>) -> Result<R, PricingError>
§impl PricingRiskFactors for FxForward
impl PricingRiskFactors for FxForward
§fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
fn risk_factors(&self) -> Result<RiskFactors<'_>, PricingError>
§impl Product for FxForward
impl Product for FxForward
§fn currency(&self) -> Currency
fn currency(&self) -> Currency
§fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
fn contract_dates(&self) -> Vec<(&'static str, NaiveDate)>
(name, date) pairs —
exactly the dates its stated constructor takes, so a product built
through a derived form can be read back and rebuilt through the stated
one. Empty for a product with no stated form. No default: every
product states which it is — see AnyInstrument::contract_dates.§fn legs(&self) -> Option<Vec<&Leg>>
fn legs(&self) -> Option<Vec<&Leg>>
None
for a product that holds none — see AnyInstrument::legs. No
default: every product states which it is.§fn final_payment_date(&self) -> Option<NaiveDate>
fn final_payment_date(&self) -> Option<NaiveDate>
None for a product no ladder is built from.§fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
fn restruck_at_rate(&self, _rate: f64) -> Option<AnyInstrument>
rate — the scalar a par
calibration rung on it is quoted in — or None for a product that
carries no such scalar. What a quote scenario moves a rung to.§fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
fn restruck_at_spread(&self, _spread: f64) -> Option<AnyInstrument>
spread on its spread
leg, or None for a product that quotes none.