print ("Init stockfighter") s = Stockfighter(venue=venue, account=account) # Compute mini/maxi prices stockprices = [] aloop = int(argopts['--analyze-loop']) for i in range(0, aloop): # Get stock informations print ('.',end = "", flush=True) stockinfo = s.quote_for_stock(stock=stock) stockprices.append(stockinfo) time.sleep(pause) # Print stocks result print ('') df_allstocks = pd.DataFrame(stockprices) df_uniqstocks = df_allstocks.drop_duplicates() df_binmin = df_uniqstocks.min() print ("Stocks") print (df_uniqstocks[['venue', 'symbol', 'quoteTime', 'bid', 'ask', 'bidSize', 'askSize', 'bidDepth', 'askDepth']]) # New order bidmin = int(df_binmin['bid']) qty = int(argopts['--qty']) print ("Buy %(qty)s stocks at %(bidmin)s" % locals()) print (s.place_new_order(stock, bidmin, qty, 'buy', 'limit'))