Enum AnyTemplate
#[non_exhaustive]pub enum AnyTemplate {
Show 20 variants
Ois(OisTemplate),
MeetingOis(MeetingOisTemplate),
Vanilla(SwapTemplate),
Zcs(ZcsTemplate),
Xccy(XccySwapTemplate),
FxSwap(FxSwapTemplate),
Cds(CdsTemplate),
CreditIndex(CreditIndexTemplate),
Deposit(DepositTemplate),
Future(FutureTemplate),
Fra(FraTemplate),
TenorBasis(TenorBasisTemplate),
Trs(TrsTemplate),
Bond(BondTemplate),
Swaption(SwaptionTemplate),
Ndf(NdfTemplate),
Nds(NdsTemplate),
FutureOption(FutureOptionTemplate),
Ndo(NdoTemplate),
Repo(RepoTemplate),
}Expand description
A convention template tagged by its product group. The product builders
accept any Into<AnyTemplate>, and the registry resolves a code to one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Ois(OisTemplate)
An OIS (fixed vs compounded RFR) template.
MeetingOis(MeetingOisTemplate)
A meeting-date OIS (single inter-meeting-window bullet) template.
Vanilla(SwapTemplate)
A vanilla IBOR (fixed vs term float) template.
Zcs(ZcsTemplate)
A zero-coupon-swap template.
Xccy(XccySwapTemplate)
A cross-currency swap template.
FxSwap(FxSwapTemplate)
An FX-swap pillar template (cross-collateral discount-curve calibration).
Cds(CdsTemplate)
A credit default swap template.
CreditIndex(CreditIndexTemplate)
A credit index family (CDX / iTraxx) template.
Deposit(DepositTemplate)
A money-market deposit pillar template (type = "MoneyMarket").
Future(FutureTemplate)
A rate-future pillar template (type = "RateFuture").
Fra(FraTemplate)
A forward-rate-agreement projection pillar template (type = "FRA").
TenorBasis(TenorBasisTemplate)
A single-currency tenor-basis projection pillar template (type = "TenorBasis").
Trs(TrsTemplate)
A bond total return swap template.
Bond(BondTemplate)
An outright-bond template (settlement/quote conventions; the security
itself resolves by ISIN through the Securities).
Swaption(SwaptionTemplate)
A swaption template — an option on an OIS or vanilla swap. Its expiry is a deal term (the forward start), not a template field.
Ndf(NdfTemplate)
A non-deliverable FX forward template — one market’s EMTA terms.
Nds(NdsTemplate)
A non-deliverable interest rate swap template — a local swap settled in USD at its NDF’s fixings.
FutureOption(FutureOptionTemplate)
An option on a listed bond future — one exchange contract’s terms.
Ndo(NdoTemplate)
A non-deliverable FX option template — one market’s EMTA NDO terms.
Repo(RepoTemplate)
A general-collateral repo template — one currency’s money-market terms.
Implementations§
§impl AnyTemplate
impl AnyTemplate
pub fn swap(&self, trade_date: NaiveDate) -> Result<ProductBuilder, CurveError>
pub fn swap(&self, trade_date: NaiveDate) -> Result<ProductBuilder, CurveError>
A draft of this template’s swap on trade_date, every term defaulted:
effective at spot, ten years long, on 10,000,000, receiving fixed, and
no fixed rate — stated with ProductBuilder::with_fixed_rate or
struck with ProductBuilder::at_par before it builds. Refined by the
builder’s verbs, each returning a new draft; the verb the Python
Template.swap forwards to.
§Errors
CurveError::NotASwapTemplate for a template whose family builds no
swap; otherwise as swap_builder_on_tenor.
§impl AnyTemplate
impl AnyTemplate
pub fn ndf(
&self,
trade_date: NaiveDate,
tenor: Period,
notional: f64,
forward_rate: f64,
short: bool,
) -> Result<FxForward, NdfError>
pub fn ndf( &self, trade_date: NaiveDate, tenor: Period, notional: f64, forward_rate: f64, short: bool, ) -> Result<FxForward, NdfError>
A non-deliverable forward drafted from this NDF template: notional
of the settlement currency bought (sold when short) against the
reference currency at forward_rate, for a tenor forward traded on
trade_date.
Spot is the template’s spot lag in business days of the joint
(valuation and settlement) calendar, the value date spot plus the tenor
rolled by the template’s convention and end-of-month rule, and the
fixing date the template’s fixing date for that value date. The forward
is cash-settled in the settlement currency on the pair’s canonical FX
key, settlement currency as base (FX-USDKRW), so the stored fixing is
reference per settlement as every Annex A rate quotes.
§Errors
NdfError::NotNdf for a template of another family, naming it;
NdfError::FixingNotAfterTrade when the fixing would fall on or
before the trade date.
§impl AnyTemplate
impl AnyTemplate
pub fn repo(
&self,
side: RepoSide,
start: NaiveDate,
end: NaiveDate,
rate: RepoRate,
collateral: FixedRateBond,
amount: RepoAmount,
price: f64,
margin_ratio: f64,
) -> Result<Repo, RepoError>
pub fn repo( &self, side: RepoSide, start: NaiveDate, end: NaiveDate, rate: RepoRate, collateral: FixedRateBond, amount: RepoAmount, price: f64, margin_ratio: f64, ) -> Result<Repo, RepoError>
A repo drafted on this repo template: its currency, money-market day
count and margin basis, with the caller’s side, dates, rate, collateral
and amount — RepoTemplate::floating
for a rate on the market’s overnight index.
§Errors
RepoError::NotARepoTemplate
for a template of another family; otherwise as the repo’s constructors.
pub fn ndo(
&self,
trade_date: NaiveDate,
tenor: Period,
notional: f64,
strike: f64,
kind: OptionKind,
) -> Result<FxOption, NdoError>
pub fn ndo( &self, trade_date: NaiveDate, tenor: Period, notional: f64, strike: f64, kind: OptionKind, ) -> Result<FxOption, NdoError>
A non-deliverable option drafted from this NDO template: a European
kind on notional of the settlement currency against the reference
currency at the absolute strike (reference per settlement), settled
as the NDF terms date it — settlement tenor from spot on the joint
calendar, the fixing the lag before it — expiring on the fixing date
(the EMTA templates’ Expiration Date is the Valuation Date), its payoff
paid in cash in the settlement currency on the settlement date.
§Errors
NdoError::NotNdo for a template of another family, naming it;
NdoError::FixingNotAfterTrade when the fixing would fall on or
before the trade date.
§impl AnyTemplate
impl AnyTemplate
pub fn nds(
&self,
trade_date: NaiveDate,
tenor: Period,
notional: f64,
fixed_rate: f64,
pays_fixed: bool,
) -> Result<AnyInstrument, NdsError>
pub fn nds( &self, trade_date: NaiveDate, tenor: Period, notional: f64, fixed_rate: f64, pays_fixed: bool, ) -> Result<AnyInstrument, NdsError>
A non-deliverable swap drafted from this NDS template: the local swap
its market trades, tenor long from spot on trade_date, on
notional at fixed_rate — paying fixed when pays_fixed — with every
payment of both legs settling in the template’s settlement currency at
the FX fixing its NDF terms date, the payment adjusted Preceding onto
the fixing calendar and stepped back the lag.
A tenor within the template’s zero-coupon limit pays once at maturity
on both legs; a template whose fixed leg compounds (BRL) accrues
(1 + K)^τ into its single payment.
§Errors
NdsError::NotNds for a template of another family, naming it;
NdsError::Swap where the local swap does not draft;
NdsError::Settlement where its legs refuse the conversion.
§impl AnyTemplate
impl AnyTemplate
pub fn family(&self) -> &'static str
pub fn family(&self) -> &'static str
The family’s name, as a refusal names it and the template surface reports it.
pub fn with_settlement_currency(
self,
code: &str,
) -> Result<Self, XccyTemplateError>
pub fn with_settlement_currency( self, code: &str, ) -> Result<Self, XccyTemplateError>
This NDS or non-deliverable cross-currency template settling in
code — see NdsTemplate::with_settlement_currency
and XccySwapTemplate::with_settlement_currency.
§Errors
xccy::XccyTemplateError::NoSettlement for any other family, naming
it; xccy::XccyTemplateError::Deliverable on a deliverable
cross-currency template.
pub fn with_initial_exchange(
self,
initial: bool,
) -> Result<Self, XccyTemplateError>
pub fn with_initial_exchange( self, initial: bool, ) -> Result<Self, XccyTemplateError>
This cross-currency template exchanging its notional at the start as
well as the end, or, with false, at the end alone — see
XccySwapTemplate::with_initial_exchange.
§Errors
xccy::XccyTemplateError::NotCrossCurrency for a template of
another family, naming it, and
xccy::XccyTemplateError::InitialExchangeOnResetting on a resetting
one.
Trait Implementations§
§impl Clone for AnyTemplate
impl Clone for AnyTemplate
§fn clone(&self) -> AnyTemplate
fn clone(&self) -> AnyTemplate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more