
💹 Fintech & Capital Markets · State Machine
The states of a stock market order in a broking app, from placement through exchange matching to partial and full fills.
Drawing diagram…
State machine for a broker order: Created, RiskChecked (margin and limits), Rejected if checks fail, SentToExchange, Open on the order book, PartiallyFilled, Filled, Cancelled by the user, Expired at the end of the day for day orders.
stateDiagram-v2 [*] --> Created Created --> RiskChecked: Margin and limits OK Created --> Rejected: Insufficient margin RiskChecked --> SentToExchange SentToExchange --> Open: Accepted by exchange SentToExchange --> Rejected: Exchange rejects Open --> PartiallyFilled: Some quantity traded Open --> Filled: Full quantity traded PartiallyFilled --> Filled: Rest traded Open --> Cancelled: User cancels PartiallyFilled --> Cancelled: User cancels rest Open --> Expired: Market close PartiallyFilled --> Expired: Market close Filled --> [*] Cancelled --> [*] Expired --> [*] Rejected --> [*]
A digital lending app that takes a loan application from KYC to disbursal in minutes, using credit bureau data, bank statement analysis and e-mandates for repayment.
How a lender gets a customer's bank statements through India's Account Aggregator network: consent request, approval in the AA app, and encrypted data sharing.
How a Buy Now Pay Later option decides at checkout whether to approve a shopper and splits the purchase into instalments.
Where a stock broking platform runs: low-latency order systems co-located near the exchange, and customer apps and back office in the cloud.
Tables for a loan book: borrowers, loan products, loans, repayment schedules, payments and collection actions.
How a monthly SIP in a mutual fund works behind an investment app: mandate debit, order to the exchange platform, NAV allotment and units credited.