Mariner Backtesting - service.symbol_list.in_list()

(method) Overview:

Given a Handle object and a symbol (string), return a bool representing whether or not the symbol has been added to the guid pointed to by the Handle object.

Interface:
 in_list(handle,
        symbol)

Sample - Calling Method

 symbol_list.in_list( handle, symbol )
Parameters:

Sample - Calling Method

earnings_today_after = service.symbol_list.get_handle('448CBB9E-CFDE-4A55-BB7B-7521080E5A0BB') # Today After    
service.symbol_list.in_list( earnings_today_after, 'AAPL')
Name Type Default Information
handle string required Handle from service.symbol_list.get_handle()
symbol string required Symbol
Returns
Type Notes
boolean Whether symbol is in list or not
Remarks:
  • Goes with in_list()
  • Lists
Working Example:

Check list "Earnings Today After" to see if AAPL is in it.

 from cloudquant.interfaces import Strategy

class InListExample(Strategy):
    @classmethod
    def is_symbol_qualified(cls, symbol, md, service, account):
        return symbol == "AAPL"
    def on_start(self, md, order, service, account):
        vol_over_one_million_list = service.symbol_list.get_handle('c5673334-de39-4ad2-b517-82b591cdb928')
        print service.symbol_list.in_list(vol_over_one_million_list, 'AAPL')
        service.terminate()

Console

True