Notebook
In [ ]:
 
In [38]:
from quantopian.pipeline import Pipeline
#from quantopian.pipeline.data.quandl import cboe_vix as vix
from quantopian.pipeline import CustomFactor
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.factors import AverageDollarVolume, SimpleMovingAverage, RSI
from quantopian.pipeline.classifiers.morningstar import Sector
from quantopian.pipeline.data import morningstar


MIN_PRICE = 5                                  # MIN PRICE 
MAX_PRICE = 20                                   # MAX PRICE - (LOW PRICES HIGHER GAINS, BIGGER DD'S)
MAX_LEVERAGE = 1                                # MAX PORTFOLIO LEVERAGE
DOLLAR_VOLUME = 100000                          # LIQUITY FILTER
SHARES_OUTSTANDING = 20000000                   # TOTAL SHARES OUTSTANDING (FLOAT)
START_MINS = 15                                 # START TIME
TRAILING_STOP = .8                              # TRAILING STOP LOSS
MAX_LOSS = .9                                   # INITAL MAX STOP LOSS
VWAP_DISC = .98                                 # VWAP DISCOUNT * CURRENT PRICE

watchlist = ['AAPL','MSFT','FB']
example = rank_EBITDA_YIELD(watchlist)
    
def rank_EBITDA_YIELD(watchlist):
    EBITDA_YIELD=morningstar.income_statement.ebitda.latest/morningstar.valuation.enterprise_value.latest
    ebitda_total = 0
    for i in watchlist:
        ebitda_total += EBITDA_YIELD[i]
    print(ebitda_total) 
    return ebitda_total
    

TypeErrorTraceback (most recent call last)
<ipython-input-38-feaf5d1cdc3b> in <module>()
     21 
     22 watchlist = ['AAPL','MSFT','FB']
---> 23 example = rank_EBITDA_YIELD(watchlist)
     24 
     25 def rank_EBITDA_YIELD(watchlist):

<ipython-input-36-499099a8e81d> in rank_EBITDA_YIELD(watchlist)
     27     ebitda_total = 0
     28     for i in watchlist:
---> 29         ebitda_total += EBITDA_YIELD[i]
     30     print(ebitda_total)
     31     return ebitda_total

/build/src/qexec_repo/zipline_repo/zipline/pipeline/term.py in __getitem__(self, key)
    210     @expect_types(key=Asset)
    211     def __getitem__(self, key):
--> 212         if isinstance(self, LoadableTerm):
    213             raise NonSliceableTerm(term=self)
    214         return Slice(self, key)

/build/src/qexec_repo/zipline_repo/zipline/utils/input_validation.pyc in _check(func, argname, argvalue)
    451                     'funcname': get_funcname(func),
    452                     'argname': argname,
--> 453                     'actual': actual(argvalue),
    454                 },
    455             )

TypeError: zipline.pipeline.term.__getitem__() expected a value of type zipline.assets._assets.Asset for argument 'key', but got str instead.
In [ ]: