Here is the current version, where I corrected the error in the computing of Sigma.
Here is the current version, where I corrected the error in the computing of Sigma.
This is the list of the companies, that according to the CMS model could go bankrupt (pfd > 50%) in one-year horizon (as of July, 2015):
LOCM LOCAL CORP 100.00%
LOOK LOOKSMART LTD 99.91%
USEG U S ENERGY CORP 99.91%
DXM DEX MEDIA INC 99.50%
ASTI ASCENT SOLAR TECHNOLOGIES INC 99.47%
RLJE RLJ ENTERTAINMENT INC 98.43%
VPCO VAPOR CORP 97.99%
XGTI XG TECHNOLOGY INC 94.93%
VGGL VIGGLE INC 91.37%
VRNG VRINGO INC 89.47%
INPH INTERPHASE CORP 88.03%
HERO HERCULES OFFSHORE INC 86.01%
WRES WARREN RESOURCES INC 82.82%
PHMD PHOTOMEDEX INC 82.47%
PRSN PERSEON CORP 78.96%
JOEZ JOE'S JEANS INC 76.87%
SWSH SWISHER HYGIENE INC 74.22%
CLRX COLLABRX INC 62.89%
SPEX SPHERIX INC 58.80%
ADAT AUTHENTIDATE HOLDING CORP 57.40%
ESCR ESCALERA RESOURCES CO 54.40%
NETE NET ELEMENT INC 53.01%
I'm trying to embedd the CHS model into my trading strategy, but I've some difficulties in computing the three-months standard deviation of the daily returns: there is not get_pricing(.) function in Quantopian Algorithms and history(.) doesn't work in before_trading_start(.).
Why don't add the function get_pricing(.) also in Quantopian Algorithms?
Alternatively why don't add a measure of stock volatility in the Fundamentals Data (for example Beta)?
Errors...
NameError Traceback (most recent call last)
in ()
1 symbols = fundamental_data.minor_axis
----> 2 price_history = get_pricing(symbols, fields='close_price', start_date=t1, end_date=t0)
3 price_history
NameError: name 't1' is not defined
NameError Traceback (most recent call last)
in ()
2 zero_centered_returns = returns_daily.sub(returns_daily.mean())
3 n = len(zero_centered_returns)
----> 4 sigma = np.sqrt(252.0 * (1.0/(n-1.0)) * zero_centered_retuns.pow(2).sum())
5 sigma
NameError: name 'zero_centered_retuns' is not defined
I notice in the code that you use the (SPY # of shares outstanding) *( the price of SPY * 10) to derive the market value of the index. This would not survive an audit. It would be better to reference the S&P 500 index of the constituent stocks, then make a new calculation of all of those listed securities' market caps summed to arrive at the market value of the index. As of this writing, there are 504 listed securities which comprise the S&P 500 index. SPX is the ticker for the index, but i do not know what data about SPX is available to us.
Your method still comes very very close to the actual, and your code mostly works. It could use a lot more descriptions so that other people can use it (it took me almost an hour to make it work up to the point of the summary stats).
I was able to use your code to calculate the parts of the LPFD for a single security (by filtering heavily in the filter section of your code to isolate 10 securities) in the quantopian notebook then compare that against my own data in excel. Very good work.
If I was a much stronger coder (I am a Master of Science in Finance student, studying for CFA Level 1 currently), then I would modify this to create a list of the "rising losers" ranked by fastest approach (over some measure of time, perhaps 9-12 months?) to 100% and "stable winners" those stocks near 0% failure with the least amount of variance. I would be able to reference my long securities against the stable winners to see if I should stay long (this could be useful for mid to small cap stocks with little analyst coverage) and if I was hunting for new short ideas I could reference the "rising losers" for more advanced fundamental analysis. By itself, I do not think the CHS model could be traded upon, but it is a fantastic tool for due diligence.
My poor coding skills (I have been studying python for 2 months now) could not fix the notebook to go all the way to the finish line, but I really appreciate you doing the work to get it as far as you have. Perhaps another fundamentalist like myself but with coding skills could fix this awesome tool?