def test_get_all_positionsself(self): stock = r.get_all_positions(info=None) self.assertNotEqual(len(stock), 0)
def all_positions(): print('\nRetrieving all positions ever traded....\n') result = rh.get_all_positions() ui.success(result)
print(f'this is all the items in list2: {list2}') print() print(f'this is the last item in list2: {last_item_list2}') print() # testing the 2nd 14 min period in SOLO's trading day on 11/27 if list2[1] < -70: #and open positions is null and open orders is null print('this would execute a trade on robinhood') lat_ask = r.get_latest_price('SOLO', priceType='ask_price', includeExtendedHours=True) # if r.get_all_open_stock_orders(): # r.order_buy_limit('SOLO', quantity, limitPrice, timeInForce='gtc', extendedHours=False) solo_lat_ask = float( r.get_latest_price('PLUG', priceType='ask_price', includeExtendedHours=True)[0]) solo_inst_url = r.get_instruments_by_symbols('PLUG')[0]['url'] for position in r.get_all_positions(): if position['instrument'] == solo_inst_url: solo_avg_buy = float(position['average_buy_price']) print('this is the current price diff') print(solo_lat_ask - solo_avg_buy) # print(dir(r))