<kiyosi/pricing/result.hpp>
#include <kiyosi/pricing/result.hpp>Greek
enum class GreekPublic Greek contract:
- delta, gamma, and speed are price changes per one spot unit, squared spot unit, and cubed spot unit, respectively;
- vega, vanna, and zomma are price, delta, and gamma changes per one volatility percentage point (an absolute volatility change of 0.01);
- rho is the price change per one interest-rate percentage point (an absolute rate change of 0.01);
- theta, charm, and color are price, delta, and gamma changes per calendar day as valuation time moves forward. Unrequested, undefined, or unsupported Greeks are unavailable (
std::nullopt), never zero sentinels.
枚举值
delta— First derivative with respect to spot.gamma— Second derivative with respect to spot.speed— Third derivative with respect to spot.theta— Value change per calendar day of forward valuation time.charm— Delta change per calendar day of forward valuation time.color— Gamma change per calendar day of forward valuation time.vega— Value change per volatility percentage point.vanna— Delta change per volatility percentage point.zomma— Gamma change per volatility percentage point.rho— Value change per interest-rate percentage point.
greek_count
std::size_t kiyosi::greek_countNumber of defined Greek values.
greek_index
std::optional<std::size_t> kiyosi::greek_index(Greek greek) noexceptConverts a Greek to its PricingResult storage index. 返回值: The index, or std::nullopt for an unknown enumerator.
make_pricing_result
Result<PricingResult> kiyosi::make_pricing_result(double price, std::initializer_list<std::pair<Greek, std::optional<double>>> entries={})Builds a result from a price and runtime Greek entries. Unknown Greeks are rejected with invalid_parameter. Later duplicate entries replace earlier entries for the same Greek. The final price and every available Greek must be finite. 返回值: The populated result, or an invalid_parameter or invalid_result error.
kiyosi::GreeksRequest
class kiyosi::GreeksRequestGreeks requested from a joint valuation. Price is always included separately. Construct from one or more Greek values, or from true for every Greek. Duplicates are ignored; empty requests and unknown values are rejected by price_with_greeks() with an invalid_parameter error.
成员
GreeksRequest
kiyosi::GreeksRequest::GreeksRequest()=defaultUsed internally for price-only valuations; invalid for price_with_greeks().
GreeksRequest
kiyosi::GreeksRequest::GreeksRequest(std::initializer_list<Greek> greeks)GreeksRequest
kiyosi::GreeksRequest::GreeksRequest(std::span<const Greek> greeks)GreeksRequest
template <std::same_as< bool > T>
kiyosi::GreeksRequest::GreeksRequest(T all_greeks)has
bool kiyosi::GreeksRequest::has(Greek greek) const noexceptempty
bool kiyosi::GreeksRequest::empty() const noexceptvalidate
Result<void> kiyosi::GreeksRequest::validate() constkiyosi::PricingResult
class kiyosi::PricingResultFinite price and a fixed-size collection of optional finite Greeks.
成员
GreekValues
using kiyosi::PricingResult::GreekValues = std::array<std::optional<double>, greek_count>Storage type indexed by greek_index().
price
double kiyosi::PricingResult::price() const noexceptA finite price is present in every successfully constructed result.
has
bool kiyosi::PricingResult::has(Greek greek) const noexceptReports whether the Greek is available; a stored zero is available.
get
Result<std::optional<double>> kiyosi::PricingResult::get(Greek greek) constRetrieves a Greek when its enumerator is valid. 返回值: The optional value, or an invalid_parameter error for an unknown Greek.
require
Result<double> kiyosi::PricingResult::require(Greek greek) constRetrieves a required Greek. 返回值: The value, or an invalid_parameter or invalid_result error.
values_view
const GreekValues & kiyosi::PricingResult::values_view() const noexceptReturns a read-only view of all Greek slots. 注意: The reference remains valid until this result is destroyed, moved from, or assigned.
selected
PricingResult kiyosi::PricingResult::selected(GreeksRequest greeks) const noexceptReturns price and only the requested Greeks.
all_finite
bool kiyosi::PricingResult::all_finite() const noexceptTests whether price and every available Greek are finite.