visualise_correlation_matrix#

API documentation for tradeexecutor.visual.asset_correlation.visualise_correlation_matrix Python function.

visualise_correlation_matrix(corr_matrix, title='Returns correlation matrix')[source]#

Visualise correlation matrix as a heatmap.

  • Use for custome returns series

Example:

weekly_returns_df = (returns_df + 1).resample('W').prod() - 1

display(weekly_returns_df.iloc[0:5])

corr_matrix = weekly_returns_df.corr(
    method='pearson',
    min_periods=4,
)

display(corr_matrix)
visualise_correlation_matrix(corr_matrix, title="Weekly returns correlation")
Parameters:
  • corr_matrix (DataFrame) –

  • title (str) –

Return type:

Figure