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.69k stars 458 forks source link

Allow Get All Account Profile Info (Including IRA Numbers) #460

Closed NelsonDane closed 4 months ago

NelsonDane commented 8 months ago

I created this to solve the issue I was facing here (https://github.com/jmfernandes/robin_stocks/issues/426). The main issue was that there was no way to retrieve the Robinhood IRA account numbers, despite support for IRAs being added earlier when passing the account number into certain functions (such as load_account_profile).

At first, I considered creating a new function to serve this purpose (which is still an option), but I found that it could be accomplished in a simpler manner using the already existing load_account_profile function. Before, this function was hardcoded to always return the first item in the data list (the indexzero option). This means that only the data for the first account is returned (the individual account) unless the IRA number is hardcoded and passed in manually. These changes tweak the URL so that all accounts are returned, and then the optional value of dataType can be used to retrieve the entire result, or by default do what it's already doing.

TLDR: These changes allow the retrieval of all accounts (Individuals and IRAs) by bubbling up the dataType param to load_account_profile. Unless a value is specifically assigned to dataType, the function acts exactly as it does in the current implementation.

NelsonDane commented 8 months ago

If you're interested @doctorcolossus

terose73 commented 5 months ago

+1, there is no other way right now to programmatically fetch IRA account numbers. Thanks for adding this!