Skip to main content

PyProductBuilder

Struct PyProductBuilder 

pub struct PyProductBuilder {
    inner: ProductBuilder,
    code: String,
}
Expand description

A swap draft: a template’s swap with every term defaulted — effective at the template’s spot from the trade date, ten years long, 10,000,000, receiving fixed — and no fixed rate until one is stated or struck at par.

Frozen: every with_* returns a new draft. Not an instrument: a draft has no rate, and build says so rather than pricing a swap at 0%.

Fields§

§inner: ProductBuilder§code: String

Implementations§

§

impl PyProductBuilder

fn refined(&self, inner: ProductBuilder) -> Self

fn end_of(end: PyTermination) -> PyResult<Termination>

§

impl PyProductBuilder

fn with_notional(&self, notional: f64) -> Self

This draft on notional.

fn with_fixed_rate(&self, fixed_rate: f64) -> Self

This draft at fixed_rate.

fn with_side(&self, side: &str) -> PyResult<Self>

This draft on side: "payer" pays fixed, "receiver" receives it.

fn with_discount_key(&self, key: &str) -> Self

This draft discounting on the raw key key — "USD-CSA-EUR", or a named curve such as "CSA-ACME-2026" — overriding the family’s default. The escape hatch: with_csa states a CSA, this a key. The last stated wins between this, with_csa and with_counterparty.

fn with_csa(&self, csa: &str) -> PyResult<Self>

This draft under the CSA csa: a collateral currency ("EUR") or the CSA’s overnight index ("EUR-ESTR"), which names its currency. with_csa("EUR") on a USD draft discounts on USD-CSA-EUR, with_csa("USD") on the USD curve. The last stated wins.

fn with_counterparty(&self, counterparty: &PyCounterparty) -> Self

This draft facing counterparty: collateralised under its CSA, so a USD draft facing a EUR-CSA counterparty discounts on USD-CSA-EUR. The collateral is the last stated between this and with_csa.

fn with_termination(&self, end: PyTermination) -> PyResult<Self>

This draft ending at end: a date, or a forward tenor such as "5Y" or "2Y2Y" read from the trade date and the template’s spot, as vanilla_swap reads one. with_maturity is the same verb.

fn with_maturity(&self, end: PyTermination) -> PyResult<Self>

with_termination under the desk’s word: one verb, two spellings.

fn build(&self) -> PyResult<PyInstrument>

The instrument, at the rate stated. A draft with no rate raises ValueError naming with_fixed_rate and at_par.

fn at_par(&self, py: Python<'_>, market: &PyMarket) -> PyResult<PyInstrument>

The instrument struck at the par rate market implies on the draft’s own dates: worth zero on market to the par solve’s precision, and carrying that rate as a number like any confirmed trade.

fn __repr__(&self) -> String

Trait Implementations§

§

impl Clone for PyProductBuilder

§

fn clone(&self) -> PyProductBuilder

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl DerefToPyAny for PyProductBuilder

§

impl IntoPy<Py<PyAny>> for PyProductBuilder

§

fn into_py(self, py: Python<'_>) -> PyObject

Performs the conversion.
§

impl PyClass for PyProductBuilder

§

type Frozen = True

Whether the pyclass is frozen. Read more
§

impl PyClassImpl for PyProductBuilder

§

const IS_BASETYPE: bool = false

#[pyclass(subclass)]
§

const IS_SUBCLASS: bool = false

#[pyclass(extends=…)]
§

const IS_MAPPING: bool = false

#[pyclass(mapping)]
§

const IS_SEQUENCE: bool = false

#[pyclass(sequence)]
§

type BaseType = PyAny

Base class
§

type ThreadChecker = SendablePyClass<PyProductBuilder>

This handles following two situations: Read more
§

type PyClassMutability = <<PyAny as PyClassBaseType>::PyClassMutability as PyClassMutability>::ImmutableChild

Immutable or mutable
§

type Dict = PyClassDummySlot

Specify this class has #[pyclass(dict)] or not.
§

type WeakRef = PyClassDummySlot

Specify this class has #[pyclass(weakref)] or not.
§

type BaseNativeType = PyAny

The closest native ancestor. This is PyAny by default, and when you declare #[pyclass(extends=PyDict)], it’s PyDict.
§

fn items_iter() -> PyClassItemsIter

§

fn doc(py: Python<'_>) -> PyResult<&'static CStr>

Rendered class doc
§

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 PyProductBuilder

§

type Holder = Option<PyRef<'py, PyProductBuilder>>

§

fn extract( obj: &'a Bound<'py, PyAny>, holder: &'a mut Self::Holder, ) -> PyResult<Self>

§

impl PyMethods<PyProductBuilder> for PyClassImplCollector<PyProductBuilder>

§

fn py_methods(self) -> &'static PyClassItems

§

impl PyTypeInfo for PyProductBuilder

§

const NAME: &'static str = "ProductBuilder"

Class name.
§

const MODULE: Option<&'static str>

Module name, if any.
§

fn type_object_raw(py: Python<'_>) -> *mut PyTypeObject

Returns the PyTypeObject instance for this type.
§

fn type_object_bound(py: Python<'_>) -> Bound<'_, PyType>

Returns the safe abstraction over the type object.
§

fn is_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type or a subclass of this type.
§

fn is_exact_type_of_bound(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of this type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromPyObject<'_> for T
where T: PyClass + Clone,

§

fn extract_bound(obj: &Bound<'_, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
§

impl<'py, T> FromPyObjectBound<'_, 'py> for T
where T: FromPyObject<'py>,

§

fn from_py_object_bound(ob: Borrowed<'_, 'py, PyAny>) -> Result<T, PyErr>

Extracts Self from the bound smart pointer obj. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> PyErrArguments for T
where T: IntoPy<Py<PyAny>> + Send + Sync,

§

fn arguments(self, py: Python<'_>) -> Py<PyAny>

Arguments for exception
§

impl<T> PyTypeCheck for T
where T: PyTypeInfo,

§

const NAME: &'static str = <T as PyTypeInfo>::NAME

Name of self. This is used in error messages, for example.
§

fn type_check(object: &Bound<'_, PyAny>) -> bool

Checks if object is an instance of Self, which may include a subtype. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Ungil for T
where T: Send,