Struct PyTemplate
pub struct PyTemplate {
inner: AnyTemplate,
code: String,
}Expand description
A resolved convention template, and the code it resolved from.
The module-level constructors take a template code and resolve conventions from the registry, which is the right default and stays. This is the other path: a template a caller can modify before building from it.
Frozen. Every with_* returns a new Template and leaves the receiver
alone, as the Rust builders do.
Fields§
§inner: AnyTemplate§code: StringImplementations§
§impl PyTemplate
impl PyTemplate
fn future(&self) -> PyResult<&FutureTemplate>
fn future(&self) -> PyResult<&FutureTemplate>
This template’s rate-future conventions, or the family refusal.
fn rebuilt(&self, inner: AnyTemplate) -> Self
fn rebuilt(&self, inner: AnyTemplate) -> Self
inner under this template’s code — every with_* rebuilds through
here, so the tail of each override is one line rather than four.
fn swap_override(
&self,
what: &str,
ois: impl FnOnce(OisTemplate) -> OisTemplate,
vanilla: impl FnOnce(SwapTemplate) -> SwapTemplate,
) -> PyResult<Self>
fn swap_override( &self, what: &str, ois: impl FnOnce(OisTemplate) -> OisTemplate, vanilla: impl FnOnce(SwapTemplate) -> SwapTemplate, ) -> PyResult<Self>
An override the overnight and vanilla swap families carry and whose
vanilla_swap constructor here reads: ois and vanilla rebuild
their template, a CDS carries the field but has no constructor for it
to reach, and every other family is refused by name. One dispatch for
the whole payment-override family, so adding a family means one arm
here rather than one per method.
fn with_float_projection(
self,
leg: &str,
projection: Option<&str>,
) -> PyResult<Self>
fn with_float_projection( self, leg: &str, projection: Option<&str>, ) -> PyResult<Self>
A single-currency swap template’s leg ("fixed" or "float") with
the per-leg terms given; a term the family does not carry on that leg
is refused by name rather than ignored.
A vanilla or zero-coupon template’s float leg forwarding over its own
accrual ("accrual_period", par coupons) or its index’s window.
fn with_fixed_business_day(
self,
leg: &str,
convention: Option<BusinessDayConvention>,
) -> PyResult<Self>
fn with_fixed_business_day( self, leg: &str, convention: Option<BusinessDayConvention>, ) -> PyResult<Self>
This vanilla template with its fixed leg rolling under convention,
the floating leg keeping the template’s: the one schedule term a
vanilla template carries per leg.
fn single_currency_leg( &self, leg: &str, frequency: Option<Frequency>, day_count: Option<DayCountFraction>, compounding: Option<AccrualCompounding>, ) -> PyResult<Self>
fn schedule_override(
&self,
what: &str,
ois: impl FnOnce(OisTemplate) -> OisTemplate,
vanilla: impl FnOnce(SwapTemplate) -> SwapTemplate,
zcs: impl FnOnce(ZcsTemplate) -> ZcsTemplate,
fra: impl FnOnce(FraTemplate) -> FraTemplate,
) -> PyResult<Self>
fn schedule_override( &self, what: &str, ois: impl FnOnce(OisTemplate) -> OisTemplate, vanilla: impl FnOnce(SwapTemplate) -> SwapTemplate, zcs: impl FnOnce(ZcsTemplate) -> ZcsTemplate, fra: impl FnOnce(FraTemplate) -> FraTemplate, ) -> PyResult<Self>
As swap_override, for the overrides the
schedule-deriving families also read: a zero-coupon swap advances its
start under them, an FRA its spot and forward start. A deposit, an FX
swap and the meeting-dated OIS carry them with no constructor here to
reach, and every other family is refused by name.
§impl PyTemplate
impl PyTemplate
fn swap(&self, trade_date: NaiveDate) -> PyResult<PyProductBuilder>
fn swap(&self, trade_date: NaiveDate) -> PyResult<PyProductBuilder>
A draft of this template’s swap on trade_date, every term defaulted:
effective at spot, ten years long, 10,000,000, receiving fixed, and no
fixed rate until with_fixed_rate or at_par(market). A template
whose family builds no swap raises ValueError naming the family.
pub(crate) fn family(&self) -> &'static str
pub(crate) fn family(&self) -> &'static str
The template family’s name — the same spelling a wrong-family refusal uses, so the two cannot drift.
fn __repr__(&self) -> String
fn calendar(&self) -> PyResult<PyCalendar>
fn calendar(&self) -> PyResult<PyCalendar>
The calendar this template’s schedules are built on — the resolved calendar itself, not a code that would have to be re-resolved.
Handing back the engine’s own handle is what makes a caller’s date arithmetic the engine’s: a code re-resolved on this side could differ from the one the template holds and nothing would say so. A family that carries no single schedule calendar is refused by name.
fn spot_lag(&self) -> PyResult<String>
fn spot_lag(&self) -> PyResult<String>
The spot lag this template’s default effective date is taken at, as a
tenor ("2D"). A family that carries none is refused by name.
fn spot_date(&self, valuation: NaiveDate) -> PyResult<NaiveDate>
fn spot_date(&self, valuation: NaiveDate) -> PyResult<NaiveDate>
The default effective date this template takes for valuation — the one
seam every product builder and calibration helper resolves an effective
date through.
Exposed so that a caller can check their own date arithmetic against the
engine’s rather than assume it: calendar(), spot_lag() and the
business-day primitives should compose to exactly this.
fn with_spot_lag(&self, days: i32) -> PyResult<Self>
fn with_spot_lag(&self, days: i32) -> PyResult<Self>
This template with the spot lag overridden, in business days.
Accepted only where a constructor method on this class reads it:
the zero-coupon swap, whose zero_coupon_swap(valuation, tenor, ...)
derives its effective date from the lag, and the NDF, whose
ndf(trade_date, tenor, ...) counts spot from it.
Every other family is refused, and the two refusals say different things. A family that carries no spot lag at all is told so. A family that carries one whose constructor here takes explicit dates is told that — because the field is real and a caller who set it would otherwise reasonably believe it had done something.
fn with_business_day_convention(
&self,
business_day_convention: Named<BusinessDayConvention>,
) -> PyResult<Self>
fn with_business_day_convention( &self, business_day_convention: Named<BusinessDayConvention>, ) -> PyResult<Self>
This template generating its schedule under convention, rather than
the registered one.
Unadjusted, the accrual boundaries stay on their unadjusted dates,
which is what makes with_payment_convention observable: a schedule
rolled by its own convention has no weekend boundary left for a payment
to move. The pair — unadjusted accrual, rolled payment — is the one the
street books.
fn with_payment_convention(
&self,
business_day_convention: Named<BusinessDayConvention>,
) -> PyResult<Self>
fn with_payment_convention( &self, business_day_convention: Named<BusinessDayConvention>, ) -> PyResult<Self>
This template with the payment date rolled under convention,
separate from the convention its schedule is generated with — a
payment convention, which the street applies with a lag of zero.
The accrual does not move, so a coupon’s amount is unchanged. A payment lag already lands on a business day, so the convention bites where the lag is zero and the schedule is unadjusted, which is the pair the street uses.
fn with_meeting_node(&self, node: &str) -> PyResult<Self>
fn with_meeting_node(&self, node: &str) -> PyResult<Self>
This meeting-OIS template with its rungs noded at node:
"window_end" (the default, where each decision’s rate takes effect)
or "payment_date" (the swap’s payment date, for reconciling to a
curve noded there — a turn is refused under it). Any
other family raises ValueError.
fn with_payment_lag(&self, days: i32) -> PyResult<Self>
fn with_payment_lag(&self, days: i32) -> PyResult<Self>
This template with the payment lag overridden, in business days.
Accepted for the overnight and vanilla swap families, whose
vanilla_swap here builds the legs the lag dates. A CDS carries one
too, but this class has no CDS constructor for it to reach.
fn with_float_payment_convention(
&self,
business_day_convention: Named<BusinessDayConvention>,
) -> PyResult<Self>
fn with_float_payment_convention( &self, business_day_convention: Named<BusinessDayConvention>, ) -> PyResult<Self>
This template with the floating leg’s payment convention set,
leaving the fixed leg on whatever with_payment_convention set.
A swap’s two sides need not follow the same market’s agreement. Naming only the shared convention still sets both, so this is the override for the side that differs rather than a second way to say the same thing.
fn with_float_payment_lag(&self, days: i32) -> PyResult<Self>
fn with_float_payment_lag(&self, days: i32) -> PyResult<Self>
This template with the floating leg’s payment lag set, in business days, leaving the fixed leg on the shared one.
fn with_calendar(&self, calendar: &Bound<'_, PyAny>) -> PyResult<Self>
fn with_calendar(&self, calendar: &Bound<'_, PyAny>) -> PyResult<Self>
This template generating on calendar — a Calendar or its lookup
expression ("USNY,GBLO") — rather than its registered business
centres, FpML’s businessCenters stated per trade. A payment lag with
no payment calendar of its own rolls on it too.
fn with_date_generation(&self, date_generation: &str) -> PyResult<Self>
fn with_date_generation(&self, date_generation: &str) -> PyResult<Self>
This template generating its swaps’ schedules in date_generation’s
direction: "Backward" from the termination, any stub at the front,
or "Forward" from the
effective date, the stub at the back, as every registered template
builds. An OIS or vanilla swap template takes it; another family
raises ValueError.
fn with_roll_convention(
&self,
roll_convention: Named<RollConvention>,
) -> PyResult<Self>
fn with_roll_convention( &self, roll_convention: Named<RollConvention>, ) -> PyResult<Self>
This template rolling its interior boundaries under roll_convention
— a day of the month ("20"), "EOM", "IMM" — rather than its
registered roll, FpML’s rollConvention stated per trade.
fn with_float_payment_calendar(&self, calendar: &str) -> PyResult<Self>
fn with_float_payment_calendar(&self, calendar: &str) -> PyResult<Self>
This template with the floating leg’s payment calendar set, leaving the fixed leg on the shared one.
pub(crate) fn vanilla_swap(
&self,
effective: NaiveDate,
termination: PyTermination,
fixed_rate: f64,
notional: f64,
pays_fixed: bool,
accrual_compounding: Option<Named<AccrualCompounding>>,
) -> PyResult<PyInstrument>
pub(crate) fn vanilla_swap( &self, effective: NaiveDate, termination: PyTermination, fixed_rate: f64, notional: f64, pays_fixed: bool, accrual_compounding: Option<Named<AccrualCompounding>>, ) -> PyResult<PyInstrument>
A swap on this template’s conventions, carrying any override applied.
Two forms, told apart by termination. A date is the dated form:
effective is the first accrual date and termination the last. A
tenor such as "5Y" or "2Y2Y" is the quoted form: effective
is then the valuation date, the swap starts at this template’s spot
date advanced by the forward start, and runs the tenor from there. The
termination is spot plus tenor unadjusted; the schedule rolls it.
pays_fixed defaults to False: the default swap receives fixed.
The notional is taken as signed, so a negative notional flips every
flow rather than being refused.
pub(crate) fn forward_rate_agreement(
&self,
valuation: Option<NaiveDate>,
forward_start: Option<&str>,
accrual_start: Option<NaiveDate>,
accrual_end: Option<NaiveDate>,
fixing_date: Option<NaiveDate>,
notional: f64,
struck_rate: f64,
receiver: bool,
) -> PyResult<PyInstrument>
pub(crate) fn forward_rate_agreement( &self, valuation: Option<NaiveDate>, forward_start: Option<&str>, accrual_start: Option<NaiveDate>, accrual_end: Option<NaiveDate>, fixing_date: Option<NaiveDate>, notional: f64, struck_rate: f64, receiver: bool, ) -> PyResult<PyInstrument>
A forward-rate agreement on this template: from valuation and
forward_start, or over stated contract dates accrual_start,
accrual_end and fixing_date, as contract_dates reads them back.
pub(crate) fn money_market_deposit(
&self,
start: NaiveDate,
maturity: NaiveDate,
rate: f64,
notional: f64,
lending: bool,
issuer: Option<&str>,
) -> PyResult<PyInstrument>
pub(crate) fn money_market_deposit( &self, start: NaiveDate, maturity: NaiveDate, rate: f64, notional: f64, lending: bool, issuer: Option<&str>, ) -> PyResult<PyInstrument>
A money-market deposit on this template, over explicit dates. On an
IRS template it fixes on the floating index and is valued on that
index’s curve — an index-based deposit, the rung that opens a
projection ladder.
issuer tags the deposit taker’s credit; an index-based deposit is a
curve rung and refuses one.
pub(crate) fn tri_party_repo(
&self,
start: NaiveDate,
end: &Bound<'_, PyAny>,
side: &str,
cash: f64,
schedule: &str,
allocation: Vec<(PyRef<'_, PyFixedRateBond>, f64, f64)>,
rate: Option<f64>,
spread: Option<f64>,
) -> PyResult<PyInstrument>
pub(crate) fn tri_party_repo( &self, start: NaiveDate, end: &Bound<'_, PyAny>, side: &str, cash: f64, schedule: &str, allocation: Vec<(PyRef<'_, PyFixedRateBond>, f64, f64)>, rate: Option<f64>, spread: Option<f64>, ) -> PyResult<PyInstrument>
A tri-party repo drafted on this template: cash lent (side
"reverse") or borrowed ("repo") at rate or spread under the
collateral schedule (its repo curve key), against allocation, each
(bond, nominal, haircut) the agent has allocated.
pub(crate) fn securities_loan(
&self,
start: NaiveDate,
end: &Bound<'_, PyAny>,
side: &str,
security: &PyFixedRateBond,
price: f64,
nominal: f64,
fee: f64,
rebate: Option<f64>,
margin_ratio: f64,
repo_key: Option<&str>,
isin: Option<&str>,
repo_group: Option<&str>,
interest_dates: Option<Vec<NaiveDate>>,
) -> PyResult<PyInstrument>
pub(crate) fn securities_loan( &self, start: NaiveDate, end: &Bound<'_, PyAny>, side: &str, security: &PyFixedRateBond, price: f64, nominal: f64, fee: f64, rebate: Option<f64>, margin_ratio: f64, repo_key: Option<&str>, isin: Option<&str>, repo_group: Option<&str>, interest_dates: Option<Vec<NaiveDate>>, ) -> PyResult<PyInstrument>
A securities loan drafted on this template: security lent (side
"lend") or borrowed ("borrow") on nominal face at price, for
fee a year on its dirty value, accrued daily and paid on each of
interest_dates (monthly, say) and at the end. With rebate, against
cash at that rate (the repo at the rebate, paid on the same dates);
without, against other securities.
pub(crate) fn repo(
&self,
start: NaiveDate,
end: &Bound<'_, PyAny>,
side: &str,
collateral: &PyFixedRateBond,
price: f64,
rate: Option<f64>,
spread: Option<f64>,
nominal: Option<f64>,
cash: Option<f64>,
margin_ratio: f64,
coupons: &str,
repo_key: Option<&str>,
isin: Option<&str>,
repo_group: Option<&str>,
margin_basis: Option<&str>,
interest_dates: Option<Vec<NaiveDate>>,
fx_rate: Option<f64>,
) -> PyResult<PyInstrument>
pub(crate) fn repo( &self, start: NaiveDate, end: &Bound<'_, PyAny>, side: &str, collateral: &PyFixedRateBond, price: f64, rate: Option<f64>, spread: Option<f64>, nominal: Option<f64>, cash: Option<f64>, margin_ratio: f64, coupons: &str, repo_key: Option<&str>, isin: Option<&str>, repo_group: Option<&str>, margin_basis: Option<&str>, interest_dates: Option<Vec<NaiveDate>>, fx_rate: Option<f64>, ) -> PyResult<PyInstrument>
A repo drafted on this template.
pub(crate) fn rate_future(
&self,
valuation: Option<NaiveDate>,
accrual_start: Option<NaiveDate>,
accrual_end: Option<NaiveDate>,
contracts: f64,
traded_price: f64,
short: bool,
convexity_adjustment: Option<f64>,
) -> PyResult<PyInstrument>
pub(crate) fn rate_future( &self, valuation: Option<NaiveDate>, accrual_start: Option<NaiveDate>, accrual_end: Option<NaiveDate>, contracts: f64, traded_price: f64, short: bool, convexity_adjustment: Option<f64>, ) -> PyResult<PyInstrument>
A STIR futures position on this template: the front contract from
valuation, or over stated contract dates accrual_start and
accrual_end, as contract_dates reads them back.
pub(crate) fn rate_future_contract(
&self,
year: i32,
month: u32,
contracts: f64,
traded_price: f64,
short: bool,
convexity_adjustment: Option<f64>,
) -> PyResult<PyInstrument>
pub(crate) fn rate_future_contract( &self, year: i32, month: u32, contracts: f64, traded_price: f64, short: bool, convexity_adjustment: Option<f64>, ) -> PyResult<PyInstrument>
The listed futures contract of this template for a delivery month.
pub(crate) fn reference_period(
&self,
year: i32,
month: u32,
) -> PyResult<(NaiveDate, NaiveDate)>
pub(crate) fn reference_period( &self, year: i32, month: u32, ) -> PyResult<(NaiveDate, NaiveDate)>
The reference period of this rate-future template’s listed contract for a delivery month: the IMM quarter starting on the month’s third Wednesday, or the calendar month itself.
pub(crate) fn last_trading_day(
&self,
year: i32,
month: u32,
) -> PyResult<Option<NaiveDate>>
pub(crate) fn last_trading_day( &self, year: i32, month: u32, ) -> PyResult<Option<NaiveDate>>
The day this template’s listed contract for a delivery month stops
trading under the exchange’s rule, on the template’s calendar standing
in for the exchange’s; None where the rule is not sourced.
pub(crate) fn tick_size(
&self,
year: i32,
month: u32,
as_of: NaiveDate,
) -> PyResult<Option<f64>>
pub(crate) fn tick_size( &self, year: i32, month: u32, as_of: NaiveDate, ) -> PyResult<Option<f64>>
The listed contract’s minimum price fluctuation on as_of, in index
points; None where the exchange’s rule is not sourced.
pub(crate) fn zero_coupon_swap(
&self,
valuation: Option<NaiveDate>,
tenor: Option<&str>,
effective: Option<NaiveDate>,
maturity: Option<NaiveDate>,
notional: f64,
fixed_rate: f64,
receiver: bool,
) -> PyResult<PyInstrument>
pub(crate) fn zero_coupon_swap( &self, valuation: Option<NaiveDate>, tenor: Option<&str>, effective: Option<NaiveDate>, maturity: Option<NaiveDate>, notional: f64, fixed_rate: f64, receiver: bool, ) -> PyResult<PyInstrument>
A zero-coupon swap on this template: tenor from valuation, or
between stated dates effective and maturity, as
contract_dates reads them back.
pub(crate) fn nds(
&self,
trade_date: NaiveDate,
tenor: &str,
notional: f64,
fixed_rate: f64,
pays_fixed: bool,
) -> PyResult<PyInstrument>
pub(crate) fn nds( &self, trade_date: NaiveDate, tenor: &str, notional: f64, fixed_rate: f64, pays_fixed: bool, ) -> PyResult<PyInstrument>
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, every payment settling in USD at the FX
fixing two business days before it — read back through
fixings_needed and cashflow_records.
pub(crate) fn ndf(
&self,
trade_date: NaiveDate,
tenor: &str,
notional: f64,
forward_rate: f64,
short: bool,
) -> PyResult<PyInstrument>
pub(crate) fn ndf( &self, trade_date: NaiveDate, tenor: &str, notional: f64, forward_rate: f64, short: bool, ) -> PyResult<PyInstrument>
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, the value date and the fixing date come from the
template’s calendars and lags; the forward is cash-settled on the
pair’s FX key (FX-USDKRW) in the settlement currency.
pub(crate) fn ndo(
&self,
trade_date: NaiveDate,
tenor: &str,
notional: f64,
strike: f64,
kind: Named<OptionKind>,
) -> PyResult<PyInstrument>
pub(crate) fn ndo( &self, trade_date: NaiveDate, tenor: &str, notional: f64, strike: f64, kind: Named<OptionKind>, ) -> PyResult<PyInstrument>
A non-deliverable FX option drafted from this NDO template: a
European kind on notional of the settlement currency at the
absolute strike, expiring on the fixing date the NDF terms give for
a tenor settlement from spot on trade_date, its payoff paid in cash
in the settlement currency.
pub(crate) fn tenor_basis_swap(
&self,
effective: NaiveDate,
termination: NaiveDate,
notional: f64,
spread: f64,
spread_leg: Option<&str>,
) -> PyResult<PyInstrument>
pub(crate) fn tenor_basis_swap( &self, effective: NaiveDate, termination: NaiveDate, notional: f64, spread: f64, spread_leg: Option<&str>, ) -> PyResult<PyInstrument>
A tenor basis swap on this template: the leg on spread_leg carries
spread and is received, against the other index flat, paid.
spread_leg defaults to the template’s spread index — the first in its
code, EUR-EURIBOR-6M for EUR-EURIBOR-6M-3M-BASIS; naming the other
index moves the spread there, as a EUR 3s6s basis quoted on the 3M leg
carries it.
fn with_leg_index(&self, leg: &str, index: &Bound<'_, PyAny>) -> PyResult<Self>
fn with_leg_index(&self, leg: &str, index: &Bound<'_, PyAny>) -> PyResult<Self>
This cross-currency template with the leg leg projecting on the
registered index index instead: its kind and currency follow the
index, every other convention is kept.
leg is "leg1", "leg2" or the leg’s currency. On an OIS template
leg is "float" and index a registered overnight index in the
template’s currency — EONIA on the ESTR template.
fn with_leg_conventions(
&self,
leg: &str,
frequency: Option<Named<Frequency>>,
day_count: Option<Named<DayCountFraction>>,
calendar: Option<&PyCalendar>,
business_day_convention: Option<Named<BusinessDayConvention>>,
end_of_month: Option<bool>,
date_generation: Option<&str>,
payment_lag: Option<i32>,
fixing_lag: Option<i32>,
projection: Option<&str>,
accrual_compounding: Option<Named<AccrualCompounding>>,
) -> PyResult<Self>
fn with_leg_conventions( &self, leg: &str, frequency: Option<Named<Frequency>>, day_count: Option<Named<DayCountFraction>>, calendar: Option<&PyCalendar>, business_day_convention: Option<Named<BusinessDayConvention>>, end_of_month: Option<bool>, date_generation: Option<&str>, payment_lag: Option<i32>, fixing_lag: Option<i32>, projection: Option<&str>, accrual_compounding: Option<Named<AccrualCompounding>>, ) -> PyResult<Self>
This cross-currency template with conventions of the leg leg
overridden; every argument left None keeps what the leg had.
frequency is a coupon frequency ("Quarterly"), day_count a day
count, calendar a Calendar, business_day_convention a rolling
rule, date_generation "Backward" or "Forward", payment_lag the
business days a coupon is paid after its period, fixing_lag the
business days an IBOR coupon fixes before its period, and projection
the window an IBOR coupon reads its index over: "index_tenor" (the
index’s own tenor, the default) or "accrual_period" (the coupon’s
own period, a par coupon). They differ where a rolled period
end jumps a month end.
On an OIS, vanilla or zero-coupon swap template leg is "fixed" or
"float", and only the terms that template carries per leg apply:
frequency, day_count and accrual_compounding as the family has
them, and on a vanilla or zero-coupon template’s float leg projection. Those templates share one schedule across both legs, so the
schedule terms are refused there; with_calendar and
with_business_day_convention set them.
fn with_quoted_leg(&self, leg: &str) -> PyResult<Self>
fn with_quoted_leg(&self, leg: &str) -> PyResult<Self>
This cross-currency template quoting its spread on the leg leg.
fn with_resetting_leg(&self, leg: Option<&str>) -> PyResult<Self>
fn with_resetting_leg(&self, leg: Option<&str>) -> PyResult<Self>
This cross-currency template resetting the notional of the leg leg
to the forward FX rate every period, or, with None, exchanging a
constant notional at start and end.
fn with_leg_fx(&self, leg: &str, ndf: Option<&str>) -> PyResult<Self>
fn with_leg_fx(&self, leg: &str, ndf: Option<&str>) -> PyResult<Self>
This non-deliverable cross-currency template with the leg leg
converting into the settlement currency at the fixing the registered
NDF template ndf dates, or, with None, converting at none.
leg is "leg1", "leg2" or the leg’s currency. A deliverable
template has nothing to convert into and raises ValueError, as does
a code that is not a registered NDF template.
fn with_initial_exchange(&self, initial: bool) -> PyResult<Self>
fn with_initial_exchange(&self, initial: bool) -> PyResult<Self>
This cross-currency template exchanging its notional at the start as
well as the end, or, with false, at the end alone; an opted-in
initial exchange on a non-deliverable template converts at the deal
rate.
fn with_settlement_currency(&self, code: &str) -> PyResult<Self>
fn with_settlement_currency(&self, code: &str) -> PyResult<Self>
This NDS or non-deliverable cross-currency template settling in
code: a fixing sourced against USD crosses through USD into it.
Any other family raises ValueError naming it.
fn with_csa(&self, csa: &str) -> PyResult<Self>
fn with_csa(&self, csa: &str) -> PyResult<Self>
This cross-currency template under the CSA csa: its overnight index
("EUR-ESTR"), or a collateral currency ("EUR"), read as the index
that currency’s shipped own curve calibrates on.
fn cross_currency_legs(&self) -> PyResult<Vec<(String, String, String)>>
fn cross_currency_legs(&self) -> PyResult<Vec<(String, String, String)>>
The side quoted, "leg1" or "leg2", and each leg’s currency and
index, so a customised template can be checked.
pub(crate) fn cross_currency_swap(
&self,
effective: NaiveDate,
termination: NaiveDate,
notional: f64,
fx_rate: f64,
spread: Option<f64>,
fixed_rate: Option<f64>,
pays_quoted_leg: bool,
own_curves: bool,
) -> PyResult<PyInstrument>
pub(crate) fn cross_currency_swap( &self, effective: NaiveDate, termination: NaiveDate, notional: f64, fx_rate: f64, spread: Option<f64>, fixed_rate: Option<f64>, pays_quoted_leg: bool, own_curves: bool, ) -> PyResult<PyInstrument>
A cross-currency swap on this template; with own_curves, no CSA: each
leg discounted on its own currency’s curve.
Trait Implementations§
§impl Clone for PyTemplate
impl Clone for PyTemplate
§fn clone(&self) -> PyTemplate
fn clone(&self) -> PyTemplate
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl DerefToPyAny for PyTemplate
§impl IntoPy<Py<PyAny>> for PyTemplate
impl IntoPy<Py<PyAny>> for PyTemplate
§impl PyClass for PyTemplate
impl PyClass for PyTemplate
§impl PyClassImpl for PyTemplate
impl PyClassImpl for PyTemplate
§const IS_BASETYPE: bool = false
const IS_BASETYPE: bool = false
§const IS_SUBCLASS: bool = false
const IS_SUBCLASS: bool = false
§const IS_MAPPING: bool = false
const IS_MAPPING: bool = false
§const IS_SEQUENCE: bool = false
const IS_SEQUENCE: bool = false
§type ThreadChecker = SendablePyClass<PyTemplate>
type ThreadChecker = SendablePyClass<PyTemplate>
§type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild
§type BaseNativeType = PyAny
type BaseNativeType = PyAny
PyAny by default, and when you declare
#[pyclass(extends=PyDict)], it’s PyDict.fn items_iter() -> PyClassItemsIter
fn lazy_type_object() -> &'static LazyTypeObject<Self>
fn dict_offset() -> Option<isize>
fn weaklist_offset() -> Option<isize>
§impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyTemplate
impl<'a, 'py> PyFunctionArgument<'a, 'py> for &'a PyTemplate
§impl PyMethods<PyTemplate> for PyClassImplCollector<PyTemplate>
impl PyMethods<PyTemplate> for PyClassImplCollector<PyTemplate>
fn py_methods(self) -> &'static PyClassItems
§impl PyTypeInfo for PyTemplate
impl PyTypeInfo for PyTemplate
§fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject
§fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>
§fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type or a subclass of this type.§fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool
object is an instance of this type.