- Working with Python wrapper
The Macrobond Data API for Python uses either the Macrobond Web REST API or the Macrobond Client data API to obtain time series with values and metadata. The API consists of a set of functions in common between the underlying APIs as well as specialized functions unique to each implementation.
You get time series directly as Pandas series.
This API can be used only with Data+ license.
Macrobond Data API for Python officially supports Python 3.6+.
Macrobond Data API for Python is available on PyPI:
python -m pip install macrobond-data-api
When using WebClient it is recommended to use the system keyring. This can be done easily by running the include script using this command:
python -c "from macrobond_data_api.util import *; save_credential_to_keyring()"
- macOS Keychain
- Freedesktop Secret Service supports many DE including GNOME (requires secretstorage)
- KDE4 & KDE5 KWallet (requires dbus)
- Windows Credential Locker
Learn more about the Commonly used metadata in Macrobond.
import macrobond_data_api as mb_api usgdp = mb_api.get_one_series("usgdp") print(usgdp)
#web from macrobond_data_api.web import WebClient with WebClient('client id', 'client secret') as api: series = api.get_one_series('usgdp') print(series) #com from macrobond_data_api.com import ComClient with ComClient() as api: series = api.get_one_series('usgdp') print(series)
We have prepared examples in Jupyter Notebooks to help you start using Python wrapper. See them on our Github.