Developing a Mobile Crypto Exchange App
A mobile crypto exchange isn't just a wallet with swap functionality. It's a full-featured trading platform: real-time order book, candlestick charts, order management, trade history, embedded wallet with deposits and withdrawals. Each component demands separate architectural solutions.
Architecture: WebSocket as the Foundation for Real-Time
An exchange lives off real-time data. REST API for static data (history, balances, open orders). WebSocket for streams: ticker, order book, trades, account updates.
Binary protocols (MessagePack, FlatBuffers) instead of JSON for market data are critical at high update frequencies. An active trading pair's order book updates 10–50 times per second.
// Android — WebSocket connection to exchange data streams
class ExchangeWebSocketClient(private val scope: CoroutineScope) {
private val _orderBook = MutableStateFlow<OrderBookSnapshot?>(null)
val orderBook = _orderBook.asStateFlow()
fun subscribeOrderBook(symbol: String) {
val request = """{"method":"SUBSCRIBE","params":["${symbol.lowercase()}@depth20@100ms"],"id":1}"""
webSocket.send(request)
}
private fun handleMessage(text: String) {
val update = json.decodeFromString<OrderBookUpdate>(text)
_orderBook.update { current -> current?.applyDelta(update) ?: OrderBookSnapshot.from(update) }
}
}
On iOS, use URLSessionWebSocketTask (iOS 13+) or Starscream. Stream data via AsyncStream and @Published for SwiftUI, or PassthroughSubject for UIKit.
Order Book: Rendering Without Stuttering
The order book updates frequently. Rendering through UITableView / RecyclerView on every update causes visual artifacts and FPS drops. Solutions:
UITableView (iOS): Use performBatchUpdates only for visible changes. Apply delta updates (insertions/deletions/updates) instead of reloadData. Cells should implement prepareForReuse.
RecyclerView (Android): Use DiffUtil.calculateDiff in a background thread, ListAdapter with AsyncListDiffer. Disable setHasFixedSize(false) if cell heights are fixed.
For high-frequency updates (> 10/sec), render the order book directly on Canvas/SurfaceView (Android) or CALayer (iOS), bypassing RecyclerView/UITableView entirely. This reduces main thread load by 3–5x.
Candlestick Charts
For TradingView-style charts on mobile, three options:
- TradingView Lightweight Charts in WKWebView/WebView. Simplest, but adds overhead.
- MPAndroidChart (Android) / Charts (Daniel Gindi) (iOS) — native libraries. Less functionality, better performance.
- Custom implementation on Canvas/Metal/SpriteKit — full control, but 2–4 weeks just for the chart.
For most projects, Lightweight Charts in WebView with a bidirectional bridge (JavaScript ↔ Native) for data and events.
Orders: Types and Logic
Minimum order types:
| Type | Description | Implementation Complexity |
|---|---|---|
| Market | Immediate execution at market price | Low |
| Limit | Execution when price is reached | Medium |
| Stop-Limit | Activates at stop price, executes as limit | High |
| OCO | One-Cancels-Other: limit + stop-limit together | High |
Order form UI: Buy/Sell toggle, Price/Amount/Total fields with cross-calculation, balance percentage slider (25% / 50% / 75% / 100%), confirmation button with total.
Wallet: Deposits, Withdrawals, History
The exchange's embedded wallet is custodial. Addresses are generated by the exchange. Users see asset list with balances, deposit/withdrawal history with txHash and status.
Withdrawals: form with address, amount, network. Two-step confirmation — email/2FA code is mandatory. Google Authenticator (TOTP via RFC 6238) or Email OTP.
Security and 2FA
2FA via OTPAuth URI format. On iOS — OTPKit, on Android — andOTP-compatible TOTP. Biometrics (Face ID / Fingerprint) for login, but not instead of 2FA on withdrawal.
Push notifications for login from new device (IP, user agent), suspicious withdrawals, order completion — mandatory. Firebase Cloud Messaging covers both platforms.
Timeline and Scope
| Component | Timeline |
|---|---|
| Authorization + 2FA + biometrics | 1 week |
| Order book + depth + ticker (WebSocket) | 1.5 weeks |
| Candlestick charts | 1–2 weeks |
| Order form (market + limit) | 1 week |
| Wallet: deposit, withdrawal, history | 1.5 weeks |
| Trade history and open orders | 1 week |
| Push notifications + security | 1 week |
MVP: 8–10 weeks for one platform (iOS or Android). Both platforms in parallel with shared backend — 10–14 weeks. Full-featured exchange with advanced orders, margin, P2P — 3+ months.







