コード例 #1
0
ファイル: asset.py プロジェクト: Karagul/Pyquant
 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()
コード例 #2
0
ファイル: cashflow.py プロジェクト: robertschulze/pyquant
 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
コード例 #3
0
ファイル: EnhancedBDay.py プロジェクト: robertschulze/pyquant
 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?" 
コード例 #4
0
 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
コード例 #5
0
# -*- 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
コード例 #6
0
ファイル: cashflow.py プロジェクト: robertschulze/pyquant
 def __init__(self, cf_amount, r, no_periods, growth=0.0):
     self.logger = myLogger.TLogger(__name__)
コード例 #7
0
ファイル: EnhancedBDay.py プロジェクト: robertschulze/pyquant
 def __init__(self):
     self.logger = myLogger.TLogger(self.__class__.__name__)
     self.logger.debug("Creating holiday profile: {}".format(self.__class__.__name__))