AlphaReport#

AlphaReport is experimental and might change quickly.

Introducing AlphaReport#

AlphaReport creates a suite of plots to help you understand your data sets and evaluate the performance of your investment strategies.

Use AlphaReport to:

  • Look for patterns in your data

  • Generate and research new strategy ideas

  • Understand your data’s statistical properties

  • Find features in your data and assess their predictive power

  • Analyze a strategy’s potential to deliver future returns

Available plots#

AlphaReport has 6 plot categories:

  • Distributions: Visualize marginal and joint probability distributions of feature and target variables.

  • Temporal: Find periodic or delayed signals, assess stationarity, and view time-shifted comparisons of the data.

  • Metrics: Show statistical metrics about the relationships between feature and target variables over varying timescales.

  • Classification: Assess the ability of feature variables to predict the sign of target variables.

  • Clustering: Perform a principal component analysis of the data and find similarities between variables.

  • Machine learning: Build and evaluate prediction models using logistic regression, decision trees, and neural networks.

To view a list of available plots in each category:

import sigtech.framework as sig
sig.experimental_AlphaReport.available_plots().sort_values('Category')

Example#

Assess the ability of daily Fama-French index data to predict the movement of a strategy on the day after.

  1. Import basic Python libraries, the SigTech framework, and the AlphaReport class:

import pandas as pd
import datetime as dtm
import sigtech.framework as sig
from sigtech.framework.experimental.analytics.alpha_report.alpha_report \
    import AlphaReport

sig.init()
  1. Create example feature data from the Fama and French index history:

# Create example feature data from Fama and French
# index history, delayed by 1 day
fama_french = sig.obj.get('US 3F_DAILY FAMA-FRENCH INDEX')

start_date = dtm.date(2018, 1, 4)
end_date = dtm.date(2022, 6, 30)

features = fama_french.history_df(
    fields=fama_french.history_fields
).drop(columns=['rf'])
  1. Delay the feature data by 1 day:

features = features.shift()
  1. Create example target data from the percentage change series of a single-stock reinvestment strategy:

strat = sig.get_single_stock_strategy('1000045.SINGLE_STOCK.TRADABLE')
targets = strat.history().pct_change().dropna()
  1. Create an AlphaReport object and display it interactively:

ar = AlphaReport(
    x_df=features.loc[start_date: end_date].to_frame('Fama-French Index'),
    y_df=targets.loc[start_date: end_date].to_frame('Strategy')
)
ar.interactive_report()