TedataBB
April 19, 2025 ยท View on GitHub
Trading Economics data backend to be used by OpenBB Workspace.
Getting Started
This custom backend provides access to Trading Economics data from within the OpenBB Workspace platform, allowing you to search and visualize economic indicators.
Disclaimer
This tool is for personal, educational, and research purposes only.
Prerequisites
- Python 3.8+
- Firefox browser installed (required by tedata)
Installation
- Clone this repository:
git clone https://github.com/jlokos/tedata_openbb_backend.git
cd tedata_openbb_backend
- Create a virtual environment and install the dependencies:
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
Running
Environment Variables
You can customize the behavior using these environment variables:
TEDATA_DISABLE_LOGGING=true # Disable detailed tedata logging
Start the FastAPI server:
uvicorn main:app --reload --port 8000
Integrating with OpenBB
Go into OpenBB Workspace at https://pro.openbb.co/ and add this custom backend.
- Name: TedataBB
- URL: http://127.0.0.1:8000
If all is working, you can click "Test" and get confirmation of how many widgets are valid.
Features
Search Widget
Search for economic indicators across Trading Economics database:
- Search by country, indicator name, or other keywords
- View search results in a table format
Scrape Widget
Extract time-series data for selected economic indicators:
- Supports multiple scraping methods (highcharts_api, path, tooltips, mixed)
- Retrieves historical data points
- Presents data in a table format ready for analysis
Metadata Widget
View detailed metadata for any economic indicator:
- See full description, source, latest values
- View update frequency and other important information
- Choose between pretty formatted view and raw JSON format
Known TODOs
- Search functionality needs improvement to allow grouping by indicator_id
- When clicking an indicator ID in search results, it should copy to clipboard rather than populating the search widget
Repo Structure
main.py
The main entry point for the FastAPI application that:
- Creates a FastAPI instance with API documentation
- Configures CORS middleware for cross-origin requests
- Implements endpoint handlers for searching and scraping data
- Provides utility functions for data extraction and formatting
widgets.json
Defines the widget configurations recognized by OpenBB Workspace:
- Parameter definitions
- Widget size recommendations
- Descriptions and documentation
- Category assignments for organization
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.