RiskMan is a simple open source project in the finance industry developed in TDD in Java with 2 purposes in mind:
1. solve a real life problem of a customer
2. produce something didactic and useful as base for preparing exciting code katas.
Please, feel free to comment and use!
http://github.com/pino1068/riskman
10. What ? in 4 weeks job!
portfolio selection with no sql
11. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
12. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
check against portfolio: “from 5% to 13%”
13. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
check against portfolio: “from 5% to 13%”
no db - no web - just shell & files
14. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
check against portfolio: “from 5% to 13%”
no db - no web - just shell & files
bottom up approach
15. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
check against portfolio: “from 5% to 13%”
no db - no web - just shell & files
bottom up approach
∼ no dependencies
16. What ? in 4 weeks job!
portfolio selection with no sql
“equity:CHF + bond:USA:Aaa”
check against portfolio: “from 5% to 13%”
no db - no web - just shell & files
bottom up approach
∼ no dependencies
minimalism & pragmatism
19. How ?
TDD: no test => no code
DDD: no tech name
20. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
21. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
Method: < 7 LoC
22. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
Method: < 7 LoC
Method: one for - one if (or no if at all)
23. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
Method: < 7 LoC
Method: one for - one if (or no if at all)
Class < 3 attrs
24. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
Method: < 7 LoC
Method: one for - one if (or no if at all)
Class < 3 attrs
Method: no base parameter (one only)
25. How ?
TDD: no test => no code
DDD: no tech name
OCP & SoC ...
Method: < 7 LoC
Method: one for - one if (or no if at all)
Class < 3 attrs
Method: no base parameter (one only)
26. simplicity
CHF100 = Money.CHF(100);
USD100 = Money.USD(100);
final Money sum = Money.CHF(210);
assertEquals(sum, CHF100.plus(USD100));
first
27. domain driven
final MoodyRating A2 = MoodyRatings.find("A2");
final Area UE = Area.from("UE");
positions = new Positions() {
{
add(account("salary", CHF(10)));
add(UBS(CHF(100)));
add(bond(Bond.from("GECC", A2, UE), CHF(100), "100%"));
}
};
constraint = contraint("UE,USA", "min 20%");
assertTrue(constraint.checkLimitOn(positions));
design
29. > help
Menu: --------------------
'p' or 'positions'
- print all positions
'h' or 'help'
- print this help
'r or remove'
- remove last filter
'check on <group>'
- split and check according to criteria and print results, i.e. check on owner max 5%
'group by <criteria>'
- print the positions grouped by given criteria
'load <file>'
- load positions from given file
'show <data>'
- print the values, where <data> can be one of: areas, owners, equities, bonds, moody
'q' or 'quit'
- to exit this program
'filter by <criteria>'
- change context on positions filtered by given criteria
--------------------------
30. > load “all-positions.csv”
[...]
aaa13: Equity: SPY - 25'135 with price:113.66 USD = 2'856'844.1 USD
aaa13: Equity: HSBC GIF Indian Equity AD - 2'350 with price:183.074 USD = 430'223.9 USD
aaa13: Account: CHF-0172-EUR75-CHF 2'100'287.357 CHF
aaa14: Account: EUR-0172-EUR75-EUR 3'816'729.798 EUR
aaa14: Account: USD-0172-EUR75-USD 581'430.622 USD
aaa14: Account: CHF-548713.2120.001.01 -0 CHF
aaa14: Account: EUR-548713.2120.814.01 -0.06 EUR
aaa14: Account: EUR-0456-0466553-52-001 0 EUR
aaa14: Equity: CB-Accent Global Equity Fund Cap B - 2'200 with price:78.29 CHF = 172'238 CHF
aaa14: Equity: KPN Koninklijke - 8'200 with price:11.97 EUR = 98'154 EUR
aaa14: Equity: Siemens N eur - 200 with price:66.3 EUR = 13'260 EUR
aaa14: Account: CHF-0456-0642763-11-000 1'749.957 CHF
aaa14: Account: EUR-0456-0642763-12-000 1'871.49 EUR
1'850 positions loaded!
Total Value is:
467'770'275.36 USD
> cool!
32. > check on currency max 5%
JPY KO, check <max:5%> but is 21.733% (50'829'486.39 USD over 233'885'137.68 USD)
CHF KO, check <max:5%> but is 26.978% (63'097'704.953 CHF over 233'885'137.68 USD)
EUR KO, check <max:5%> but is 40.631% (95'030'812.698 USD over 233'885'137.68 USD)
USD KO, check <max:5%> but is 14.159% (33'115'022.738 CHF over 233'885'137.68 USD)
AUD OK
GBP OK
> what about if Japan (with its Dept at 200% of GDP) gets on default?
35. Future ?
don’t stop here
goal: katas also on real life projects
36. Future ?
don’t stop here
goal: katas also on real life projects
goal: training - no profit (siagile)
37. Future ?
don’t stop here
goal: katas also on real life projects
goal: training - no profit (siagile)
goal: conferences, workshops
38. Future ?
don’t stop here
goal: katas also on real life projects
goal: training - no profit (siagile)
goal: conferences, workshops
vertical open source (finance industry)
39. Future ?
don’t stop here
goal: katas also on real life projects
goal: training - no profit (siagile)
goal: conferences, workshops
vertical open source (finance industry)
mentor wanted!
40. Future ?
don’t stop here
goal: katas also on real life projects
goal: training - no profit (siagile)
goal: conferences, workshops
vertical open source (finance industry)
mentor wanted!
new developers are welcome
41. RiskMan
Thanks!
see: http://www.github.com/pino1068/riskman
Smart Risk Management
Open Source Agile Project
by SIAgile - Svizzera Italiana Agile
presented by: giuseppe.dipierri@gmail.com