quantlab.acquisition.base.DataSourceRegistry#
- class quantlab.acquisition.base.DataSourceRegistry[source]#
Bases:
objectThe collection of every registered
SourceDescriptor.register_sourceadds a descriptor when its vendor module is imported, so defining a source registers it;quantlab.acquisition.registryimports every vendor, so the collection is complete once that module is imported. Read it throughall()andget(); the class is never instantiated.- Attributes:
- SOURCEStuple of SourceDescriptor
Every registered descriptor, in registration order.
Examples
>>> import quantlab.acquisition.registry >>> from quantlab.acquisition.base import DataSourceRegistry >>> [d.vendor for d in DataSourceRegistry.all()] ['alpaca', 'fred', 'massive', 'sharadar', 'tiingo', 'wrds'] >>> DataSourceRegistry.get("tiingo").display_name 'Tiingo EOD'
- classmethod all()[source]#
Return every registered descriptor, sorted by vendor.
Sorting makes the result independent of which vendor module the caller happened to import first.
- Returns:
- tuple of SourceDescriptor
The descriptors sorted by
vendor, or()when nothing is registered.
Examples
>>> len(DataSourceRegistry.all()) 6 >>> DataSourceRegistry.all()[0].vendor 'alpaca'
- classmethod get(vendor)[source]#
Return the descriptor registered for
vendor.- Parameters:
- vendorstr
The vendor’s short name, for example
"tiingo".
- Returns:
- SourceDescriptor
The registered descriptor.
- Raises:
- ValueError
If no descriptor is registered for
vendor. The message lists the vendors that are registered.
Examples
>>> DataSourceRegistry.get("tiingo").vendor 'tiingo' >>> DataSourceRegistry.get("bloomberg") Traceback (most recent call last): ... ValueError: No data source is registered for vendor 'bloomberg'. ...