Add brokermod loader utils

kivy_mainline_and_py3.8
Tyler Goodlet 2018-03-27 16:03:01 -04:00
parent 618d4b52c1
commit 49d290d036
1 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,23 @@
"""
Broker clients, daemons and general back end machinery.
"""
from importlib import import_module
from types import ModuleType
__brokers__ = [
'questrade',
'robinhood',
]
def get_brokermod(brokername: str) -> ModuleType:
"""Return the imported broker module by name.
"""
return import_module('.' + brokername, 'piker.brokers')
def iter_brokermods():
"""Iterate all built-in broker modules.
"""
for name in __brokers__:
yield get_brokermod(name)