27template <
typename T>
class OptionChain final {
30 std::string symbol_{};
31 std::set<OptionSeries<T>> series_{};
33 explicit OptionChain(std::string symbol) : symbol_(std::move(symbol)) {
36 void addOption(
const OptionSeries<T> &series,
bool isCall,
double strike, std::shared_ptr<T> option) {
37 auto it = series_.find(series);
39 if (it == series_.end()) {
40 OptionSeries<T> os(series);
41 os.addOption(isCall, strike, option);
44 OptionSeries<T> modifiedSeries = *it;
46 modifiedSeries.addOption(isCall, strike, option);
47 series_.insert(modifiedSeries);
53
54
55
56
62
63
64
65
const std::string & getSymbol() const &
Returns symbol (product or underlying) of this option chain.
Definition OptionChain.hpp:57
std::set< OptionSeries< T > > getSeries()
Returns a sorted set of option series of this option chain.
Definition OptionChain.hpp:66