jmfernandes / robin_stocks

This is a library to use with Robinhood Financial App. It currently supports trading crypto-currencies, options, and stocks. In addition, it can be used to get real time ticker information, assess the performance of your portfolio, and can also get tax documents, total dividends paid, and more. More info at
http://www.robin-stocks.com
MIT License
1.68k stars 457 forks source link

{'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 #418

Open SingularityMan opened 1 year ago

SingularityMan commented 1 year ago

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.

ccirera71 commented 1 month ago

I had exactly the same issue, and at the end was my python version (should be >=3.9) that was constrining me to an old robin_hood version.

  1. Go to the python web page, download an updated version (remember >=3.9) and "Add Python to PATH"
  2. pip uninstall robin_stocks
  3. pip install requests pyotp python-dotenv cryptography
  4. pip install git+https://github.com/jmfernandes/robin_stocks.git

I hope that this works for you as well !