Exemple #1
0
def total_historic_nnb(dic_data, input_dic, idx=general.month_end_series):
    '''
    Function that returns a total historical nnb based on the implied nnb on months that we do not have the total nnb data
    dic_data: fund data
    input_dic: dictionary of inputs which include nnb distribution
    '''
    implied_discretionary_nnb = get_historic_implied_nnb(dic_data,
                                                         idx=idx)  # series
    monthly_filled_inputs = general.monthly_fulfill(input_dic)

    total_historical_nnb = dic_data['total nnb'].reindex(index=idx)
    implied_total_nnb = (
        implied_discretionary_nnb /
        monthly_filled_inputs['nnb distribution'].reindex(
            index=idx)[general.disc_known_cols].sum(axis='columns')).to_frame(
                name='NNB')  # dataframe
    '''
    Pandas version 0.21 fixed the following bug!
    result = implied_total_nnb[total_historical_nnb.isnull()].fillna(0.0) + total_historical_nnb.fillna(0.0)
    
    '''

    result = pandas.concat([
        total_historical_nnb[~numpy.isnan(total_historical_nnb.values)],
        implied_total_nnb[numpy.isnan(total_historical_nnb.values)]
    ],
                           axis='index')

    return result
Exemple #2
0
def total_nnb_distribution_clientAlgo(dic_data, input_dic, opt=None):
    total = total_nnb_clientAlgo(dic_data, input_dic)
    result = (general.monthly_fulfill(input_dic)['nnb distribution']).reindex(
        index=general.month_end_series).multiply(total['NNB'], axis='index')
    result.iloc[0, :] = 0
    if opt is None:
        return result
    else:
        if opt == 'financial_year' or opt == 'calendar_year':
            return general.convert_fy_quarter_half_index(
                result, result.index).groupby(opt).sum(min_count=1)
        elif opt == 'month_no':
            return general.convert_fy_quarter_half_index(
                result, result.index).groupby(['calendar_year',
                                               opt]).sum(min_count=1)
        else:
            return general.convert_fy_quarter_half_index(
                result, result.index).groupby(['financial_year',
                                               opt]).sum(min_count=1)
Exemple #3
0
def future_nnb_distribution(dic_data, input_dic):
    total = total_future_nnb(dic_data, input_dic)
    result = (general.monthly_fulfill(input_dic)['nnb distribution']).reindex(
        index=general.month_end_series).multiply(total['NNB'], axis='index')
    result.iloc[0, :] = 0
    return result