ig-python / trading-ig

A lightweight Python wrapper for the IG Markets API
https://trading-ig.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
308 stars 196 forks source link

Adjustment of ApiExceededException FAQs #280

Closed starsnpixel closed 1 year ago

starsnpixel commented 1 year ago

When trying to integrate the rate limiters described in https://trading-ig.readthedocs.io/en/latest/faq.html#how-to-avoid-hitting-the-rate-limits I kept running into the proble that PyCharm kept sending "ImportError: cannot import name 'ApiExceededException' from 'trading_ig'" errors. Workaround: init.py needs to be updated to

from .rest import IGService, ApiExceededException
__all__ = [
    "IGService",
    "IGStreamService",
    "ApiExceededException"
]

Probably there's a good reason to not set ApiExceededException as a default here but then it should be noted in the FAQs, I suggest. :-)

Also, it says "The rate limiter functionality uses threads which exit when IGService.logoff() is called, so it is important to ensure a logoff happens or these threads will be left spinning until del() cleans them up." but IGService doesn't have a "lofoff" function but only "logout". Or did I overlook something?

bug-or-feature commented 1 year ago

You can see from the CI build that the tests work fine without your proposed change:

https://github.com/ig-python/trading-ig/actions

Thanks for the docs tip, fixed