how to add the function 'backtesting_extra_symbols' to a script

idaganiidagani Posts: 11
edited March 2017 in Under The Hood

Hello,

I'm interested in using 'backtesting_extra_symbols'.

Adding a function manually creates a class function, not a static function as this should be,
could you please advise how to do it.

Best,
Itay

Comments

  • shayneshayne Posts: 70
    edited August 2017

    try this ...

    from cloudquant.interfaces import Strategy
    
    class BacktestingExtraSymbols(Strategy):
    
        @staticmethod
        def is_symbol_qualified(symbol, md, service):
            return symbol == 'TQQQ'
    
        @staticmethod
        def backtesting_extra_symbols(symbol, md, service):
            return symbol == 'QLD'
    
    
        def on_start(self, md, order, service, account):
            print(service.time_to_string(service.system_time) )
            print( "{}\tlast\t{:.2f}".format(self.symbol,md.L1.last)  )
            print( "{}\tlast\t{:.2f}".format('QLD',md['QLD'].L1.last)  )
    
            service.terminate()
    
Sign In or Register to comment.