Skip to content

mgalore/ghana-openbb-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ghana Financial Data Integration for OpenBB

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).

Features

  • 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 /ghana menu directly into the OpenBB Platform.

Project Structure

.
├── 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

Setup Instructions

1. Environment Setup

# Create a virtual environment
python3 -m venv .venv
source .venv/bin/activate

# Install dependencies
pip install -r requirements.txt

2. Install OpenBB Extension

To 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

Usage

Option A: OpenBB Workspace (Custom Backend)

  1. Start the Backend Server:

    python3 main.py

    The server will run at http://localhost:8000.

  2. Connect to Workspace:

    • Go to OpenBB Workspace.
    • Navigate to Settings > Custom Backends.
    • Add http://localhost:8000 as a new backend.
    • Add the "Ghana Financial Data" widgets to your dashboard.

Option B: OpenBB Platform (Python SDK)

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())

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages