Enterprise Value

(Common equity + preferred equity + minority equity + total debt - cash and cash equivalents)

An algorithm that trades stocks with the highest enterprise values weekly.

Starting capital: $10,000
Max leverage: 1
Jan 2, 2006 - Sep 1, 2020

Returns: 325.52%
Drawdown: -71.93%
Benchmark (S&P 500): 276.95%
import quantopian.algorithm as algo
from quantopian.pipeline import Pipeline
from quantopian.pipeline.filters import Q3000US
from quantopian.pipeline.data.morningstar import Fundamentals as ms
import quantopian.optimize as opt

import numpy as np
import pandas as pd


def initialize(context):
    context.FINE_FILTER = 5
    context.stock_weights = pd.Series()
    algo.attach_pipeline(make_pipeline(context), 'pipeline')

    schedule_function(
        stocks_weights,
        date_rules.week_start(),
        time_rules.market_open()
    )

    schedule_function(
        trade,
        date_rules.week_start(),
        time_rules.market_open()
    )


def make_pipeline(context):
    univ = Q3000US()
    factor = ms.enterprise_value.latest.rank(mask=univ, ascending=False)
    top = factor.top(context.FINE_FILTER)
    pipe = Pipeline(
        columns={'top': top}, screen=univ)
    return pipe


def stocks_weights(context, data):
    df = algo.pipeline_output('pipeline')
    rule = 'top'
    stocks_to_hold = df.query(rule).index
    stock_weight = 1.0 / context.FINE_FILTER
    context.stocks_weights = pd.Series(index=stocks_to_hold, data=stock_weight)


def trade(context, data):
    target_weights = opt.TargetWeights(context.stocks_weights)

    constraints = []
    constraints.append(opt.MaxGrossExposure(1.0))

    order_optimal_portfolio(
        objective=target_weights,
        constraints=constraints
    )

Market Cap

(Common shares outstanding * share price)

Shares Outstanding

The number of common shares issued.

Terms:
1. Enterprise Value Investopedia
2. Market Cap Investopedia
3. Shares Outstanding Investopedia


Statements on this website are for informational purposes only and do not constitute a recommendation or advice by the website owner to transact any security or market instrument. All trading activity involves known and unknown risk. Historical data presented is not always indicative of future performance.

Social

X
Github

Contact

Email