[Cuis-dev] Quantitative finance in Cuis-Smalltalk

Ignacio Sniechowski 0800nacho at gmail.com
Sun Oct 1 06:03:03 PDT 2023

Hi Cuisers,
I hope you are well.
I'm taking a course on quantitative finances and as it is custom nowadays,
it is Python-centric. Of course, I understand that the libraries
matplotlib, pandas, numpy, etc., etc. are what do the work.
But I want to force myself into at least trying to do some of the work in

It is a pleasant challenge; I am confident in Smalltalk but inferior at OO

For instance, to find the Present Value, I wrote "procedural" code in a
Workspace and wanted to go beyond and do the right Smalltalk thing.

This is my attempt at calculating the present value of a series of cash
flows, given a discount rate:

|pv cashFlow discountFactors discountRate sum|
cashFlow := OrderedCollection new.
discountFactors := OrderedCollection new.
cashFlow add: 100; add: 200; add: 250.
discountRate := 0.05.
discountFactors := (Interval from: 0 to: (cashFlow size - 1))
                       [:a | 1 / (( 1 + discountRate) ^ a)].
pv := cashFlow with: discountFactors collect: [:a :b| a * b].
sum := 0.
pv collect: [:a | sum := sum + a].
Transcript show: sum.

Now I want to turn all these code into a Class:
1) Identifying the Objects
Candidates for objects are:
* The Present Value (PV)
* The Cash Flows (CF)
* The Discount Factors (DF)
* The Discount Rate (r)

The problem is I'm stuck here; I need help figuring out where to fish to
get a proper way to design OO coding.
What resources do you recommend? What path to follow?
Thanks, as always, in advance for all the great help this community

*Ignacio Sniechowski*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20231001/c6b1e2e5/attachment.htm>

More information about the Cuis-dev mailing list