Strategy Skeleton

Backtesting skeleton

Backtesting using SharkSigma

def setup_strategy(self):
        pass
    
def process_candle(self):
        pass

In addition to the strategy code, you will need some additional parameters such as capital, timeframe that needs to be added through the dropdowns in SharkSigma

Backtesting from Orca module directly requires additional setup.

First, you will need to import the Orca module with the import statement. Next, invoke a strategy class and inherit the properties of BaseIntradayStrategy class. setup_strategy and process_candle are methods that will have to be used in the strategy class.

Finally, a dictionary user_input_dict containing user inputs such as the instruments on which backtesting has to be done along with other parameters have to be passed.

User input dictionary parameters:

instrument_list:

table_name:

start_date

end_date

interval

initial_capital

market_hours

data_input_type

user_file_name

path_type

backtesting_template.py
from Orca import *

class Custom_Strategy(BaseIntradayStrategy):

    def setup_strategy(self):
        pass
    
    def process_candle(self):
        pass

user_input_dict = {
    'instrument_list' : ['AAPL'],
    'table_name' : 'sp500_5m',
    'start_date' : "08-01-2020",
    'end_date' : "09-30-2020",
    'interval' : '15min',
    'initial_capital' : 50000,
    'market_hours' : 1,
    'data_input_type' : 'db',
    'user_file_name' : 'Strategy_ORB_V01',
    'root_file_path': os.path.splitext(__file__)[0], #Current File Path
    'path_type': 'AWS'
}



def main():
    if __name__ == '__main__':

        run_object = user_input_invoke_run(user_input_dict = user_input_dict, strategy_name=Custom_Strategy)
        run_object.invoke_run()

main()

Last updated