ranaroussi / ezibpy

ezIBpy, a Pythonic Client for Interactive Brokers API
Apache License 2.0
324 stars 116 forks source link

Unify logging; connection status tracking. #6

Closed jkleint closed 7 years ago

jkleint commented 7 years ago

Set ezIBPy.connected on every message, except clear it on those indicating disconnects. create_logger() function creates loggers in a consistent way between ezibpy and qtpylib. Adds methods to convert IBPy Order and Contract objects to human-readable dicts.

ranaroussi commented 7 years ago

Very nice job!

I renamed indicatesDisconnection() to handleConnectionState() and expanded its functionality to stores connection state in self.connected, as well as fire a handleConnectionOpened callback when connection is established.

I've also introduced a reconnect() method to re-establish lost connection to TWS/GW, which gets invoked automatically from handleConnectionClosed () whenever connection is lost.