PygameButton(game_display, left_arm_g, (0, 0, 255), font, " C", (255, 255, 255)) PygameButton(game_display, right_arm_g, (0, 0, 255), font, " O", (255, 255, 255)) finish_button = PygameButton(game_display, finish_button_position, (255, 0, 0), font, "Finish", (255, 255, 255)) pygame.display.update() crashed = False # directory = max(glob.glob('*'), key=os.path.getctime) # path to last modified folder directory = 'Your model directory name' # hard coded path to trained model with open(directory + '/Data.pickle', 'rb') as handle: rows_per_epoch = pickle.load(handle)['X'].shape[0] with open(directory + '/Model.pickle', 'rb') as handle: clf = pickle.load(handle) # clf.zero_thresh = 0.5 # this classifier parameter can be changed during control stage bci = BCI() prp = BatyaGGPreprocessor(rows_per_epoch) recent_data = prp.fit_test(bci.get_recent_data(rows_per_epoch)) current_class = clf.predict(recent_data) control_updater = ControlUpdater(['x', 'y', 'z', 'g']) current_control = control_updater.get_next() ur = UR() ur.go_home() mixer.music.load('x_axis.mp3') mixer.music.play() while not crashed: if current_class == 3: current_control = control_updater.get_next() if current_control == 'x': mixer.music.load('x_axis.mp3') mixer.music.play()
f"secondary_volume_filter: {secondary_volume_filter}, " f"max_allocation: {max_allocation}, " f"running_avg_volume_period: {running_avg_volume_period}, " f"candidates: {candidates}" f"primary_candidate: {primary_candidate}, " f"secondary_candidate: {secondary_candidate}, " f"offset: {offset}") try: bci = BCI(index_size=index, rebalancing_period=rebalancing, primary_usd_filtering=primary_volume_filter, secondary_usd_filtering=secondary_volume_filter, max_asset_allocation=max_allocation, fee=0.02, running_avg_volume_period=running_avg_volume_period, index_candidate_size=candidates, primary_candidate_size=primary_candidate, secondary_candidate_size=secondary_candidate, initial_funds=1000, offset=offset, start_dt=start_dt, end_dt=end_dt) # use previously calculated data to save initialization time if data_by_coin is None: bci.set_input_data(input_data) else: bci.data = data bci.dates = dates bci.data_by_coin = data_by_coin
return vars(parser.parse_args()) if __name__ == "__main__": LOG.info("Bitpanda Crypto Index Simulator") args = parse_args() bci = BCI( index_size = args['index'], rebalancing_period = args['rebalancing'], primary_usd_filtering = args['primary_volume_filter'], secondary_usd_filtering = args['secondary_volume_filter'], max_asset_allocation = args['max_allocation'], fee = args['fee'], running_avg_volume_period = args['volume_period'], index_candidate_size = args['candidates'], primary_candidate_size = args['primary_candidates'], secondary_candidate_size = args['secondary_candidates'], initial_funds = args['funds'], offset = args['offset'], bypass_validation = args['bypass_validation'], input_file_name = args['input_file'], start_dt = args['start_date'], end_dt = args['end_date'], show_graph = args['show_graph'], save_graph = args['save_graph'] ) bci.run()