← Back to Case Studies

January 2026

PSX Folio A Stock Market Research App

Project Information

Executive Summary

PSX Folio is a comprehensive mobile application built with React Native that serves as both a portfolio manager and complete research tool for investors in the Pakistan Stock Exchange. Unlike basic tracking applications, PSX Folio combines real-time portfolio management with deep research capabilities, delivering market data updates at sub-second speeds while maintaining extensive notification coverage without any degradation in performance.

The application handles thousands of concurrent market data streams, processes complex portfolio calculations including FIFO-based cost basis and capital gains tax computations, and delivers push notifications for price alerts, corporate announcements, and portfolio milestones. Despite this heavy data and notification load, the app maintains a consistent 60 frames per second scrolling experience and sub-two-second initial load times on mid-range devices.

The Challenge

Beyond Simple Portfolio Tracking

Most PSX tracking applications offer basic watchlist functionality with delayed price updates. Investors seeking comprehensive research tools typically must switch between multiple applications or desktop platforms. PSX Folio was conceived to bridge this gap: a single mobile application combining institutional-grade portfolio management with real-time research capabilities.

The technical requirements presented significant challenges. The application needed to consume and display real-time market data for over 500 listed companies simultaneously. Portfolio calculations including profit and loss, FIFO cost basis, and capital gains tax required computational accuracy matching brokerage standards. A notification system needed to alert users about price movements, index changes, corporate announcements, and portfolio events without becoming intrusive or degrading device performance. All of this needed to run smoothly on mid-range Android and iOS devices common in the Pakistani market.

Critical Performance Targets

MetricTargetIndustry Standard
Market Data Update LatencyUnder 500ms2-5 seconds typical
Scroll Performance60 FPS consistentOften drops to 30-40 FPS
Initial App LoadUnder 2 seconds3-5 seconds common
Notification DeliveryUnder 1 secondVaries widely
Memory UsageUnder 150MBOften exceeds 200MB
Battery ImpactUnder 5% per hour8-12% typical

The Approach

Real-Time Market Data Architecture

I designed a multi-layered data synchronization system that balances freshness with efficiency. Rather than polling every stock individually, the application establishes a single WebSocket connection that streams price updates for all subscribed symbols. When users navigate to detailed views, additional granular data streams activate. When they return to portfolio overviews, those streams pause automatically.

Market data flows through a normalized caching layer that prevents redundant UI updates. If a stock price fluctuates by less than 0.1%, the UI component does not re-render. This optimization alone reduced unnecessary renders by approximately 40% during active trading hours when thousands of micro-fluctuations occur. All price data caches locally using MMKV for instant display when users reopen the application, with background synchronization updating stale entries.

High-Performance Notification System

The notification infrastructure processes multiple event types without overwhelming the device or the user. Price alerts trigger when user-defined thresholds are crossed. Corporate announcement notifications deliver summaries of material disclosures. Portfolio alerts inform users about dividend declarations, rights issues, and significant profit and loss milestones.

I implemented a batching mechanism that groups similar notifications occurring within short time windows. Instead of sending five separate alerts when multiple stocks hit circuit breakers during volatile sessions, the system delivers a single consolidated notification summarizing the affected positions. Background message processing ensures that notification handling never blocks the JavaScript thread, preventing UI stutter when alerts arrive during active app usage.

Optimized Portfolio Calculation Engine

Portfolio calculations execute efficiently despite their complexity. FIFO cost basis computation processes transaction history to accurately determine capital gains based on holding periods. Capital gains tax calculations apply Pakistan-specific rules including holding period distinctions and tax year considerations. Dividend tracking accounts for bonus shares, stock splits, and reinvestment scenarios.

I offloaded heavy calculation logic to native modules, bypassing JavaScript bridge overhead for performance-critical operations. When a user imports years of transaction history, the calculation engine processes thousands of trades in under two seconds by leveraging platform-optimized native code. Results persist to local storage, enabling instant portfolio snapshot display on subsequent app launches.

Research Tools and Data Visualization

The research capabilities extend far beyond simple price charts. Interactive candlestick charts with multiple timeframes from one day to five years support technical analysis with indicators including RSI, MACD, moving averages, and volume profiles. Fundamental data screens display earnings per share, price-to-earnings ratios, dividend yields, book values, and profitability metrics. Company profiles aggregate announcements, board meeting schedules, and corporate actions.

I implemented list virtualization for every scrollable component displaying market data. FlatList configurations with optimized window sizes, maximum render per batch limits, and memoized row renderers ensure that scrolling through hundreds of stocks remains perfectly smooth. Charts render using native drawing primitives rather than JavaScript-based SVG libraries, eliminating animation jank during timeframe switching.

Offline-First Design Philosophy

PSX Folio functions as a reliable reference tool even without network connectivity. All previously viewed data remains accessible offline, including portfolio holdings, transaction history, and cached market data from the last active session. When connectivity restores, synchronization occurs silently in the background without interrupting user workflows.

The local database employs a normalized schema that minimizes storage requirements while maintaining query efficiency. Portfolio snapshots, watchlist configurations, and user preferences synchronize across devices when users opt into cloud backup functionality.

Key Metrics

Performance Outcomes

MetricResultImprovement Over Baseline
Market Data Update Latency300-400ms75% faster than typical PSX apps
Scroll Performance60 FPS sustainedZero frame drops during scrolling
Initial App Load1.8 seconds40% faster than comparable apps
Memory Usage (Active)120MB35% lower than industry average
Battery Drain (Active)4.2% per hour50% reduction vs unoptimized apps
Transaction Processing (1,000+ trades)Under 2 secondsNear-instantaneous

Notification Efficiency

MetricResult
Notification Delivery TimeUnder 800ms
Batched Alert Reduction65% fewer individual notifications
Background Processing ImpactNegligible CPU usage
User Opt-in Retention85% after 30 days

Technical Implementation Highlights

React Native Optimization Techniques

The application employs multiple performance optimization strategies working in concert. Console log statements are stripped from production builds, eliminating synchronous JavaScript thread blocking that typically degrades scrolling performance. All image assets including company logos and chart thumbnails load through FastImage with aggressive caching policies and appropriate sizing parameters.

Anonymous functions are replaced with memoized callbacks using useCallback and useMemo hooks, preventing unnecessary re-renders of list items and chart components. Redux selectors subscribe only to specific state slices rather than entire state trees, using shallow equality checks to avoid re-renders when unrelated data changes.

Heavy screens implement InteractionManager to defer non-critical operations until after navigation animations complete. When users open detailed stock views, the chart rendering and financial data parsing wait until the transition finishes, ensuring buttery-smooth navigation.

Native Module Integration

Performance-critical calculations execute through native modules written in Java for Android and Swift for iOS. The portfolio calculation engine, FIFO cost basis processor, and tax computation logic run outside the JavaScript thread, eliminating UI freezes during intensive operations. When users import CSV transaction files or generate PDF portfolio reports, the heavy lifting occurs natively while the UI remains responsive.

Memory and Battery Management

Aggressive cache pruning removes stale market data after 24 hours. Image caches respect device storage constraints, automatically evicting least recently used assets when approaching limits. Background synchronization pauses automatically when battery levels drop below 20%, preserving device longevity during critical moments.

Technologies Employed

Frontend Framework

  • React Native CLI with Hermes engine enabled
  • React Navigation for native stack navigation
  • Redux Toolkit with memoized selectors
  • MMKV for high-performance local storage

Data and Real-Time Features

  • WebSocket connections for market data streaming
  • TanStack Query for server state management
  • FastImage for optimized image loading
  • Notifee for advanced notification handling

Native Integration

  • Custom native modules for portfolio calculations
  • Native chart rendering components
  • Platform-specific file system access for import and export

Performance Infrastructure

  • Flipper for debugging and performance profiling
  • React DevTools for component re-render analysis
  • Xcode Instruments and Android Profiler for memory tracking

Lasting Impact

PSX Folio demonstrates that React Native applications can deliver institutional-grade financial tools without compromising mobile performance. The architectural decisions supporting real-time data streaming, complex portfolio calculations, and comprehensive notification handling scale gracefully as user portfolios grow and market data volume increases.

The application serves as a reference implementation for high-performance React Native development in the Pakistani fintech ecosystem. Techniques developed for market data optimization, notification batching, and offline-first architecture have informed subsequent projects requiring similar real-time capabilities.

By combining deep research functionality with responsive portfolio management in a single mobile experience, PSX Folio eliminates the friction investors previously faced when switching between multiple tools. The performance optimizations ensure that professional-grade features remain accessible on devices common throughout the Pakistani market.

Open Project Link