Skip to content

Instantly share code, notes, and snippets.

@nkabir
Created December 5, 2011 16:19
Show Gist options
  • Select an option

  • Save nkabir/1434148 to your computer and use it in GitHub Desktop.

Select an option

Save nkabir/1434148 to your computer and use it in GitHub Desktop.
alexhawat hw3 discount factor
class DiscountFactor(object):
'''
class that holds a discount factor for a specified interval
'''
### DON'T NEED THIS
#counter is a "Class Variable" for the number of created instances of DiscountFactor
counter = 0
def __init__(self, ref_date, slice_date, factor):
'''
Constructor
ref_date: SerialDate object holding the reference date (start of interval)
slice_date: SerialDate object holding the discount factor date/end of interval (or the date of the transfer)
factor: float holding the discount factor
'''
### DON'T NEED TO CALL SUPER CONSTRUCTOR WHEN EXTENDING object
super(DiscountFactor, self).__init__()
### PLEASE FOLLOW NAMING CONVENTION
self.reference_date=ref_date
self.discount_factor_date=slice_date
self.factor=factor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment