Add recurring investments API support #1633
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive support for Robinhood's recurring investments feature, allowing users to programmatically create, retrieve, update, and cancel recurring investment schedules.
Changes
New Module:
robin_stocks/robinhood/recurring_investments.pyget_recurring_investments()- Fetch all recurring investments (supports filtering by account or asset types)create_recurring_investment()- Create new recurring investments with configurable frequency and amountupdate_recurring_investment()- Update existing investments (pause/resume, change amount/frequency)cancel_recurring_investment()- Cancel recurring investments (uses PATCH with state="deleted")get_next_investment_date()- Get the next investment date for a given frequencyModified Files
robin_stocks/robinhood/urls.py- Added URL helper functions for recurring investment endpointsrobin_stocks/robinhood/__init__.py- Exported all new recurring investment functionsTechnical Details
bonfire.robinhood.com/recurring_schedules/(discovered through reverse engineering)@login_requireddecorator and session managementTesting
✅ Tested with real Robinhood account:
Example Usage
n
import robin_stocks.robinhood as rh
rh.login(username='...', password='...')
Get all recurring investments
investments = rh.get_recurring_investments()
Create a new recurring investment
rh.create_recurring_investment('TSLA', 50.0, frequency='weekly')
Pause an investment
rh.update_recurring_investment(schedule_id, state='paused')
Cancel an investment
rh.cancel_recurring_investment(schedule_id)## Notes
robin_stocksapproach since Robinhood doesn't offer a public API