-
Notifications
You must be signed in to change notification settings - Fork 0
/
strategy.txt
75 lines (55 loc) · 2.78 KB
/
strategy.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
this is my OOP design
0. main file that instantiates 1 - 5
1. CONTROLLER
TAKES from FILE READER and doles out instructions
SKIPS 3 (see below)
FEEDS into 4, which starts 3
FEEDS into 5, trigger report
2. file_reader object (COMPLETE)
FEEDS into 1
3. asset class object (3 instances)
TAKES from 1, which applies SIP?
FEEDS
4. cash injections (SIP)
feeds into asset classes
5. account_balance/balance sheet
composed of asset class objects
maintains a ledger that shows what a the account values were at the end of any given month
can return the most recent month or respond to a GET for the
asset class ordering, who needs
Your program should take as input:
1. The money allocated in equity, debt and gold funds.
2. Monthly SIP payments.
3. Monthly change rate (loss or growth) for each type of fund.
The output should be
1. Balanced amount of each fund for a certain month.
2. Rebalanced amount of each month if applicable.
Input Commands
There are 5 input commands defined to separate out the actions. Your input format will start with either of these commands i.e ALLOCATE, SIP, CHANGE, BALANCE, REBALANCE
ALLOCATE
The ALLOCATE command receives the initial investment amounts for each fund.
Format - ALLOCATE AMOUNT_EQUITY AMOUNT_DEBT AMOUNT_GOLD
Example- ALLOCATE 6000 3000 1000 means that an amount of 6000, 3000 and 1000 is initially invested in equity, debt and gold fund respectively.
SIP
The SIP command receives the investment amount on a monthly basis for each fund.
Format - SIP AMOUNT_EQUITY AMOUNT_DEBT AMOUNT_GOLD
Example - SIP 2000 1000 500 means a monthly payment of 2000, 1000 and 500 is done against each of equity, debt and gold funds respectivelty.
CHANGE
The CHANGE command receives the monthly rate of change (growth or loss) for each fund type. A negative value represents a loss.
Format - CHANGE AMOUNT_EQUITY AMOUNT_DEBT AMOUNT_GOLD MONTH Example - CHANGE 8.00% -3.00% 7.00% APRIL means in the month of April equity received a growth of 8%, debt has taken a loss by 3% and gold received a growth of 7%.
BALANCE
The BALANCE command receives a month name.
Format - BALANCE MONTH
Example - BALANCE APRIL means - print the balance for each fund as on April month.
REBALANCE
The REBALANCE command receives no additional inputs.
Input Format - REBALANCE
Example - REBALANCE - Rebalance happens compulsorily after 6 months in June and December.
The REBALANCE command shows the last rebalanced amount for each fund at the time of
rebalancing. If 6 months data is not available then print CANNOT_REBALANCE.
Output format - EQUITY DEBT GOLD
Example - 10593 7898 2273
Assumptions
1. Balances are always floored to the nearest integers.
2. The rebalancing happens on 6th (June) and 12th (December) month.
3. The allocation always happens from January, and SIP from February.