示例#1
0
listener.start_listener(open_cb=on_open, close_cb=on_close, msg_cb=on_message, error_cb=on_error)
if listener.listener_active():
    print("Thread was started")
    thread_active = True

time.sleep(5)
listener.stream_subscribe("AMD", "T")

# Main thread - handles the logic for the trading algorithm
#while thread_active:
    #pass"""

if __name__ == '__main__':
    backtest = Backtest()
    backtest.set_duration(48)
    backtest.add_symbol("AMD")
    backtest.add_symbol("AAPL")
    backtest.add_symbol("NFLX")
    backtest.add_symbol("FB")
    backtest.add_symbol("PK")
    #backtest.download_data()

    #time.sleep(5)
    #backtest.close_browser()
    #print(backtest.get_files(backtest.get_path()))
    test_path = "C:\\Users\\goodp\\PycharmProjects\\AlgoTrading\\02082021223022"
    backtest.test_strategy("AAPL", test_path)
    watchlist = backtest.get_symbols()

    # TODO could add a callback to test_strategy to add the result to a P/L list