Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jessebyarugaba/Unofficial-Uganda-Securities-Exhange-API/llms.txt

Use this file to discover all available pages before exploring further.

Method signature

public function getAllPortfolioCompanies()
Retrieves a list of all companies listed on the Uganda Securities Exchange, including their current market data.

Parameters

This method takes no parameters.

Return value

Returns a JSON-encoded string containing an array of companies. Each company is represented as an array with the following structure:
[0]
string
Company ticker symbol (e.g., “BOBU”)
[1]
string
Company name or additional data from the market snapshot
[2]
string
Additional market data field
[n]
string
URL to the company’s profile page on USE website (format: https://www.use.or.ug/listed/{ticker})

Response example

[
  [
    "BOBU",
    "Bank of Baroda Uganda",
    "1,250",
    "https://www.use.or.ug/listed/BOBU"
  ],
  [
    "DFCU",
    "DFCU Bank",
    "850",
    "https://www.use.or.ug/listed/DFCU"
  ]
]

Usage example

<?php

$portfolioManager = new PortfolioManager();

// Get all portfolio companies
$allCompanies = $portfolioManager->getAllPortfolioCompanies();

// Output the JSON result
echo $allCompanies;

?>

How it works

1

Fetch market snapshot

The method scrapes data from the USE market snapshot page at https://www.use.or.ug/content/market-snapshot
2

Parse table data

Extracts company information from the HTML table structure on the page
3

Build URLs

Appends a direct link to each company’s profile page in the format https://www.use.or.ug/listed/{ticker}
4

Return JSON

Converts the data to JSON format and returns it with appropriate Content-Type: application/json header

Notes

  • The method sets the HTTP header Content-Type: application/json
  • Data is scraped in real-time from the Uganda Securities Exchange website
  • The exact number and structure of fields may vary based on the USE website’s table structure
  • Memory is explicitly cleared after parsing to optimize performance