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.74k stars 467 forks source link

access to IRA account? #366

Open MMM071 opened 1 year ago

MMM071 commented 1 year ago

Hi, robinhood just launched IRA account and I have both brokerage and IRA accounts under the same email. How could I access the IRA account? Thanks

rahelannader commented 1 year ago

I'm having the same problem friend. I think we'd have to change some account function to query all accounts 🤷🏻‍♀️

henryzhangpku commented 1 year ago

same question. It is better to add account number into the position pulling or order placing function that we can switch to different accounts including IRA.

mw66 commented 1 year ago

Any one know where to change/ debug / test IRA account trading?

Thanks.

mw66 commented 1 year ago

Anyone know which function can return ira_account_number?

tried:

  profile = rh.load_account_profile("account_number")

but it can only return my regular account number.

@jmfernandes this repo has no update for a year now, if you do not have time, maybe you can add another co-owner to this repo?

henryzhangpku commented 1 year ago

I spent some time tonight to look into the API . I think I developed one version to trade Robinhood IRA accout now ! :) I will do more testing tomorrow and release this new version.

mw66 commented 1 year ago

@henryzhangpku that's great! looking forward to it!

henryzhangpku commented 1 year ago

It worked well this morning. I will be considering a PR to merge this new feature in.

mw66 commented 1 year ago

@henryzhangpku,

Looking forward to your PR! Thanks.

COBOLAced commented 1 year ago

@henryzhangpku,

Any word on your PR? It would be great to access the retirement account data! Thanks for your contribution to the community! Really looking forward to it. :)

henryzhangpku commented 1 year ago

Folks, here is the PR : https://github.com/jmfernandes/robin_stocks/pull/377/ It works for me to 1) monitor IRA account for stocks/options positions , and 2) place stocks/etf order by fractional quantity or price. TODOS:

  1. there are a lot of different order functions in order.py , so far I only use order_xxx_fractional_by_quantity, and order_xxx_fractional_by_price myself, so I did not touch/modify other ordering functions. Feel free to help yourself to update them if you need, it should be very familiar to the fractional quantity/price that I completed.
  2. placing option orders. I actually got this one working just today , but I have not checked into the PR yet , may take a few more days to test and add it to the PR. It is also working for me. Enjoy !

Henry

henryzhangpku commented 1 year ago

Just checked in the option ordering part, by using different RHS accounts.

COBOLAced commented 1 year ago

@henryzhangpku, Fantastic! I see that you submitted a commit. Thanks! I'll try it out.

henryzhangpku commented 1 year ago

yeah with this PR you can definitely programmatically obtain the options positions in Roth and Traditional IRA accounts. Just passing different account_numbers to get_open_option_positions(), you can get them .

rahelannader commented 1 year ago

@henryzhangpku It only shows regular account for load_account_profile(account no). Are you able to see both retirement and regular accounts? Are you using a different endpoint?

mw66 commented 1 year ago

@rahelannader you need to pass in your (IRA account number), then it will work.

henryzhangpku commented 1 year ago

exactly, the default account_number would be your regular RHS account . You can specify IRA or other account by passing the account_number.

farbodbahari commented 7 months ago

Is there any update on this? Was anyone successful in pulling the IRA holdings?

henryzhangpku commented 7 months ago

Yes, all the time. What was your issue ?

H

On Thu, Apr 18, 2024 at 3:48 PM farbodbahari @.***> wrote:

Is there any update on this? Was anyone successful in pulling the IRA holdings?

— Reply to this email directly, view it on GitHub https://github.com/jmfernandes/robin_stocks/issues/366#issuecomment-2065448315, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVCW5XXC56PVXOMDDLBLN3Y6BEVXAVCNFSM6AAAAAAUOOMQK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRVGQ2DQMZRGU . You are receiving this because you were mentioned.Message ID: @.***>

farbodbahari commented 7 months ago

Yes, all the time. What was your issue ? H On Thu, Apr 18, 2024 at 3:48 PM farbodbahari @.> wrote: Is there any update on this? Was anyone successful in pulling the IRA holdings? — Reply to this email directly, view it on GitHub <#366 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVCW5XXC56PVXOMDDLBLN3Y6BEVXAVCNFSM6AAAAAAUOOMQK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRVGQ2DQMZRGU . You are receiving this because you were mentioned.Message ID: @.>

I need to execute the following functions / method to get my positions and historical portfolio value for Roth IRA and Traditional IRA, however, I can't find a way to specify the account number for them. It returns the data for my brokerage account only.
Thanks!

Can't specify account number

robin.build_user_profile() robin.get_historical_portfolio(interval='day',span='5year') robin.get_all_stock_orders() robin.login()

Can specify account number

pd.DataFrame(robin.get_all_open_stock_orders(account_number=''))

image

farbodbahari commented 7 months ago

Yes, all the time. What was your issue ? H On Thu, Apr 18, 2024 at 3:48 PM farbodbahari @.> wrote: Is there any update on this? Was anyone successful in pulling the IRA holdings? — Reply to this email directly, view it on GitHub <#366 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVCW5XXC56PVXOMDDLBLN3Y6BEVXAVCNFSM6AAAAAAUOOMQK2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANRVGQ2DQMZRGU . You are receiving this because you were mentioned.Message ID: @.>

So I figured to use get_open_stock_positions() instead of build_holdings() to retrieve positions in individual or IRA accounts. What I could not figure out are

  1. Getting the traded history
  2. Daily portfolio value of an IRA account.

The 2 functions below for these 2 tasks only do it for the regular individual account by default and do not allow to specify account number. robin.get_all_stock_orders() robin.get_historical_portfolio()

henryzhangpku commented 6 months ago

can we try this PR ? https://github.com/jmfernandes/robin_stocks/pull/471 or alternatively my fork https://github.com/henryzhangpku/systematic_hood that is already working for multi-accounts.