Skip to content

Alpaca parity

Boursa's API is designed to be familiar to anyone who has integrated Alpaca. We adopt Alpaca's shapes and vocabulary wherever they fit, and document every place EGX market structure or our broker-of-record model requires a difference.

What we adopt

  • Orders: order types (market, limit), time-in-force (day, gtc, ioc, fok), an Alpaca-faithful order object with status, client_order_id, time_in_force, order_class, asset_class, and the submitted_at/filled_at/canceled_at/expired_at timestamps.
  • Order status vocabulary: pending_new, accepted, new, partially_filled, filled, pending_cancel, canceled, expired, rejected — with status=open|closed list filtering.
  • Clock & calendar: GET /v1/clock and GET /v1/calendar mirror Alpaca's {timestamp,is_open,next_open,next_close} and [{date,open,close,session_open,session_close,settlement_date}].
  • Idempotency: client_order_id (plus an Idempotency-Key header).

Intentional divergences

AreaAlpacaBoursaWhy
Moneydecimal strings ("82.21")integer micros (82210000)no float drift
Quantityfractional / notionalwhole shares onlyEGX market structure
Authkey-id + secret headersBearer + HMAC-signed money endpointsbroker-of-record posture
Errorsnumeric codesstring codes + request_idlocalizable, log-friendly
Sessionsextended hours, open/close auctionssingle continuous sessionEGX structure
Modelone self-trading accounttenant → broker → investorBoursa is infrastructure beneath many brokers

Mapping table

AlpacaBoursa
GET /v2/accountGET /v1/investors/{id} + /balances
GET /v2/positionsGET /v1/investors/{id}/portfolio
GET /v2/ordersGET /v1/orders
POST /v2/ordersPOST /v1/orders
DELETE /v2/orders/{id}DELETE /v1/orders/{id}
GET /v2/account/activitiesGET /v1/investors/{id}/activities
GET /v2/account/portfolio/historyGET /v1/investors/{id}/portfolio/performance
GET /v2/assetsGET /v1/instruments
GET /v2/clockGET /v1/clock
GET /v2/calendarGET /v1/calendar
GET /v2/stocks/barsGET /v1/markets/{m}/instruments/{s}/ohlcv

Roadmap

Stop / stop-limit / trailing-stop types, PATCH replace with replaces/replaced_by, cancel-all (207), cursor pagination (page_token/next_page_token), Alpaca-shaped account/position views, and a corporate-actions read API.

Embedded investing infrastructure for the Egyptian Exchange. Sandbox runs on simulated money.