Back to Community
Trading on Buyback Announcements

Share Repurchases, more commonly known as “share buybacks”, are when a company buys its own shares from the market. While there are number of ways to perform a buyback (tender offer, buying from market, ASRs), companies tend to perform share repurchases because they believe their shares are undervalued. So by buying back shares, this corporate action reduces the number of shares outstanding, increasing EPS (earnings per share) tends to along with share price.

We’ve done some prior research on buyback announcements and are now announcing it’s availability through pipeline. Buyback announcements for 4,000+ listed companies are now available from EventVestor.

For those who’ve thought about using buyback announcements in their algorithms, I’ve created a sample algorithm for you to get started with. It’s a simple drift strategy that holds securities for 5 days after a new buyback announcement versus a repeat buyback announcement.

Strategy Details:

  • Datafeed: Buyback Authorizations by EventVestor
  • Weights: The weight for each security is determined by the total number of longs we have in that current day. So if we have 2 longs, the weight for each long will be 50% (1.0/number of securities). This is a rolling rebalance at the beginning of each day according to the number of securities currently held and to order.
  • Capital base: $1,000,000
  • Days held: Positions are currently held for 5 days but are easily changeable by modifying 'context.days_to_hold'
  • Trade dates: All trades are made 1 business day AFTER a buyback announcements
  • Slippage and commissions in this backtest are default backtester settings

Dataset Details

Here are the available fields from the Buyback Authorizations dataset:

previous_date (datetime64[ns]) - The datetime that the last buyback announcement was made  
previous_type (string) - Possible values are (u'Suspends', u'Reduction', u'Additional', u'Reinstates', u'New')  
previous_amount (float64) - Amount of buyback. See previous_unit for measurement.  
previous_unit (string) - Possible values are (u'EURM', u'DKK', u'Mshares', u'%', u'CAD', u'NaN', u'GBPM', u'$M')  

For more examples using data, visit the data factor library.

Clone Algorithm
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
import numpy as np

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline.factors import CustomFactor, AverageDollarVolume

from quantopian.pipeline.data.eventvestor import BuybackAuthorizations
from quantopian.pipeline.factors.eventvestor import (
    BusinessDaysSinceBuybackAuth
)

def make_pipeline(context):
    # Create our pipeline
    pipe = Pipeline()

    # Add Factors to Pipeline
    pipe.add(BusinessDaysSinceBuybackAuth(), 'business_days')
    buyback_type = BuybackAuthorizations.previous_type.latest
    only_new_buybacks = buyback_type.eq("New")
 
    # Screen out penny stocks and low liquidity securities.
    dollar_volume = AverageDollarVolume(window_length = 20)
    
    # Only looks at securities within the top 1000 most liquid
    liquidity_rank = dollar_volume.rank(ascending=False) < 1000
    pipe.set_screen((dollar_volume > 10**7) & (liquidity_rank)
                    & only_new_buybacks) 

    return pipe

def initialize(context):
    #: Declaring the days to hold, change this to what you want)))
    context.days_to_hold = 5
    #: Declares which stocks we currently held and how many days we've held them dict[stock:days_held]
    context.stocks_held = {}
    
    # Make our pipeline
    attach_pipeline(make_pipeline(context), 'buyback_pipe')
    
    # Log our positions at 10:00AM
    schedule_function(func=log_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_close(minutes=30))
    # Order our positions
    schedule_function(func=order_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_open())

def before_trading_start(context, data):
    # Screen for securities that only have a recent buyback announcement
    # 1 business day previous and separate out the earnings surprises into
    # positive and negative 
    results = pipeline_output('buyback_pipe')
    context.announcements = results[results['business_days'] == 1].index.tolist()
    log.info("There are %s announcments today" % 
             (len(context.announcements)))
    log.info(context.announcements)

def log_positions(context, data):
    #: Get all positions
    all_positions = "Current positions for %s : " % (str(get_datetime()))
    for pos in context.portfolio.positions:
        if context.portfolio.positions[pos].amount != 0:
            all_positions += "%s at %s shares, " % (pos.symbol, context.portfolio.positions[pos].amount)
    log.info(all_positions)
    record(leverage=context.account.leverage,
           positions=len(context.portfolio.positions))
        
def order_positions(context, data):
    """
    Main ordering conditions to always order an equal percentage in each position
    so it does a rolling rebalance by looking at the stocks to order today and the stocks
    we currently hold in our portfolio.
    """
    port = context.portfolio.positions

    # Check if we've exited our positions and if we haven't, exit the remaining securities
    # that we have left
    for security in port:  
        if data.can_trade(security):  
            if context.stocks_held.get(security) is not None:  
                context.stocks_held[security] += 1  
                if context.stocks_held[security] >= context.days_to_hold:  
                    order_target_percent(security, 0)  
                    del context.stocks_held[security]  
            # If we've deleted it but it still hasn't been exited. Try exiting again  
            else:  
                log.info("Haven't yet exited %s, ordering again" % security.symbol)  
                order_target_percent(security, 0)

    port = [pos for pos in port if (port[pos].amount > 0)]    
    recent_announcements = context.announcements + port
    
    # Rebalance our announcements (new and existing)                
    for security in recent_announcements:
        can_trade = context.stocks_held.get(security) <= context.days_to_hold or \
                    context.stocks_held.get(security) is None
        if data.can_trade(security) and can_trade:
            order_target_percent(security, 1.0 / len(recent_announcements))
            if context.stocks_held.get(security) is None:
                context.stocks_held[security] = 0

def get_ordered_amount(context, data, raw=False):
    amount_ordered = 0 
    for order in get_open_orders():
        for oo in get_open_orders()[order]:
            if raw:
                amount = abs(oo.amount)
            else:
                amount = oo.amount
            amount_ordered += amount * data[oo.sid].price
    return amount_ordered
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.

7 responses

This algo (and data) brought to mind a paper referenced by one of the speakers at QuantCon: https://www8.gsb.columbia.edu/sites/valueinvesting/files/files/12Ikenberry_lak.pdf

The hypothesis in the paper is that buyback announcements can be combined with value assessments to improve returns -- focusing the trades only on those companies that look to be undervalued by means of both the buyback announcement and fundamental factors.

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.

Out of sample backtest

Clone Algorithm
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
import numpy as np

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline.factors import CustomFactor, AverageDollarVolume

from quantopian.pipeline.data.eventvestor import BuybackAuthorizations
from quantopian.pipeline.factors.eventvestor import (
    BusinessDaysSinceBuybackAuth
)

def make_pipeline(context):
    # Create our pipeline
    pipe = Pipeline()

    # Add Factors to Pipeline
    pipe.add(BusinessDaysSinceBuybackAuth(), 'business_days')
    buyback_type = BuybackAuthorizations.previous_type.latest
    only_new_buybacks = buyback_type.eq("New")
 
    # Screen out penny stocks and low liquidity securities.
    dollar_volume = AverageDollarVolume(window_length = 20)
    
    # Only looks at securities within the top 1000 most liquid
    liquidity_rank = dollar_volume.rank(ascending=False) < 1000
    pipe.set_screen((dollar_volume > 10**7) & (liquidity_rank)
                    & only_new_buybacks) 

    return pipe

def initialize(context):
    #: Declaring the days to hold, change this to what you want)))
    context.days_to_hold = 5
    #: Declares which stocks we currently held and how many days we've held them dict[stock:days_held]
    context.stocks_held = {}
    
    # Make our pipeline
    attach_pipeline(make_pipeline(context), 'buyback_pipe')
    
    # Log our positions at 10:00AM
    schedule_function(func=log_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_close(minutes=30))
    # Order our positions
    schedule_function(func=order_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_open())

def before_trading_start(context, data):
    # Screen for securities that only have a recent buyback announcement
    # 1 business day previous and separate out the earnings surprises into
    # positive and negative 
    results = pipeline_output('buyback_pipe')
    context.announcements = results[results['business_days'] == 1].index.tolist()
    log.info("There are %s announcments today" % 
             (len(context.announcements)))
    log.info(context.announcements)

def log_positions(context, data):
    #: Get all positions
    all_positions = "Current positions for %s : " % (str(get_datetime()))
    for pos in context.portfolio.positions:
        if context.portfolio.positions[pos].amount != 0:
            all_positions += "%s at %s shares, " % (pos.symbol, context.portfolio.positions[pos].amount)
    log.info(all_positions)
    record(leverage=context.account.leverage,
           positions=len(context.portfolio.positions))
        
def order_positions(context, data):
    """
    Main ordering conditions to always order an equal percentage in each position
    so it does a rolling rebalance by looking at the stocks to order today and the stocks
    we currently hold in our portfolio.
    """
    port = context.portfolio.positions

    # Check if we've exited our positions and if we haven't, exit the remaining securities
    # that we have left
    for security in port:  
        if data.can_trade(security):  
            if context.stocks_held.get(security) is not None:  
                context.stocks_held[security] += 1  
                if context.stocks_held[security] >= context.days_to_hold:  
                    order_target_percent(security, 0)  
                    del context.stocks_held[security]  
            # If we've deleted it but it still hasn't been exited. Try exiting again  
            else:  
                log.info("Haven't yet exited %s, ordering again" % security.symbol)  
                order_target_percent(security, 0)

    port = [pos for pos in port if (port[pos].amount > 0)]    
    recent_announcements = context.announcements + port
    
    # Rebalance our announcements (new and existing)                
    for security in recent_announcements:
        can_trade = context.stocks_held.get(security) <= context.days_to_hold or \
                    context.stocks_held.get(security) is None
        if data.can_trade(security) and can_trade:
            order_target_percent(security, 1.0 / len(recent_announcements))
            if context.stocks_held.get(security) is None:
                context.stocks_held[security] = 0

def get_ordered_amount(context, data, raw=False):
    amount_ordered = 0 
    for order in get_open_orders():
        for oo in get_open_orders()[order]:
            if raw:
                amount = abs(oo.amount)
            else:
                amount = oo.amount
            amount_ordered += amount * data[oo.sid].price
    return amount_ordered
There was a runtime error.

Can anyone tell me why it looks like this strategy is taking some stocks short after the "days to hold' is up?

Trade top 500-1000 stocks, instead of Top1000.

Clone Algorithm
89
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
import numpy as np

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline.factors import CustomFactor, AverageDollarVolume

from quantopian.pipeline.data.eventvestor import BuybackAuthorizations
from quantopian.pipeline.factors.eventvestor import (
    BusinessDaysSinceBuybackAuth
)

def make_pipeline(context):
    # Create our pipeline
    pipe = Pipeline()

    # Add Factors to Pipeline
    pipe.add(BusinessDaysSinceBuybackAuth(), 'business_days')
    buyback_type = BuybackAuthorizations.previous_type.latest
    only_new_buybacks = buyback_type.eq("New")
 
    # Screen out penny stocks and low liquidity securities.
    dollar_volume = AverageDollarVolume(window_length = 20)
    
    # Only looks at securities within the top 1000 most liquid
    liquidity_rank1 = dollar_volume.rank(ascending=False) < 1000
    liquidity_rank2 = dollar_volume.rank(ascending=False) > 500
    pipe.set_screen((dollar_volume > 10**7) & liquidity_rank1 & liquidity_rank2 & only_new_buybacks) 
    
    #log.info(liquidity_rank)

    return pipe

def initialize(context):
    #: Declaring the days to hold, change this to what you want)))
    context.days_to_hold = 5
    #: Declares which stocks we currently held and how many days we've held them dict[stock:days_held]
    context.stocks_held = {}
    
    # Make our pipeline
    attach_pipeline(make_pipeline(context), 'buyback_pipe')
    
    # Log our positions at 10:00AM
    schedule_function(func=log_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_close(minutes=30))
    # Order our positions
    schedule_function(func=order_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_open())

def before_trading_start(context, data):
    # Screen for securities that only have a recent buyback announcement
    # 1 business day previous and separate out the earnings surprises into
    # positive and negative 
    results = pipeline_output('buyback_pipe')
    context.announcements = results[results['business_days'] == 1].index.tolist()
    log.info("There are %s announcments today" % 
             (len(context.announcements)))
    log.info(context.announcements)

def log_positions(context, data):
    #: Get all positions
    all_positions = "Current positions for %s : " % (str(get_datetime()))
    for pos in context.portfolio.positions:
        if context.portfolio.positions[pos].amount != 0:
            all_positions += "%s at %s shares, " % (pos.symbol, context.portfolio.positions[pos].amount)
    log.info(all_positions)
    record(leverage=context.account.leverage,
           positions=len(context.portfolio.positions))
        
def order_positions(context, data):
    """
    Main ordering conditions to always order an equal percentage in each position
    so it does a rolling rebalance by looking at the stocks to order today and the stocks
    we currently hold in our portfolio.
    """
    port = context.portfolio.positions

    # Check if we've exited our positions and if we haven't, exit the remaining securities
    # that we have left
    for security in port:  
        if data.can_trade(security):  
            if context.stocks_held.get(security) is not None:  
                context.stocks_held[security] += 1  
                if context.stocks_held[security] >= context.days_to_hold:  
                    order_target_percent(security, 0)  
                    del context.stocks_held[security]  
            # If we've deleted it but it still hasn't been exited. Try exiting again  
            else:  
                log.info("Haven't yet exited %s, ordering again" % security.symbol)  
                order_target_percent(security, 0)

    port = [pos for pos in port if (port[pos].amount > 0)]    
    recent_announcements = context.announcements + port
    
    # Rebalance our announcements (new and existing)                
    for security in recent_announcements:
        can_trade = context.stocks_held.get(security) <= context.days_to_hold or \
                    context.stocks_held.get(security) is None
        if data.can_trade(security) and can_trade:
            order_target_percent(security, 1.0 / len(recent_announcements))
            if context.stocks_held.get(security) is None:
                context.stocks_held[security] = 0

def get_ordered_amount(context, data, raw=False):
    amount_ordered = 0 
    for order in get_open_orders():
        for oo in get_open_orders()[order]:
            if raw:
                amount = abs(oo.amount)
            else:
                amount = oo.amount
            amount_ordered += amount * data[oo.sid].price
    return amount_ordered
There was a runtime error.

@Sergii I really like this improvement!

Good work.

I am very new to this, so forgive me if I've missed something here. I removed the filter for volume and I'm seeing some crazy looking results. If this is accurate, why would you filter at all? I'm pretty sure these results are too good to be true, though.

Clone Algorithm
37
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
import numpy as np

from quantopian.algorithm import attach_pipeline, pipeline_output
from quantopian.pipeline import Pipeline
from quantopian.pipeline.factors import CustomFactor, AverageDollarVolume

from quantopian.pipeline.data.eventvestor import BuybackAuthorizations
from quantopian.pipeline.factors.eventvestor import (
    BusinessDaysSinceBuybackAuth
)

def make_pipeline(context):
    # Create our pipeline
    pipe = Pipeline()

    # Add Factors to Pipeline
    pipe.add(BusinessDaysSinceBuybackAuth(), 'business_days')
    buyback_type = BuybackAuthorizations.previous_type.latest
    only_new_buybacks = buyback_type.eq("New")
 
    # Screen out penny stocks and low liquidity securities.
    #dollar_volume = AverageDollarVolume(window_length = 20)
    
    # Only looks at securities within the top 1000 most liquid
    #liquidity_rank = dollar_volume.rank(ascending=False) < 1000
    #pipe.set_screen((dollar_volume > 10**7) & (liquidity_rank)
                    #& only_new_buybacks) 

    return pipe

def initialize(context):
    #: Declaring the days to hold, change this to what you want)))
    context.days_to_hold = 5
    #: Declares which stocks we currently held and how many days we've held them dict[stock:days_held]
    context.stocks_held = {}
    
    # Make our pipeline
    attach_pipeline(make_pipeline(context), 'buyback_pipe')
    
    # Log our positions at 10:00AM
    schedule_function(func=log_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_close(minutes=30))
    # Order our positions
    schedule_function(func=order_positions,
                      date_rule=date_rules.every_day(),
                      time_rule=time_rules.market_open())

def before_trading_start(context, data):
    # Screen for securities that only have a recent buyback announcement
    # 1 business day previous and separate out the earnings surprises into
    # positive and negative 
    results = pipeline_output('buyback_pipe')
    context.announcements = results[results['business_days'] == 1].index.tolist()
    log.info("There are %s announcments today" % 
             (len(context.announcements)))
    log.info(context.announcements)

def log_positions(context, data):
    #: Get all positions
    all_positions = "Current positions for %s : " % (str(get_datetime()))
    for pos in context.portfolio.positions:
        if context.portfolio.positions[pos].amount != 0:
            all_positions += "%s at %s shares, " % (pos.symbol, context.portfolio.positions[pos].amount)
    log.info(all_positions)
    record(leverage=context.account.leverage,
           positions=len(context.portfolio.positions))
        
def order_positions(context, data):
    """
    Main ordering conditions to always order an equal percentage in each position
    so it does a rolling rebalance by looking at the stocks to order today and the stocks
    we currently hold in our portfolio.
    """
    port = context.portfolio.positions

    # Check if we've exited our positions and if we haven't, exit the remaining securities
    # that we have left
    for security in port:  
        if data.can_trade(security):  
            if context.stocks_held.get(security) is not None:  
                context.stocks_held[security] += 1  
                if context.stocks_held[security] >= context.days_to_hold:  
                    order_target_percent(security, 0)  
                    del context.stocks_held[security]  
            # If we've deleted it but it still hasn't been exited. Try exiting again  
            else:  
                log.info("Haven't yet exited %s, ordering again" % security.symbol)  
                order_target_percent(security, 0)

    port = [pos for pos in port if (port[pos].amount > 0)]    
    recent_announcements = context.announcements + port
    
    # Rebalance our announcements (new and existing)                
    for security in recent_announcements:
        can_trade = context.stocks_held.get(security) <= context.days_to_hold or \
                    context.stocks_held.get(security) is None
        if data.can_trade(security) and can_trade:
            order_target_percent(security, 1.0 / len(recent_announcements))
            if context.stocks_held.get(security) is None:
                context.stocks_held[security] = 0

def get_ordered_amount(context, data, raw=False):
    amount_ordered = 0 
    for order in get_open_orders():
        for oo in get_open_orders()[order]:
            if raw:
                amount = abs(oo.amount)
            else:
                amount = oo.amount
            amount_ordered += amount * data[oo.sid].price
    return amount_ordered
There was a runtime error.

NB: Leverage went crazy when I set commissions to 5+0.01 and ran it for the same period with 25k starting capital. Maybe the ordering logic is slightly off, but your algo might still be OK.