bmoscon / cryptofeed

Cryptocurrency Exchange Websocket Data Feed Handler
Other
2.14k stars 666 forks source link

Use hasattr to determine if handler is callable #1013

Closed noahfrn closed 4 months ago

noahfrn commented 4 months ago

callable() returns True for classes that override the __call__ method, which means the existing logic doesn't properly handle all backends (using a BookPostgres callback as the handler will break, for example). This change uses hasattr to explicitly determine if the given handler:

Is a class Has a start method Has a stop method