Back to Community
Division on two positives gives negative !

Hey ,

Possibly I am doing something that is conceptually wrong in python practice.

When I run a loop over fundamental_df and extract 'net_tangible_assets' and 'net_debt' and take the ratio of both , I get negative ratios as well.

for stock in fundamental_df:  
        ind_grp = fundamental_df[stock]['morningstar_industry_group_code']  
        assets = fundamental_df[stock]['net_tangible_assets']  
        debt = fundamental_df[stock]['net_debt']  
        ad_ratio = (assets)/float(debt)

3 responses

That is because one of the numbers is actually negative.

From the fundamentals help page:

net_tangible_assets
Net assets in physical form. This is calculated using Stockholders'
Equity less Intangible Assets (including Goodwill).

So I assume net_tangible_assets may be negative when Intangible Assets (including Goodwill) is more than Stockholders' Equity.

e.g.

2014-03-03 PRINT -59700000.0,1157400000.0,-0.0515811301192  
2014-03-03 PRINT -9000000.0,1189000000.0,-0.00756938603869  
2014-03-03 PRINT -659000000.0,18303000000.0,-0.0360050264984  
2014-03-03 PRINT -36110000.0,249338000.0,-0.144823492608  
2014-03-03 PRINT -852000000.0,3912000000.0,-0.217791411043  
2014-03-03 PRINT -177984000.0,1914601000.0,-0.0929614055357  
2014-03-03 PRINT -2089049000.0,4047648000.0,-0.5161142965  
2014-03-03 PRINT -1204400000.0,3189100000.0,-0.377661409175  
2014-03-03 PRINT -56058000.0,930941000.0,-0.0602164906262  
2014-03-03 PRINT -31407317.0,2978326.0,-10.5452918854  
2014-03-03 PRINT -232000000.0,1919000000.0,-0.120896300156  
2014-03-03 PRINT -902083000.0,1352395000.0,-0.667026275607  
2014-03-03 PRINT -2983700000.0,9397000000.0,-0.317516228584  
2014-03-03 PRINT -1881889000.0,1419498000.0,-1.32574262169  
2014-03-04 PRINT -59700000.0,1157400000.0,-0.0515811301192  
2014-03-04 PRINT -9000000.0,1189000000.0,-0.00756938603869  
2014-03-04 PRINT -659000000.0,18303000000.0,-0.0360050264984  
2014-03-04 PRINT -36110000.0,249338000.0,-0.144823492608  
2014-03-04 PRINT -852000000.0,3912000000.0,-0.217791411043  
2014-03-04 PRINT -177984000.0,1914601000.0,-0.0929614055357  
2014-03-04 PRINT -2089049000.0,4047648000.0,-0.5161142965  
2014-03-04 PRINT -1204400000.0,3189100000.0,-0.377661409175  
2014-03-04 PRINT -56058000.0,930941000.0,-0.0602164906262  
2014-03-04 PRINT -31407317.0,2978326.0,-10.5452918854  
2014-03-04 PRINT -232000000.0,1919000000.0,-0.120896300156  
2014-03-04 PRINT -902083000.0,1352395000.0,-0.667026275607  
Clone Algorithm
1
Loading...
Backtest from to with initial capital
Total Returns
--
Alpha
--
Beta
--
Sharpe
--
Sortino
--
Max Drawdown
--
Benchmark Returns
--
Volatility
--
Returns 1 Month 3 Month 6 Month 12 Month
Alpha 1 Month 3 Month 6 Month 12 Month
Beta 1 Month 3 Month 6 Month 12 Month
Sharpe 1 Month 3 Month 6 Month 12 Month
Sortino 1 Month 3 Month 6 Month 12 Month
Volatility 1 Month 3 Month 6 Month 12 Month
Max Drawdown 1 Month 3 Month 6 Month 12 Month
# Backtest ID: 55def36e5672860d89698913
There was a runtime error.

Ahh ! 'net_tangible_assets'could very well be negative , i didn't consider that. Thanks James

no problem