示例#1
0
 def setUp(self):
     """
     Set up configuration.
     """
     #self.config = settings.TEST
     self.config = Config()
     self.testing = True
示例#2
0
        end_date,
        events_queue,
        session_type="backtest",
        name="strategy1",
        #benchmark=tickers[1],
        title=title)
    results = backtest.start_trading(testing=testing)
    #print(type(backtest))
    return results


if __name__ == "__main__":
    # Configuration data
    testing = False
    #config = settings.from_file(settings.DEFAULT_CONFIG_FILENAME, testing)
    conf = Config()
    ticker_list = ["AAPL", "ADI", "SPY"]
    ##bencht = "SPY"
    ##tickers = ["PEP", "PM"]
    filename = None
    eva = Evaluation()

    for t in ticker_list:
        tickers = []
        tickers.append(t)
        #tickers.append(bencht)
        rt = run(conf, testing, tickers, filename)
        eva.add_result(t, rt)
    print("===================")

    df_csv = pd.DataFrame()
示例#3
0
文件: mov.py 项目: cujeu/qalgo
    strategy = MovingAverageCrossStrategy(tickers[0],
                                          events_queue,
                                          short_window=100,
                                          long_window=300)

    # Set up the backtest
    backtest = TradingSession(
        config,
        strategy,
        tickers,
        initial_equity,
        start_date,
        end_date,
        events_queue,
        name="strategy1",
        title=title,
        benchmark=tickers[1],
    )
    results = backtest.start_trading(testing=testing)
    return results


if __name__ == "__main__":
    # Configuration data
    testing = False
    #config = settings.from_file(settings.DEFAULT_CONFIG_FILENAME, testing)
    conf = Config()
    tickers = ["AAPL", "SPY"]
    filename = None
    run(conf, testing, tickers, filename)