robin_stocks icon indicating copy to clipboard operation
robin_stocks copied to clipboard

{'non_field_errors': ['Your app version is missing important stock trading updates. You can still place orders on the web.']} after updating to robin_stocks 3.0.5

Open SingularityMan opened this issue 1 year ago • 1 comments

I pip installed robin_stocks 3.0.5 and I'm running into issues with transactions for TQQQ and SQQQ during 24-hour markets but this issue also occurs during normal market hours. Here is a sample code of one of my transactions:


                            if PDT() < 3:

                                # Sell TQQQ by entire shares, not price, outside extended hours, gfd
                                subtracted_amount = float(getETFInfo('TQQQQuantity')) * 0.10
                                """sell = r.orders.order(symbol='TQQQ', quantity=round(float(getETFInfo('TQQQQuantity'))-1),
                                                      side='sell', timeInForce='gfd', extendedHours=True)"""
                                sell = r.orders.order_sell_fractional_by_quantity('TQQQ', floor(
                                    float(getETFInfo('TQQQQuantity'))) - 1, timeInForce='gfd', extendedHours=True)

                                print(sell)

                                print('TQQQ Sold: ' + getETFInfo('TQQQQuantity') + ' shares remaining.')

                                # Get buying power in preparation for possible purchase
                                buyingPowerDict = r.account.load_phoenix_account(info="account_buying_power")
                                buyingPower = float(buyingPowerDict['amount'])

                                # Adjust buying power if the portfolio value is greater than $25,000 and subtract that
                                # amount for it while being able to invest up to $50,000 after the adjustment.

                                # Get portfolio value
                                portfolioValue = float(r.profiles.load_portfolio_profile(info='equity'))

                                # Adjust buying power if portfolio value is greater than $25,000
                                if portfolioValue > 25000:
                                    buyingPower = buyingPower - (portfolioValue - 25000)
                                    print(f'Adjusted buying power: {buyingPower}')
                                else:
                                    print('Unadjusted Buying Power:', buyingPower)

                                time.sleep(120)

                            else:
                                print('PDT is 3 or greater. Cannot sell TQQQ.')

                            # Buy SQQQ in dollars, outside extended hours, gfc if PDT is less than 2. Subtract 5% from the buying power available.
                            if PDT() < 3:
                                subtractedBuyingPower = buyingPower * 0.30
                                # Buy SQQQ using price, not shares, outside extended hours, gfd
                                # Check if SQQQ is greater than 0 but less than 1

                                print('Buying SQQQ')
                                buy = r.order_buy_fractional_by_price('SQQQ', floor(buyingPower), timeInForce='gfd',
                                                                      extendedHours=True)

                                print(buy)

                                time.sleep(120)

                                print('SQQQ Purchased. Shares:', getETFInfo('SQQQQuantity'))

Basically when fractional orders are placed I get the error message in the title. I'm sure its probably because we need to update the payload in order to get the right transaction but I would like to see an actual patch and not just a workaround to these transactions as this project is supposed to be showcased in my portfolio and I wouldn't want potential employers having to mess around with the source code of the cloned repo in order to get it to work

@jmfernandes I see there are a number of pull requests open. Can you update orders.py to get the correct order submitted to Robinhood?

UPDATE: So it does seem to sell so I guess the issue here is placing the order itself. Next time the bot attempts to buy I'm gonna keep an eye out.

SingularityMan avatar Jul 27 '23 21:07 SingularityMan