def __init__(self, pv=None, description="No description given", price=None): self.logger = myLogger.TLogger(__name__) self.pv = pv self.price = price self.description = description self.id = uuid.uuid1()
def __init__(self, cf_times, cf_amounts, time_type = "Excel"): self.logger = myLogger.TLogger(__name__) self.logger.warning("Generating cashflow") self.cf = pd.Series( data=cf_amounts, index = cf_times) self.logger.info(self.cf) self.time_type = time_type self.cf_times = cf_times self.cf_amounts = cf_amounts self.daily_payment_schedule = self.getCouponPaymentSchedule() self._IRR = None self._mcAuleyDuration = None
def __init__(self, n=1, **kwds): self.logger = myLogger.TLogger(__name__) super(BusinessDayWithHolidays, self).__init__(n, **kwds) self.holidays = kwds.get('holidays', "NYSE") #if string is passed instead of a HolidayProfile create the HolidayProfile from the string if isinstance(self.holidays, str): try: a = self.holidays self.holidays = eval(a)() # create a holiday profile from string except TypeError: print "Could not create a Holiday Profil e for" + self.holidays + ". Does it exist?"
def __init__(self, maturitydate, couponrate, frequency_per_anno, price=100.0, startdate=dt.datetime.utcnow(), businessdayconvention, calendar, daycounter): self.logger = myLogger.TLogger(__name__) super(Bond, self).__init__() self.description = str( maturitydate.strftime("%d/%m/%y")) + "_" + str(couponrate) self.logger.info("Generating bond {}".format(self.description)) self.price = price self.startdate = startdate self.maturitydate = maturitydate self.couponrate = couponrate self.frequency = frequency_per_anno self.cf = self._generateCashflow() self.businessdayconvention = businessdayconvention self.calendar = calendar self.daycounter = daycounter
# -*- coding: utf-8 -*- import datetime as dt import pandas as pd from asset import Asset import pandas.core.datetools as pdt from cashflow import Cashflow import myLogger # create logger module_logger = myLogger.TLogger(__name__) class Bond(Asset): """ This class generates a bond from some basic economic information and generates the corresponding cashflow. If no price is given the bond is assumed to be 100. Offset and coupon dates are a bit rudimentary and need to be improved. e.g. Daycount conventions, rolling, etc. Example: >>> startdate = dt.datetime(2012, 1, 1) >>> maturitydate = dt.datetime(2015, 1, 1) >>> bd = Bond(startdate = startdate, maturitydate = maturitydate, couponrate = 0.05, frequency_per_anno = 2, businessdayconvention, calendar) >>> bd.price 100.0 >>> bd.couponrate 0.05 >>> bd.frequency 2
def __init__(self, cf_amount, r, no_periods, growth=0.0): self.logger = myLogger.TLogger(__name__)
def __init__(self): self.logger = myLogger.TLogger(self.__class__.__name__) self.logger.debug("Creating holiday profile: {}".format(self.__class__.__name__))