Skip to content

Order lifecycle & time-in-force

An order moves through a lifecycle from submission to a terminal state. Boursa exposes both a granular internal state and an Alpaca-aligned status.

States and statuses

Internal stateAlpaca statusMeaning
receivedpending_newaccepted by Boursa, pre-validation
validatedacceptedreserved; accepted but not yet routed (e.g. placed while the market is closed → queued for next open)
transmittedpending_newrouted to the broker, awaiting acknowledgement
ackednewlive and working at the venue (a resting limit sits here)
partially_filledpartially_filledsome quantity filled, the rest still working
filledfilledterminal — fully executed
cancel_requestedpending_cancela cancel is in flight
cancelledcanceledterminal — canceled
expiredexpiredterminal — a day order reached session close
rejectedrejectedterminal — failed validation or broker rejection

status=open{pending_new, accepted, new, partially_filled, pending_cancel}; status=closed{filled, canceled, expired, rejected}. List with GET /v1/orders?status=open|closed.

Resting limit orders

A limit order away from the market does not execute early — it rests in the broker's book and fills the moment the live price crosses it, at the market price:

  • Buy limit fills when the market falls to (or below) your limit.
  • Sell limit fills when the market rises to (or above) your limit.

While resting, the order shows status: new.

Time-in-force and expiry

  • day — expires at session close. After the close it is expired and the reservation is released.
  • gtc — survives session close and rests across days. It is never self-expired; only you can cancel it.
  • ioc / fok — never rest. An unmarketable ioc/fok is canceled immediately (not rejected).

After-hours orders

An order placed while the market is closed is accepted, validated, and reserved — it shows status: accepted and transmits automatically at the next session open. (Funding and fund subscriptions behave differently — fund orders execute immediately at the current NAV.)

Partial fills

A partially-filled order stays partially_filled (still cancelable for the remainder) until the rest fills or the day order expires. In the sandbox, an order with qty: 13 deterministically fills in two parts to demonstrate this.

Cancel races

A fill is always truth. If you request a cancel and a fill lands first, the order fills — the cancel is a no-op. This is intentional and matches how real venues resolve the race.

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