Skip to content

Instantly share code, notes, and snippets.

@Michael-J-Ward
Created August 6, 2016 18:19
Show Gist options
  • Save Michael-J-Ward/034e4c0f937df523c9bb50f6f190c6ae to your computer and use it in GitHub Desktop.
Save Michael-J-Ward/034e4c0f937df523c9bb50f6f190c6ae to your computer and use it in GitHub Desktop.
magic formula
class Magic_Formula(CustomFactor):
inputs = [mstar.income_statement.ebit, mstar.valuation.enterprise_value,
mstar.operation_ratios.roic]
outputs = ['earnings_yield', 'roic']
window_length = 1
def compute(self, today, assets, out, ebit, ev, roic):
out.earnings_yield[:] = ebit[-1] / ev[-1]
out.roic[:] = roic[-1]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment