Esempio n. 1
0
def build_database():
    import utils

    now = dtime.date2str_dmy(dtime.dtime('now'), '/')

    print("Downloading Database to : ", now)

    dates, rates = get_selic("01/07/2000", now)
    dates = dates[:-1]
    rates = rates[:-1]


    dailyfactor = lambda s: round((1+s/100.0)**(1/252.0), 8)
    factors = list(map(dailyfactor, rates))
    VNA = cumproduct(factors)
    VNA.insert(0, 1.0)
    VNA = VNA[:-1]
    VNA= [x*1000.0 for x in VNA]


    ts = Tserie(dates,
                [ rates, factors, VNA],
                headers=['rate', 'factor', 'VNA'],
                name = "Taxa SELIC")



    ts.datprovider = "Brazil Central Bank (Banco Central do Brasil)"
    ts.description = "Brazilian Daily Interest Rate Since 1/7/2000"
    ts.url = "www3.bcb.gov.br/selic/consulta/taxaSelic.do?method=listarTaxaDiaria"

    thisdir = utils.this_dir()
    datasets = utils.resource_path("datasets")

    ts.to_csv(os.path.join(thisdir, "../datasets", "selic.csv"))
Esempio n. 2
0
def get_vna(date):
    #date = dtime.date_dmy(date)
    date = dtime.dtime(date)

    #print "Date ", date
    #date = dtime.daysadd(date, -1)
    date = dtime.prevbusday(date)

    #print "date = ", date
    data = selic.get_date(date)
    #print "data = ", data
    return round(data[0][-1], 8), date
Esempio n. 3
0
    def get_date(self, date, prevbusday=False):

        if self.serie_type == "rserie":
            return None

        date = dtime.dtime(date)
        table = self.get_table()

        if prevbusday:
            date = dtime.prevbusday(date)

        return [
            d for d in table if d[0].day == date.day
            and d[0].month == date.month and d[0].year == date.year
        ]
Esempio n. 4
0
def get_vna_bc(date):
    date = dtime.dtime(date)
    date = dtime.date2str_dmy(date, '/')
    return 1000.0*selic_acfactor("01/07/2000", date)