Equity per Share Growth

((Assets - liabilities) / common shares outstanding)

An algorithm that trades stocks with the highest percentages of equity per share growth weekly.

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

Returns: 946.69%
Drawdown: -65.15%
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.equity_per_share_growth.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
  )
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