Created
July 31, 2013 20:51
-
-
Save adamstrickland/6126043 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AutomaticExpirationDate < Molecule::Mechanics::Repercussion | |
extend Molecule::ExchangeConcepts | |
def act(subj, *args) | |
subj.pricing.expiry = self.class.expires_day_before(subj.tenor_start) if subj.option? | |
# Molecule::ExchangeConcepts.expires_day_before is .get_expiry *without* the call to .calculate_expiry | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UnderlyingAutomaticExpirationDate < Molecule::Mechanics::Repercussion | |
extend Molecule::ExchangeConcepts | |
field :underlying, type: String | |
field :offset_days, type: Integer, default: -3 | |
def act(subj, *args) | |
subj.pricing.expiry = self.class.expires_based_on_underlying(subj.tenor_start, subj.product.short_name) if subj.option? | |
# Molecule::ExchangeConcepts.expires_based_on_underlying is basically a refactored .calculate_expiry | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment