Add brokermod loader utils
parent
618d4b52c1
commit
49d290d036
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue