Пример #1
0
def normalizeFds():
    logging.info('Normalizing Finantial Data')
    year = datetime.today().year
    for company in getAll(index=INDEX_COMPANY):
        try:
            saveInfos(forecast(company['id'], year))
        except Exception as error:
            logging.error('Exception normalizing: %s', error)
Пример #2
0
def buildFourthQuarter(companyid, qd, year):
    logging.info('Building Fourth Quarter for compnay %s and year %s', companyid, year)
    period = '{0}12'.format(year)
    #fqd = filter(lambda x: x['period'] == period, qd)
    #if len(fqd) > 0: return
    qdtotal = getFdByIdAndYear(companyid, year)
    if qdtotal is None:
        raise Exception('error building fourth quarter for company %s: DFP not found for year %s', companyid, year)
    fqd = qdtotal.copy()
    fqd['period'] = period
    fqd['ptype'] = 'ITR' 
    fqd['RL'] = qdtotal['RL'] - sum(getIoQ(qd, year, i, 'RL') for i in range(1, 4))
    fqd['LL'] = qdtotal['LL'] - sum(getIoQ(qd, year, i, 'LL') for i in range(1, 4))
    qd.append(fqd)
    saveInfos(fqd)