This project provides a comprehensive integration of Ghana's financial data (FX and Bonds) into the OpenBB ecosystem. It includes a FastAPI Backend for the OpenBB Workspace and a Custom Extension for the OpenBB Platform (Python/CLI).
- Bank of Ghana FX Scraper: Automatically scrapes daily USD/GHS interbank rates.
- GSE Bond Parser: Extracts yields and volumes for 2-year and 5-year Ghana Government Bonds from GFIM reports.
- FastAPI Backend: Serves data via a REST API compatible with OpenBB Workspace widgets.
- OpenBB Extension: Adds a
/ghanamenu directly into the OpenBB Platform.
.
├── openbb_ghana/ # OpenBB Extension package
│ ├── __init__.py
│ ├── bog_fx_scraper.py # FX Scraper logic
│ ├── gse_bond_parser_excel.py # Bond Parser logic
│ ├── models.py # Pydantic data models
│ └── router.py # OpenBB Router definition
├── main.py # FastAPI Backend server
├── widgets.json # OpenBB Workspace configuration
├── pyproject.toml # Extension registration
├── requirements.txt # Dependencies
└── README.md # Documentation
# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate
# Install dependencies
pip install -r requirements.txtTo use the /ghana menu in Python or the CLI, install the extension in editable mode:
pip install -e .After installation, you may need to rebuild the OpenBB static assets:
openbb-build-
Start the Backend Server:
python3 main.py
The server will run at
http://localhost:8000. -
Connect to Workspace:
- Go to OpenBB Workspace.
- Navigate to Settings > Custom Backends.
- Add
http://localhost:8000as a new backend. - Add the "Ghana Financial Data" widgets to your dashboard.
You can access the data directly in your Python scripts:
from openbb import obb
# Get FX rates
fx = obb.ghana.fx()
print(fx.to_df())
# Get Bond yields
bonds = obb.ghana.bonds()
print(bonds.to_df())MIT