mock
Contains mock instruments and visitors for testing purposes.
Classes:
-
MockInstrument–A mock instrument for testing purposes.
-
MockValuationVisitor–A mock valuation visitor that sets a new value for mock instruments.
MockInstrument
MockInstrument(
name: str,
book_type: Optional[BookType] = None,
credit_rating: Optional[CreditRating] = None,
issuer: Optional[Issuer] = None,
parent: Optional[Instrument] = None,
)
Bases: Instrument
A mock instrument for testing purposes.
Methods:
-
accept–Accept a visitor that processes this mock instrument.
-
is_composite–Check if the instrument is composite.
Attributes:
-
book_type(Optional[BookType]) –Get the book type of the instrument.
-
credit_rating(CreditRating) –Get the instrument's credit rating.
-
issuer(Issuer) –Get the instrument's issuer.
-
parent(Optional[Instrument]) –Get the parent instrument.
-
value(float) –Get the instrument's value.
value
property
writable
value: float
Get the instrument's value.
is_composite
is_composite() -> bool
Check if the instrument is composite.
MockValuationVisitor
MockValuationVisitor(new_value: float)
Bases: ValuationVisitor
A mock valuation visitor that sets a new value for mock instruments.
:param new_value: The new value to set for the mock instrument.
Methods:
-
set_date–Set the date for the valuation and update the term structure.
-
visit_amortizing_fixed_rate_loan–Value an amortizing fixed rate bond.
-
visit_cash–Value cash.
-
visit_common_equity–Value common equity.
-
visit_covered_bond–Value a covered bond.
-
visit_credit_card–Value a credit card.
-
visit_deposit–Visit deposit.
-
visit_fixed_rate_bond–Value a fixed rate bond.
-
visit_mock_instrument–Visit a mock instrument.
-
visit_personal_loan–Value a personal loan.
set_date
set_date(
date: date, *, date_must_be_in_simulation: bool = True
) -> None
Set the date for the valuation and update the term structure.
visit_amortizing_fixed_rate_loan
visit_amortizing_fixed_rate_loan(
instrument: AmortizingFixedRateLoan,
) -> None
Value an amortizing fixed rate bond.
visit_fixed_rate_bond
visit_fixed_rate_bond(instrument: FixedRateBond) -> None
Value a fixed rate bond.
visit_mock_instrument
visit_mock_instrument(instrument: MockInstrument) -> None
Visit a mock instrument.