smalltalk-finance-model

Description

JP Morgan Interview Excercise

Details

Source
GitHub
Created
March 15, 2026
Updated
March 24, 2026

README excerpt

# Smalltalk Technical Exercise

Implementation of a Smalltalk technical modelling exercise.

## Repository Contents

This repository contains the exported Smalltalk source **Heyroth.st**.

## Packages

- **HeyrothModels** – core domain model
- **HeyrothExamples** – example objects and namespace population
- **HeyrothSUnitTestModels** – helper objects used by tests
- **HeyrothSUnitTests** – SUnit test cases

## Environment

The implementation was developed using **Cincom VisualWorks 9.3.1 PUL**.

Code is exported in **chunk format** from the image.

## Structure

The implementation follows the model described in the exercise:

- `Frame` – base class for domain objects
- `Namespace` – container for Frames
- `Party`, `Book`, `Portfolio`, `Trade`, `Market`, `Product`
- `CashflowProduct` – concrete financial product

Relationships implemented:

- Books owned by Parties
- Books contain a Portfolio
- Portfolios contain Trades and child Portfolios
- Trades contain Products

## Valuation

Present value calculation is implemented polymorphically:

- `CashflowProduct` computes discounted cashflow
- `Trade` sums product PV
- `Portfolio` recursively sums trades
- `Book` delegates to its portfolio

## Example Data

Example objects are created in:

- `NamespaceExamples`
- `PartyExamples`
- `BookExamples`
- `PortfolioExamples`
- `MarketExamples`

These classes build an example namespace containing parties, books, portfolios and markets.

## Tests

SUnit tests are provided for all domain classes.

## Export

Code is provided as exported Smalltalk source (`.st`) in chunk format.
← Back to results