Back to Community
Financials tearsheet challenge

The fourth tearsheet challenge is here and we're again mixing things up a bit. While we're back in more familiar US Equities waters, we will focus on the financials sector exclusively this time. In addition, this time we are looking for strategies with higher turnover - between 10% and 50% daily on average. Ideally your ideas will be unique and targeted to things that might work in financials, rather than generic factors that could also work across sectors.

There is also a questionnaire for all entrants that we would appreciate if you filled it out, but you do not have to.

Here are the rules:

  • There is no submission or live-updated leaderboard like for the contest.
  • To enter this challenge, simply post an alpha tearsheet as a reply to this thread. Clone the attached template and add your own pipeline factor code.
  • The deadline to submit a factor is Dec 7, 2019. There is no hold-out testing, just post your best factor starting on June 1, 2015, until Oct 1, 2018. We will look at all tearsheet submissions and manually determine 5 best factors according to our discretion. Each winner gets a $100 prize. There is no limit on the number of submissions.

Algorithm requirements to enter the challenge:

  • Your factor must run on the US financials sector. It can however, use any dataset(s) you want.
  • Turnover must be between 10% and 50%.

When selecting a winner, we will primarily look at:

  • Specific Sharpe Ratio (IR) in the first 5 to 10 days in the alpha decay analysis (higher is better).
  • For more examples on what we look for, check out our last live tearsheet review.

You can use the attached algorithm as a template.

Good luck and happy coding!

Clone Algorithm
173
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
"""
Sample algo for using in the financials challenge

This template is based on an example algorithm from Daniel Cascio.
"""

# Import required pipeline methods
from quantopian.pipeline import Pipeline, CustomFactor
from quantopian.algorithm import attach_pipeline, pipeline_output

# Import any built in filters and/or factors
from quantopian.pipeline.domain import US_EQUITIES
from quantopian.pipeline.filters import QTradableStocksUS
from quantopian.pipeline.data.factset import RBICSFocus
from quantopian.pipeline.data import EquityPricing

# Import optimize
import quantopian.optimize as opt

import pandas as pd

def initialize(context):
    # Normally a contest algo uses the default commission and slippage
    # This is unique and only required for this 'mini-contest'
    set_commission(commission.PerShare(cost=0.000, min_trade_cost=0))    
    set_slippage(slippage.FixedSlippage(spread=0))

    attach_pipeline(make_pipeline(context), 'pipeline') 

    # Place orders towards the end of each day
    schedule_function(rebalance, date_rules.every_day(), time_rules.market_close(hours=2))
               
    # Record any custom data at the end of each day    
    schedule_function(record_positions, date_rules.every_day(), time_rules.market_close())

class Momentum(CustomFactor):
    inputs = [EquityPricing.close]
    window_length = 252

    def compute(self, today, assets, out, prices):
        out[:] = ((prices[-21] - prices[-252]) / prices[-252] -
                  (prices[-1] - prices[-21]) / prices[-21])
        
def create_factor():
    # Use the QTradableStocksUS universe as a base
    qtu = QTradableStocksUS()
    sector = RBICSFocus.l1_name.latest
    # Create an alpha factor
    alpha_factor = Momentum()
    
    # Filter out securities with very few estimates or factor is invalid
    screen = qtu & ~alpha_factor.isnull() & alpha_factor.isfinite() & sector.eq('Finance')
    
    return alpha_factor, screen

def make_pipeline(context):  
    alpha_factor, screen = create_factor()
    
    # Winsorize to remove extreme outliers
    alpha_winsorized = alpha_factor.winsorize(min_percentile=0.01,
                                              max_percentile=0.99,
                                              mask=screen)
    
    # Zscore to get long and short (positive and negative) alphas to use as weights
    alpha_zscore = alpha_winsorized.zscore()
    
    return Pipeline(columns={'alpha_factor': alpha_zscore}, 
                    screen=screen, domain=US_EQUITIES)

def rebalance(context, data): 
    # Get the alpha factor data from the pipeline output
    output = pipeline_output('pipeline')
    alpha_factor = output.alpha_factor
    
    # Weight securities by their alpha factor
    # Divide by the abs of total weight to create a leverage of 1
    weights = alpha_factor / alpha_factor.abs().sum() 
    
    # Must use TargetWeights as an objective
    order_optimal_portfolio(
        objective=opt.TargetWeights(weights),
        constraints=[],
    )
    
def record_positions(context, data):
    pos = pd.Series()
    for position in context.portfolio.positions.values():
        pos.loc[position.sid] = position.amount
        
    pos /= pos.abs().sum()
    
    # Show quantiles of the daily holdings distribution
    # to show if weights are being squashed to equal weight
    # or whether they have a nice range of sensitivity.
    quantiles = pos.quantile([.05, .25, .5, .75, .95]) * 100
    record(q05=quantiles[.05])
    record(q25=quantiles[.25])
    record(q50=quantiles[.5])
    record(q75=quantiles[.75])
    record(q95=quantiles[.95])
There was a runtime error.
Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

75 responses

Hi @Thomas,

I'm curious to understand the rationale behind the higher turnover preference for stocks in the Financial sector? Is this a general new preference (to make more active bets that can be more accurately determined to be profitable OOS), or only in relation to the Financial sector?

Also, what was the reason why you used a Momentum factor in the template? Was it mainly because it has a higher turnover, or because Financials might use different Fundamental based factors (e.g. due to their bigger balance sheet) than stocks in other sectors?

Lastly, in the template, you're using l1_name (Economy) rather than l2_name (Sector), and it looks like "Finance" at l1 level includes Morningstar's Real Estate stocks in addition to (Morningstar) Financial Services stocks. Was this intentional?

Thanks!

FYI, here's the new tearsheet of the above template, without any changes made. Note the exposure to Real Estate in addition to Financial Services.

I'm assuming this is the tearsheet we should be attaching, unless there's an updated/improved one?

Loading notebook preview...
Notebook previews are currently unavailable.

My initial model 0.1. Average daily turnover during this period was 12%. I can't quite understand the minimum turnover requirement of 10%, as trading is expensive, but I'm probably missing something. Perhaps the combined model will result in lower overall turnover due to internally matched 'wash-trades' that are never sent to the broker/exchange?

Loading notebook preview...
Notebook previews are currently unavailable.

@Joakim: Thanks for all the great questions!

I'm curious to understand the rationale behind the higher turnover preference for stocks in the Financial sector? Is this a general new preference (to make more active bets that can be more accurately determined to be profitable OOS), or only in relation to the Financial sector?

Not a general new preference, but this challenges are a great playground for us (and you) to explore different avenues. For some portfolios you might want to be more active in your trading because you maybe you found that factors that actively turn over has been working well for you in the past. For example, if you signal is only predictive over shorter time horizons, why would you want to sit on old positions that do not have predictive power anymore?
It's not something specific to financials.

Also, what was the reason why you used a Momentum factor in the template? Was it mainly because it has a higher turnover, or because Financials might use different Fundamental based factors (e.g. due to their bigger balance sheet) than stocks in other sectors?

It's rather mundane, I had this factor lying around and just put it in as a place-holder. Maybe an example that actually looks a bit better would be more motivating but I was lazy :). So this shouldn't be taken as a hint or prescriptive in any way. The only thing it shows maybe is that this momentum factor does not work well here.

Lastly, in the template, you're using l1_name (Economy) rather than l2_name (Sector), and it looks like "Finance" at l1 level includes Morningstar's Real Estate stocks in addition to (Morningstar) Financial Services stocks. Was this intentional?

Yeah, the naming is a bit confusing here. We do mean economy here so it's fine if others are pulled in that morning star considers belonging to a different sector. The main idea here is to do something more targeted, what that specific target is secondary, so no need to read too much into it. If, however, you find that your idea would only make sense on actual financial services but not real estate stocks, feel free to exclude those from your universe.

I'm assuming this is the tearsheet we should be attaching, unless there's an updated/improved one?

Yes, that's exactly the right one, thanks for posting it.

Would the accepted Algo be funded?

@Leo C: That's never a guarantee, even for winning factors, but in this competition it is definitely more likely than in the Japan one.

v0.1

Loading notebook preview...
Notebook previews are currently unavailable.

We can use Morningstar's Financial and Real Estate sectors combined or just Morningstar's Financial?

@Leo C: The example uses RBICS from FactSet which you should use, is there a reason you would like to use Morningstar?

v0.2

Loading notebook preview...
Notebook previews are currently unavailable.

Are custom datasets allowed for this challenge?

@Robert: Yes, definitely!

v0.2

Loading notebook preview...
Notebook previews are currently unavailable.

Model 01

Loading notebook preview...
Notebook previews are currently unavailable.

v1

Loading notebook preview...
Notebook previews are currently unavailable.

Here's my 1st submission of an individual factor specific to Financials. Need to work on it a bit more but I thought the exposures and IR decay were good.

Loading notebook preview...
Notebook previews are currently unavailable.

Turnover 10.0 %. IR is steady for 5 days, then drops.

Loading notebook preview...
Notebook previews are currently unavailable.

v1.0 - Average Daily Turnover: 19.10%

Loading notebook preview...
Notebook previews are currently unavailable.

v2.0 - Average Daily Turnover: 27.81%

Loading notebook preview...
Notebook previews are currently unavailable.

Still needs some improvement, excited to work on it over the break!

Loading notebook preview...
Notebook previews are currently unavailable.

Everyone: To give people a bit more breathing room we extended the deadline for this challenge to Dec 7.

Quo prodis

Loading notebook preview...
Notebook previews are currently unavailable.

Est

Loading notebook preview...
Notebook previews are currently unavailable.

2

Loading notebook preview...
Notebook previews are currently unavailable.

Finding a model specific to the sector and inclusive of all financial industries is a great challenge. In 8 years trying quant value models on paper and in real, I often came to exclude financials of the universe. My suggestion to participants is to explicitely or implicitely focus on subsets and exclude some industries. Hope this helps and best of luck, I am out...

My 1st attmpts

Loading notebook preview...
Notebook previews are currently unavailable.

Maybe this can help? I am too lazy to derive these ratios in quantopian.

First submission using general factors

Loading notebook preview...
Notebook previews are currently unavailable.

Another algorithm using several different factors

Loading notebook preview...
Notebook previews are currently unavailable.

Same factors as second algorithm but a different group ranking method

Loading notebook preview...
Notebook previews are currently unavailable.

version F - a set of factors

Loading notebook preview...
Notebook previews are currently unavailable.

version T

Loading notebook preview...
Notebook previews are currently unavailable.

version F5T5

Loading notebook preview...
Notebook previews are currently unavailable.

version F7T3

Loading notebook preview...
Notebook previews are currently unavailable.

Model 02

Loading notebook preview...
Notebook previews are currently unavailable.

Model 03

Loading notebook preview...
Notebook previews are currently unavailable.

v1

Loading notebook preview...
Notebook previews are currently unavailable.

v3.0 - Average Daily Turnover: 15.54%

Loading notebook preview...
Notebook previews are currently unavailable.

Using both fundamental and estimate factors

Loading notebook preview...
Notebook previews are currently unavailable.

Submission #2. Very fast through 1-6 days but thought I would send it in anyways.

Loading notebook preview...
Notebook previews are currently unavailable.

Version 2.2
Average turnover is 10.3%

Loading notebook preview...
Notebook previews are currently unavailable.

Version 3.2 added one factor to reduce turnover

Loading notebook preview...
Notebook previews are currently unavailable.

V2

Loading notebook preview...
Notebook previews are currently unavailable.

Submission #3.

Loading notebook preview...
Notebook previews are currently unavailable.

V3.
Turnover keeps on going down as I add more factors. Average Turnover: 12.8%.

Loading notebook preview...
Notebook previews are currently unavailable.

First crack after a long break from the platform...

Loading notebook preview...
Notebook previews are currently unavailable.

V4
Average Turnover: 10.8 %. (V3 was combination of V4 + general factors)

Loading notebook preview...
Notebook previews are currently unavailable.

Submission #4 with AVG Turnover @ 12.5%

Loading notebook preview...
Notebook previews are currently unavailable.

Final Submission #5 (same factors as V4 above) only change made was to increase AVG Turnover @ 24.5%

Loading notebook preview...
Notebook previews are currently unavailable.

v4.0 - Average Daily Turnover: 11.69%

Loading notebook preview...
Notebook previews are currently unavailable.

v4.1 - Average Daily Turnover: 11.65%

Loading notebook preview...
Notebook previews are currently unavailable.

Factor Salad Entry

Loading notebook preview...
Notebook previews are currently unavailable.

Hi, version 1.0 - average daily turnover 10.28%. Cheers!

Loading notebook preview...
Notebook previews are currently unavailable.

V 1.0 with 32.81% turnover

Loading notebook preview...
Notebook previews are currently unavailable.

Attemp #1

I find the "Turnover must be between 10% and 50%" a little bit problematic. I think this is forcing the trading strategy to tile to technical side as fundamental data does not update that frequently and naturally gives a low turnover. My factors relies on more the fundamental side.

Loading notebook preview...
Notebook previews are currently unavailable.

Attemp #2

Loading notebook preview...
Notebook previews are currently unavailable.

Attempt #3

(I do not really like this one better than the other two... But it has more positions.)

Loading notebook preview...
Notebook previews are currently unavailable.

v4.2 - Average Daily Turnover: 11.39%

That's the best I can do. Fingers crossed it'll hold up reasonably well during the holdout period (I haven't peeked).

Loading notebook preview...
Notebook previews are currently unavailable.

Attempt #4

Loading notebook preview...
Notebook previews are currently unavailable.

Attempt #5

Loading notebook preview...
Notebook previews are currently unavailable.

Attempt #6

Loading notebook preview...
Notebook previews are currently unavailable.

My final version for this challenge. I added more factors and even though it has lower IR in the challenge period than my previous submissions, I think this version works better over a longer horizon. Going to delete my previous submissions to avoid clutter.

Loading notebook preview...
Notebook previews are currently unavailable.

finance factor1

Loading notebook preview...
Notebook previews are currently unavailable.

financials-tearsheet-challenge

Loading notebook preview...
Notebook previews are currently unavailable.

V5 (Combination of top factors) with higher average turnover of 15.5% (but reduced IR).

Loading notebook preview...
Notebook previews are currently unavailable.

V 2.0 with 38.09% turnover

Loading notebook preview...
Notebook previews are currently unavailable.

Updated

Loading notebook preview...
Notebook previews are currently unavailable.

Daily turnover 32.3%

Loading notebook preview...
Notebook previews are currently unavailable.

Daily turnover 11.8%
One of the factors in this one is only active every 10 days, hence the spikes.

Loading notebook preview...
Notebook previews are currently unavailable.

MultiFactors-ML - Daily turnover 17.2%

Loading notebook preview...
Notebook previews are currently unavailable.

V2-MultiFactors-ML - Daily turnover 14.9%

Loading notebook preview...
Notebook previews are currently unavailable.

V1

Loading notebook preview...
Notebook previews are currently unavailable.

V3 - MultiFactors-ML -Daily turnover 13.3%

Loading notebook preview...
Notebook previews are currently unavailable.

I know it's late but I'll throw this in there.

Loading notebook preview...
Notebook previews are currently unavailable.

50 % turnover, Sharpe, 1.26

Loading notebook preview...
Notebook previews are currently unavailable.