Back to Portfolio
Independent Project•Kotlin Multiplatform (KMP)

The Finance Bull

Project Overview

The Finance Bull is a real-time option and stock market analytics engine built for high-throughput, low-latency data rendering. The core multiplatform engine manages state orchestration, delta calculations, and data parsing pipelines natively across desktop and mobile wrappers. The server infrastructure is built with Ktor, utilizing concurrent coroutines and reactive WebSockets to stream sub-millisecond stock and options feeds, mapping delta-compressed market quotes. Data persistency and migrations are safely structured through PostgreSQL database instances and Flyway migration toolkits.

Technologies Used

#Kotlin Multiplatform#Ktor WebSockets#PostgreSQL#Coroutines#Flyway Migration#Serialization
Architecture

⚙️ Kotlin Multiplatform Architecture

Kotlin shared calculators, server socket endpoints, and presentation view models files displayed inside IDE code editors. Click any screen card to open in fullscreen preview.

shared model
shared model

shared model

Shared mathematical calculators and KMP options data models compiled across multiplatform targets.

server engine
server engine

server engine

Ktor server WebSocket pipelines managing concurrent client sessions and streaming options data feeds.

client views
client views

client views

Presentation and layout view models displaying options analytics metrics and delta graphs.

Engineering Architecture

⚙️ Case Study Breakdown

A granular review of the technical challenges, architecture specifications, and tradeoffs made during implementation.

1. Project Overview

The Finance Bull is a real-time options analytics platform. It compiles live options metrics, market indices, and delta/gamma risk factors using a shared Kotlin Multiplatform math compiler.

2. The Problem

Processing thousands of live ticker prices via WebSockets and recalculating Black-Scholes volatility curves can freeze user interfaces if calculations are run on the UI main thread or done separately across Android and iOS with different math accuracy outputs.

3. My Role

I architected the shared calculation engine inside the KMP common module, designed the WebSockets frame parser, and developed the Ktor backend microservices backed by Flyway migrations.

4. Technical Challenges

Encoding/decoding high-frequency socket payloads efficiently on limited mobile device processors while preserving identical mathematical precision between JVM and Native compiler configurations.

5. System Architecture

Used Clean Architecture with unidirectional repository bindings. The KMP core processes real-time socket updates and pushes thread-safe state flows directly to native views.

6. Kotlin Multiplatform Usage

The entire options pricing math framework, socket connection logic (Ktor WebSockets), model parsing, and local memory caches are shared in the KMP module.

7. Shared Code Details

Calculators for implied volatility, Greeks, bid-ask spreads, and options chain matrices reside in a single shared Kotlin compiler package.

8. Platform-Specific APIs

Implemented platform thread dispatchers via KMP dependency injection, offloading Black-Scholes computations to background threads on both JVM (Android) and iOS DispatchQueues.

9. Key Decisions

Opted for binary socket frames (Protobuf serialization) instead of JSON string payloads to reduce network overhead and increase socket parsing speeds.

10. Tradeoffs & Challenges

Using KMP for financial math models worked perfectly, but required writing custom mathematical float assertions for iOS (Kotlin/Native) to align with Android JVM's strict double arithmetic.

11. Execution Results

Achieved 100% calculation consistency between Android and iOS. Lowered network data overhead by 40% using Protobuf streams, and kept frame rates smooth at 120Hz.

12. Key Lessons Learned

Processing intense continuous mathematical formulas requires using local cache recycling structures inside KMP to prevent garbage collection sweeps from choking UI layouts.