# Grab the latest bar. latest_bars = trading_robot.get_latest_bar() # Add to the Stock Frame. stock_frame.add_rows(data=latest_bars) # Refresh the Indicators. indicator_client.refresh() print("=" * 50) print("Current StockFrame") print("-" * 50) print(stock_frame.symbol_groups.tail()) print("-" * 50) print("") # Check for signals. signals = indicator_client.check_signals() # Execute Trades. trading_robot.execute_signals(signals=signals, trades_to_execute=trades_dict) # Grab the last bar. last_bar_timestamp = trading_robot.stock_frame.frame.tail( n=1).index.get_level_values(1) # Wait till the next bar. trading_robot.wait_till_next_bar(last_bar_timestamp=last_bar_timestamp)
sell=20.0, condition_buy=operator.ge, condition_sell=operator.le) # print the frame. print(stock_frame.frame) keep_trading = True while keep_trading: # Grab a new quote. current_quotes = trading_robot.grab_current_quotes() # Add to the Stock Frame. stock_frame.add_rows(data=current_quotes) print(stock_frame.frame) # Refresh the Indicators. indicator_client.refresh() # Check for signals. signals = indicator_client.check_signals() # Execute Trades. trading_robot.execute_signals() # Sleep 5 seconds. time_lib.sleep(5)