Skip to content

Instantly share code, notes, and snippets.

@pricees
Last active June 4, 2017 13:08
Show Gist options
  • Save pricees/4b693d2ca35fcfe14dc4 to your computer and use it in GitHub Desktop.
Save pricees/4b693d2ca35fcfe14dc4 to your computer and use it in GitHub Desktop.
Value Investing (CROIC)
# Margins of Safety
# 30% > $ 10B
# 50% - 30% for $1-10B Market Cap
# > 50% for < $1B
# Owner's Earnings
# Read more: http://www.oldschoolvalue.com/blog/valuation-methods/working-capital-free-cash-flow-fcf/#ixzz3O1Egljwo
# Owner earnings = Net income + depreciation & amortization +/- one-time items +/- changes in working capital - capital expenditures
def owner_earnings # Better than free cash flow
net_income + (depreciation & amortization) +/- one-time items +-
changes in working capital - capital_expenditures
end
#
# CROIC = FCF/Invested Capital
# Invested Capital = Total Equity + Total Liabilities – Current Liabilities – Excess Cash (DEPRECATED)
# Excess Cash = Total Cash – MAX(0,Current Liabilities-Current Assets)
# Read more: http://www.oldschoolvalue.com/blog/investing-strategy/croic-roic-screen-strategy-backtest/#ixzz3O15gDifW
# http://www.oldschoolvalue.com/blog/investing-strategy/croic-roic-screen-strategy-backtest/
# NOTE: Increasing croic in a 3 year period may point to a successful turn around!
#
# http://www.investopedia.com/university/ratios/
#
# CROIC > 10% is acceptable
def working_capital
current_assets - current_liabilities
end
def free_cash_flow
operating_cash - capital_expenditures
end
def invested_capital_DEPRECATED
total_equity + total_liabilities - excess_cash
end
#
# Invested Capital = Total Equity + Short Term Debt + Capital Lease Obligations + Long Term Debt
# Excess cash was causing issues,
# Read more: http://www.oldschoolvalue.com/blog/valuation-methods/roe-croic-roic-formula/#ixzz3O1BJJTB2
def invested_capital
total_equity + short_term_debt + capital_lease_obligations + long_term_debt
end
# Invested Capital = Total Equity + Short Term Debt + Capital Lease Obligations + Long Term Debt
def excess_cash
total_cash - [0, current_liabilities - current_assets].max
end
def croic
free_cash_flow / invested_capital
end
#
# Net Net Working Capital
# Read more: http://www.oldschoolvalue.com/blog/investing-strategy/backtest-graham-nnwc-ncav-screen/#ixzz3O1DasIvH
def net_net_working_capital
cash + (0.75 * accounts_receivables) + (0.5 * inventory) - total_liabilities
end
#
# Discounted Cash Flow
# http://www.oldschoolvalue.com/blog/valuation-methods/discounted-cash-flow-stock-valuation
# No more than 15% to stay conservative
def growth_rate(earnings)
# ["5 or 10 years of growth".to_f, 15].min
n = earnings.size
avgs = (0..n - 2).map do |i|
(earnings[i + 2] - earnings[i]) / 3
end
#
avgs.inject(:+).fdiv(avgs.length)
end
#
# “You can’t compensate for risk by using a high discount rate.”
# Read more: http://www.oldschoolvalue.com/blog/investing-strategy/explaining-discount-rates/#ixzz3O1JW2LwO
#
def discount_rate
(greedy ? [15, 20] : [9,12]).sample
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment