Casablanca Bourse APIcasablanca-bourse.com ↗
Access real-time share prices, market cap, bid/ask spreads, and sector data for all companies listed on the Casablanca Stock Exchange via one API endpoint.
What is the Casablanca Bourse API?
The Casablanca Bourse API provides live market data for every equity listed on the Casablanca Stock Exchange through a single get_share_prices endpoint that returns 12+ fields per company — including reference price, opening price, closing price, high/low range, change percentage, volume, quantity traded, market capitalization, and bid/ask data — with optional filtering by sector or company name.
curl -X GET 'https://api.parse.bot/scraper/79ba1cf9-d616-40e4-afde-7082f8c53d55/get_share_prices?sector=Banques&company=ATTIJARIWAFA' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace casablanca-bourse-com-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Casablanca Bourse SDK — list and filter share prices for listed companies."""
from parse_apis.Casablanca_Stock_Exchange__Bourse__Share_Prices_API import (
CasablancaBourse,
Company,
MarketDataUnavailable,
)
client = CasablancaBourse()
# List all companies, capped to 5 for quick inspection.
for stock in client.companies.list(limit=5):
print(stock.company, stock.ticker, stock.closing_price, stock.change_percent)
# Filter by sector — only banking stocks.
banks = client.companies.list(sector="Banques", limit=3)
bank = banks.first()
if bank:
print(bank.company, bank.sector, bank.market_cap, bank.volume)
# Filter by company name (partial match).
try:
result = client.companies.list(company="ATTIJARIWAFA", limit=1).first()
if result:
print(result.ticker, result.reference_price, result.best_bid, result.best_ask)
except MarketDataUnavailable as exc:
print(f"Market data unavailable: {exc}")
print("exercised: companies.list / sector filter / company filter / typed error catch")
Retrieve current share prices for companies listed on the Casablanca Bourse. Returns reference price, opening price, closing price, high/low prices, change percentage, volume, quantity traded, market capitalization, and bid/ask data for each company, grouped by sector. Supports optional filtering by sector name or company name (partial match, case-insensitive). Without filters, returns all listed companies across all sectors. The data refreshes intraday during trading sessions. Sector names are in French (e.g. Banques, Assurances, Mines).
| Param | Type | Description |
|---|---|---|
| sector | string | Filter by sector name in French (partial match, case-insensitive). Omitting returns all sectors. |
| company | string | Filter by company name (partial match, case-insensitive). Omitting returns all companies. |
{
"type": "object",
"fields": {
"companies": "array of company objects with share price data including company, ticker, sector, status, reference_price, opening_price, closing_price, high_price, low_price, change_percent, volume, quantity_traded, market_cap, best_bid, best_ask, total_trades, instrument_url",
"total_companies": "integer - number of companies returned after filtering"
},
"sample": {
"data": {
"companies": [
{
"sector": "Banks",
"status": "T",
"ticker": "ATW",
"volume": 18178417.6,
"company": "ATTIJARIWAFA BANK",
"best_ask": 680,
"best_bid": 677,
"low_price": 676.1,
"high_price": 685,
"market_cap": 145757918422.5,
"total_trades": 109,
"closing_price": 677.5,
"opening_price": 685,
"change_percent": -0.37,
"instrument_url": "https://www.casablanca-bourse.com/en/live-market/instruments/ATW",
"quantity_traded": 26759,
"reference_price": 680
}
],
"total_companies": 1
},
"status": "success"
}
}About the Casablanca Bourse API
What the API Returns
The get_share_prices endpoint returns an array of company objects covering all equities listed on the Casablanca Stock Exchange (Bourse de Casablanca). Each object includes ticker, company, sector, status, reference_price, opening_price, closing_price, high and low prices, change percentage, volume, quantity traded, market_capitalization, and bid/ask fields. The response also includes a total_companies integer reflecting how many records match your query.
Filtering Options
Two optional query parameters let you narrow results without post-processing. The sector parameter accepts a partial, case-insensitive string and returns only companies in matching sectors — useful when you care about, say, banking or real estate equities specifically. The company parameter works the same way for company names. Omitting both parameters returns the full list of listed companies grouped by sector.
Data Coverage and Freshness
Data covers all equities traded in the Marché Actions grouping on the Casablanca Bourse, organized by their official sector classification. The status field indicates each instrument's current trading state, and the bid/ask fields give you the best current quotes on each side of the order book. Market capitalization is included per company, making it straightforward to size positions or rank constituents within a sector.
The Casablanca Bourse API is a managed, monitored endpoint for casablanca-bourse.com — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when casablanca-bourse.com changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official casablanca-bourse.com API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Track intraday price movements for Moroccan equities using
opening_pricevsclosing_pricecomparisons. - Build a sector-level dashboard by filtering
get_share_priceswith thesectorparameter and aggregating market cap. - Screen for high-volume trading sessions using the
volumeand quantity traded fields. - Monitor bid/ask spread widening as a liquidity signal across Casablanca-listed stocks.
- Calculate sector-weighted indices using
market_capitalizationdata returned per company. - Alert on significant price moves by comparing
reference_priceagainst current prices and watchingchange_percentagethresholds. - Populate a watchlist for specific Moroccan companies using the
companyfilter parameter.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does the Casablanca Bourse have an official developer API?+
What does the `get_share_prices` endpoint return for each company?+
total_companies count reflecting the filtered result set.Does the API cover historical price data or only current market data?+
Is data available for all Casablanca Stock Exchange market segments, including bonds and ETFs?+
How precise is the sector filtering, and what happens if no companies match?+
sector parameter does a partial, case-insensitive match against official sector classifications used by the Casablanca Bourse. If no companies match the supplied string, the response returns an empty companies array with total_companies set to 0. Omitting the parameter returns all sectors.