Skip to content

Instantly share code, notes, and snippets.

@ianwalter
Created April 26, 2013 01:36
Show Gist options
  • Save ianwalter/5464565 to your computer and use it in GitHub Desktop.
Save ianwalter/5464565 to your computer and use it in GitHub Desktop.
JavaScript code that will evaluate whether a Stock is undervalued.
var earnings = stock.getNetIncome() * 10;
earnings += (stock.getTotalCash() - stock.getTotalDebt());
if (earnings > stock.getMarketCap()) {
stock.setUndervalued(true);
} else {
stock.setUndervalued(false);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment