oanda / oandapy

Python wrapper for the OANDA REST API
MIT License
321 stars 147 forks source link

Generic streaming #26

Closed hootnot closed 8 years ago

hootnot commented 8 years ago

The current Streamer class is not able to stream events.

By separating the Streamer class and make use of an EndPointsMixin to support of both rates and events, the Streamer class can now generic be extended to support multiple endpoints.

The original start() method to get streaming rates has been kept for backward compatibility but raises a warning. The new Streamer class gives rates by calling the rates() method and events by calling the events() method The methods _onsuccess() and _onerror() are forced to be abstractmethods now using the abc module. Tests are supplied to test the Streamer() class new methods and backwards compatibility. README updated to reflect changes in Streamer class: rates() and events()

BadEnviroment exception introduced and isolated together with OandaError in exceptions.py Test for BadEnvironment exception on Streamer class added All tests pass for Python 2.7.5 and Python 3.4.3