Homepage of
Jan Karman
Middelburg (Neth)

Design & Copyright
Jan Karman
Last revised: February 2021

Web Analytics
Migration and migrants

International migration is a major factor of demographic and social change and for an increasing number of countries, international migration has become the most important factor of population growth. As a result European populations are becoming more diverse than ever before. Our research focuses both on migration flows in a macro perspective to better understand European migration patterns, as well as on migrant behavior at the micro level. Emphasis is put on the demographic and socio-economic position of migrants and the demographic dynamics in migrant families, applying the life course approach to complete the wealth of studies on the structural and cultural position of migrants. See more


Otium cum dignitate

"Reshuffling chaos"

Profit & Loss in Stocks
(from: samples | K | Show | Stocks)
Free Download (284Kb)

Determining Profit & Loss in a stock portfolio in a certain period of time is trivial when taking the algebra´c sum of the value of all stocks at the beginning of that period (balance), the value of the purchases and the value of the sales during that period.
However, if one is interested in which part is coming from or going into reservations for exchange rate differences, or which part may be considered as realized and which part is not, life is not that easy.
In that case the purchase value of the sold package is needed.
Two special cases need to be focused on:

  - the results of an entire portfolio during the financial year
  - the profit & loss on a particular stock in a FIFO-system.

In both cases a recursive function is needed, while case 2 involves the technique of splitting and assembling purchase packages of a particular stock, in order to assign the proper gains or losses on any sale transaction. This requires a second recursive funtion.
APL-like languages are extremely well suited for this purpose.
Please, have a look in the samples about how it is achieved.

Jan Karman
Middelburg (Neth), September 2006

More actuarial & financial applications:
 Actuarial Factors
 Annuity Loan
 Graduation of Mortality
 Profit & Loss in Stocks
 The Price of Bonds
 Afronding van sterftetafels
 Ausgleichung von Sterbetafeln
My Music
 Recent Compositions
 My Harpsichord
Grand Fugue


      Art Gallery Orsmaal
      De Vleeshal Middelburg