<kiyosi/instruments/barrier/terms.hpp>
#include <kiyosi/instruments/barrier/terms.hpp>BarrierType
enum class BarrierTypeDirection and activation behavior of a barrier.
枚举值
up_and_in— Activates when spot reaches or exceeds the barrier.up_and_out— Terminates when spot reaches or exceeds the barrier.down_and_in— Activates when spot reaches or falls below the barrier.down_and_out— Terminates when spot reaches or falls below the barrier.
ObservationMode
enum class ObservationModeBarrier monitoring frequency.
枚举值
continuous— Monitor continuously throughout the contract life.scheduled— Monitor only at 00:00 UTC on explicit observation dates.
BarrierTouchState
enum class BarrierTouchStateBarrier observations strictly before the valuation time.
枚举值
untouched— No prior observation breached the barrier.touched— A prior observation breached the barrier.
RebateTiming
enum class RebateTimingPayment timing for a barrier-option rebate.
枚举值
at_hit— Pay when the barrier is hit.at_expiry— Pay at contract expiry.
SettlementTiming
enum class SettlementTimingSettlement timing for a touch option.
枚举值
at_hit— Settle when the barrier is hit.at_expiry— Settle at contract expiry.
is_up_barrier
bool kiyosi::is_up_barrier(BarrierType kind) noexceptTests whether a barrier is triggered by upward spot movement. 返回值: true for up-and-in and up-and-out barriers.
is_knock_in_barrier
bool kiyosi::is_knock_in_barrier(BarrierType kind) noexceptTests whether a barrier activates rather than terminates the contract. 返回值: true for up-and-in and down-and-in barriers.
kiyosi::BarrierTerms
class kiyosi::BarrierTermsTrigger level, knock direction, and monitoring schedule shared by every barrier contract.
成员
barrier_level
double kiyosi::BarrierTerms::barrier_level() const noexceptReturns the positive barrier level.
barrier_type
BarrierType kiyosi::BarrierTerms::barrier_type() const noexceptReturns the barrier direction and activation behavior.
observation_mode
kiyosi::ObservationMode kiyosi::BarrierTerms::observation_mode() const noexceptReturns the monitoring frequency.
observation_schedule
const ObservationSchedule & kiyosi::BarrierTerms::observation_schedule() const noexceptReturns the validated monitoring schedule.
observation_dates
const std::vector<Date> & kiyosi::BarrierTerms::observation_dates() const noexceptReturns the ordered monitoring dates; empty for continuous monitoring.
effective_date
Date kiyosi::BarrierTerms::effective_date() const noexceptReturns the first date of the contract life.
expiry_date
Date kiyosi::BarrierTerms::expiry_date() const noexceptReturns the final date of the contract life.
touch_state
std::optional<BarrierTouchState> kiyosi::BarrierTerms::touch_state() const noexceptReturns the caller-supplied state before valuation, if supplied.
was_touched_before
Result<bool> kiyosi::BarrierTerms::was_touched_before(Timestamp valuation_time) constResolves prior history, rejecting missing or impossible history.
is_up
bool kiyosi::BarrierTerms::is_up() const noexceptReturns whether this is an upward barrier.
is_knock_in
bool kiyosi::BarrierTerms::is_knock_in() const noexceptReturns whether this is a knock-in barrier.
is_continuous
bool kiyosi::BarrierTerms::is_continuous() const noexceptReturns whether monitoring is continuous.
mean_observation_year_fraction
double kiyosi::BarrierTerms::mean_observation_year_fraction() const noexceptMean spacing between monitoring dates, used for the BGK discrete-barrier shift.
is_monitored_on
bool kiyosi::BarrierTerms::is_monitored_on(Date date) const noexceptTests whether the barrier is monitored on a date. 参数
date—Dateto test.
返回值: true within the contract life for continuous monitoring, or on a scheduled observation date.
is_monitored_at
bool kiyosi::BarrierTerms::is_monitored_at(Timestamp time) const noexceptTests whether monitoring occurs at this exact valuation instant.
is_breached_by
bool kiyosi::BarrierTerms::is_breached_by(double spot) const noexceptTests whether a spot lies on the triggered side of the barrier. 参数
spot— Spot value to test.
返回值: true when spot breaches the barrier.