Esempio n. 1
0
                                                     benchmark=0.02)
    ### Rolling alpha
    rolling_alpha_df = m.rolling_alpha(df_data,
                                       columns_name=columns_name,
                                       window_length=36,
                                       min_periods=36,
                                       start_gap=6)
    ### Rolling correlation
    rolling_corr_df = m.rolling_corr(df_data,
                                     columns_name=columns_name,
                                     target_benchmark='Russell 3000',
                                     window_length=36,
                                     min_periods=36,
                                     start_gap=6)
    ### Draw Down
    dd_df = 100 * m.draw_down(df_data, columns_name, start_gap)

    ### Graph for result
    with PdfPages('Rolling Ratio Figure.pdf') as pdf:
        plt.style.use('fivethirtyeight')
        rolling_annual_return_df[[
            'TeamCo Client Composite', 'HFRI Fund Weighted Composite Index',
            'HFRI Fund of Funds Composite Index'
        ]].plot(title='36 Months Rolling Annual Return')
        plt.legend(prop={'size': 12})
        pdf.savefig()

        cum_return_df[[
            'TeamCo Client Composite', 'HFRI Fund Weighted Composite Index',
            'HFRI Fund of Funds Composite Index'
        ]].plot(title='Cummulative Return')
Esempio n. 2
0
    ### Rolling omega ratio
    rolling_omega_ratio_df = m.rolling_omega_ratio(df_data, columns_name,
                                                   window_length, min_periods,
                                                   MAR)
    ### Rolling sharp ratio
    rolling_sharpe_ratio_df = m.rolling_sharpe_ratio(df_data, columns_name,
                                                     window_length,
                                                     min_periods, benchmark)
    ### Rolling alpha
    rolling_alpha_df = m.rolling_alpha(df_data, columns_name, window_length,
                                       min_periods)
    ### Rolling correlation
    rolling_corr_df = m.rolling_corr(df_data, columns_name, market_index,
                                     window_length, min_periods)
    ### Draw Down
    dd_df = 100 * m.draw_down(df_data, columns_name)

    ### Generate graph and save them to the pdf file
    p.graph_gen('Rolling Ratio Figure and Radar Chart Result.pdf', index_name, rolling_annual_return_df, cum_return_df, \
                rolling_alpha_df,rolling_beta_df, rolling_corr_df, rolling_sharpe_ratio_df, \
                rolling_sortino_ratio_df,rolling_omega_ratio_df, dd_df, Beta_df, Beta_df_p, \
                Beta_df_np, Corr_df, Corr_df_p, Corr_df_np)

    ### Output all static dataframe into excel file
    dfs = [Annulized_Return_df,Calendar_Return_df,Sharpe_df,Sortino_df,\
           Standard_deviation_df,Downside_Deviation_df,Beta_df,Beta_df_p,\
           Beta_df_np,Omega_df,Corr_df,Corr_df_p,Corr_df_np,Summary_table_df]
    put.multiple_dfs(dfs, 'Financial Ratio', 'Financial Ratio Result.xlsx', 1)

    ### Output all rolling data to seperated sheet in excel file
    rolling_df_list = [rolling_beta_df,rolling_annual_return_df,cum_return_df,\