wboayue / rust-ibapi

An implementation of the Interactive Brokers API for Rust
MIT License
38 stars 17 forks source link

Reconnect to IB in case of failed connection #96

Open Pl0414141 opened 1 year ago

Pl0414141 commented 1 year ago

To reproduce:

  1. Open TWS
  2. Connect via 'let mut client = Client::connect("127.0.0.1:7496", 100).unwrap();'
  3. Close TWS

Expected result:

Script still alive and trying to reconnect.

Actual result:

Script terminated.

richard-fairthorne commented 6 months ago

Noticed this right away after installing. I was super happy at how fast and easy it was to connect, but I need to know if it fails.

t00ts commented 5 months ago

What's the status of this issue? Noticed @wboayue has a branch that may be related: issue-96-reconnect.

I'm not familiar with the project, but would consider chipping in if this is stalled. Handling connection failures seems like a crucial aspect of any system using this.

wboayue commented 5 months ago

@t00ts I have a branch open to fix a bug that occurs because I attempt to retry the connection. There are some cases where the library can successfully attempt a reconnection. However, in most cases, I think it's better for the library to properly propagate the network failures and let the application determine the course of action. What I'm working on fixing first are the cases where the library doesn't correctly propagate the network failures.