ibind icon indicating copy to clipboard operation
ibind copied to clipboard

Feature Request: Recurring Investment API Implementation

Open parthchandak02 opened this issue 8 months ago • 4 comments

I'd like to request the implementation of a recurring investment feature with bulk management capabilities in the IBIND library. While Interactive Brokers offers recurring investments through their Client Portal UI, there's no API access for programmatic control, and no efficient way to manage multiple recurring investments at scale.

The feature would consist of two main components:

1. Core Recurring Investment API:

  • Create recurring investment instructions (symbol, amount, frequency)
  • Modify existing recurring investments
  • Cancel recurring investments
  • List all active recurring investments
  • Get the status and history of recurring investment executions

2. Bulk Management Extension:

  • Create multiple recurring investments in a single operation
  • Modify existing recurring investments in bulk
  • Cancel multiple recurring investments with one command
  • Import/export recurring investment configurations (CSV/JSON)
  • Apply templates or predefined investment strategies

This would transform what is currently a tedious manual process into an efficient, automated workflow.

Context

This enhancement addresses two significant pain points:

  1. Lack of API Access to Recurring Investments: Currently, recurring investments can only be set up through the Interactive Brokers Client Portal UI, with no programmatic access. This prevents automation of investment strategies.

  2. Tedious Manual Process for Multiple Investments: Managing recurring investments at scale is extremely time-consuming across all investment platforms. Each investment must be configured individually through UIs not designed for bulk operations.

These limitations are particularly frustrating when:

  • Implementing dollar-cost averaging across multiple securities
  • Rebalancing a portfolio with many positions
  • Adjusting investment strategies across multiple accounts
  • Setting up new investment plans that involve multiple securities

What takes hours of tedious clicking and data entry could be accomplished in seconds with a proper API. This would be a significant competitive advantage for IBIND and would solve a real pain point that exists across the industry.

Possible Implementation

Since there's no direct API endpoint for recurring investments, this could be implemented in phases:

Phase 1: Core Recurring Investment API

# Create a recurring investment
client.create_recurring_investment(
    symbol="VTSAX",
    amount=500.00,  # Dollar amount
    frequency="MONTHLY",  # DAILY, WEEKLY, MONTHLY
    day_of_month=1,  # For monthly frequency
    start_date="2025-05-01",
    end_date=None,  # Optional, None for indefinite
    account_id=None  # Optional, uses default if None
)

# List active recurring investments
recurring_investments = client.get_recurring_investments()

# Cancel a recurring investment
client.cancel_recurring_investment(investment_id)

Phase 2: Bulk Management Extension

# Create multiple recurring investments at once
client.create_recurring_investments([
    {
        "symbol": "VTSAX",
        "amount": 500.00,
        "frequency": "MONTHLY",
        "day_of_month": 1
    },
    {
        "symbol": "VTIAX",
        "amount": 300.00,
        "frequency": "MONTHLY",
        "day_of_month": 15
    },
    # ... more investments
])

# Update multiple recurring investments matching criteria
client.update_recurring_investments(
    filter={"frequency": "MONTHLY"},
    updates={"frequency": "BIWEEKLY"}
)

# Import from CSV
client.import_recurring_investments_from_csv("investments.csv")

# Apply a template with custom allocation
client.apply_investment_template(
    template="THREE_FUND_PORTFOLIO",
    total_amount=1000.00,
    allocations={
        "US_STOCKS": 0.60,
        "INTL_STOCKS": 0.30,
        "BONDS": 0.10
    },
    frequency="MONTHLY"
)

Implementation approaches could include:

  • Scheduled Order System: Store recurring investment instructions and execute them at specified times
  • Client Portal Automation: Create a programmatic interface to the existing UI functionality
  • Custom Database + Daemon: Store configurations and run a process to check and execute scheduled investments

parthchandak02 avatar Apr 24 '25 17:04 parthchandak02

hey @parthchandak02 thanks for your enhancement suggestion. Indeed, just like you write:

There's no direct API endpoint for recurring investments

How do you envision this could be implemented in the light of this functionality not being exposed through an API?

Voyz avatar Apr 25 '25 08:04 Voyz

IBIND would let users set up their own recurring investment instructions (for example: which stock, how much, and how often).

  • These instructions would be saved locally (in a file or database).
  • A background process or script would run at the chosen intervals (like daily, weekly, or monthly).
  • When it’s time, the script would use the IBKR API to place a regular buy order for the specified stock and amount.
  • This process would repeat automatically according to the user’s schedule, just like a recurring investment.

parthchandak02 avatar Apr 29 '25 00:04 parthchandak02

Thank you for clarifying. IMHO this would be out of the scope of an API client library and should be implemented outside of ibind. In case IBKR offers an API endpoint for recurring investments in the future, i believe ibind maintainers would certainly welcome a pull request.

salsasepp avatar Apr 29 '25 12:04 salsasepp

Thanks - that is fair. I am thinking of using google apps script and webhooks, will keep y'all posted on how it goes.

parthchandak02 avatar Apr 29 '25 20:04 parthchandak02

I'm going to close this due to inactivity. Thanks for the contribution so far, feel free to let me know if you'd like it reopen and continue the discussion 👍

Voyz avatar Jun 23 '25 11:06 Voyz