-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoutput.txt
More file actions
232 lines (203 loc) · 6.54 KB
/
Copy pathoutput.txt
File metadata and controls
232 lines (203 loc) · 6.54 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
Agent Skills — Phase 2 Build Output
=====================================
WHAT WAS BUILT
--------------
4 agent skills, each with a SKILL.md and a scripts/ directory.
All scripts accept financial data as JSON via stdin, delegate all math
to app/calculators/, and print results as JSON to stdout.
No financial arithmetic happens in LLM reasoning text.
FILES CREATED
-------------
app/skills/__init__.py
app/skills/ratio-analysis/SKILL.md
app/skills/ratio-analysis/scripts/calculate_ratios.py
app/skills/cashflow-analysis/SKILL.md
app/skills/cashflow-analysis/scripts/calculate_cashflows.py
app/skills/valuation/SKILL.md
app/skills/valuation/scripts/calculate_valuation.py
app/skills/cost-of-capital/SKILL.md
app/skills/cost-of-capital/scripts/calculate_cost_of_capital.py
TEST SUITE
----------
49 passed, 0 failed (existing tests unaffected)
LIVE SCRIPT OUTPUTS — Cipla FY2025 Reference Data
===================================================
All monetary inputs in raw INR (as returned by YFinanceProvider).
Scripts convert to crore (÷ 10,000,000) internally.
=== 1. ratio-analysis/scripts/calculate_ratios.py ===
Input: Cipla FY2025 financial statements + current_price=1441, shares_outstanding=80.76 crore
Output:
{
"liquidity": {
"current_ratio": 3.38,
"quick_ratio": 1.26,
"cash_ratio": 0.39
},
"solvency": {
"debt_to_equity": 0.29,
"interest_coverage": 111.0,
"debt_to_assets": 0.21
},
"profitability": {
"gross_profit_margin": 0.58,
"ebit_margin": 0.25,
"ebitda_margin": 0.29,
"net_profit_margin": 0.19,
"return_on_equity": 0.25,
"return_on_assets": 0.19,
"roce": 0.26
},
"efficiency": {
"asset_turnover": 0.98,
"inventory_turnover": 2.11,
"receivables_turnover": 5.82,
"fixed_asset_turnover": 2.84,
"days_sales_outstanding": 62.71
},
"dupont": {
"net_profit_margin": 0.19,
"asset_turnover": 0.98,
"equity_multiplier": 1.34,
"roe": 0.25
},
"valuation": {
"eps": 65.51,
"pe_ratio": 22.0
}
}
=== 2. cashflow-analysis/scripts/calculate_cashflows.py ===
Input: Cipla FY2025 — net_income=5291.04 Cr, CFO=2789.07 Cr, CapEx=1162.16 Cr,
ΔCA=3847.11 Cr, ΔCL=238.19 Cr, net_borrowing=-55.89 Cr
Output:
{
"inputs": {
"net_income": 5291.04,
"non_cash_expenses": 1106.95,
"cfo": 2789.07,
"capex": 1162.16,
"ebit": 6882.81,
"interest_expense": 62.01,
"tax_rate": 0.224395,
"increase_in_current_assets": 3847.11,
"increase_in_current_liabilities": 238.19,
"net_borrowing": -55.89
},
"derived": {
"nopat": 5338.34,
"after_tax_interest": 48.1
},
"fcff": {
"method_1_net_income": 1675.01,
"method_2_nopat": 1674.21,
"method_3_cfo": 1675.01,
"validated_fcff": 1674.74
},
"fcfe": {
"method_1_net_income": 1571.02,
"method_2_fcff": 1570.75,
"method_3_ocf": 1571.02,
"validated_fcfe": 1570.93
},
"cross_validation": "passed"
}
Notes:
- All 3 FCFF methods agree within 0.80 crore (tolerance=2.0 crore default)
- All 3 FCFE methods agree within 0.27 crore
- Reference values: FCFF=1675.01, FCFE=1571.02 (difference due to rounded tax inputs)
- ΔCA and ΔCL require two years of balance sheet data — agent must fetch prior year
=== 3. cost-of-capital/scripts/calculate_cost_of_capital.py ===
Input: interest_expense=62.01 Cr, book_value_debt=512.94 Cr,
book_value_equity=20847.62 Cr, Rf=6.85%, beta=0.309, Rm=12%
Output:
{
"inputs": {
"interest_expense": 62.01,
"book_value_debt": 512.94,
"book_value_equity": 20847.62,
"tax_rate": 0.224395,
"pre_tax_kd": 0.120891,
"risk_free_rate": 0.0685,
"beta": 0.309,
"market_return": 0.12,
"weights_source": "current year only"
},
"capm_breakdown": {
"formula": "Ke = Rf + Beta x (Rm - Rf)",
"rf": 0.0685,
"beta": 0.309,
"rm": 0.12,
"equity_risk_premium": 0.0515,
"ke": 0.084414
},
"cost_of_debt": {
"pre_tax_kd": 0.120891,
"tax_rate": 0.224395,
"post_tax_kd": 0.093764
},
"weights": {
"wd": 0.024013,
"we": 0.975987
},
"wacc": {
"formula": "WACC = (Wd x Kd) + (We x Ke)",
"wd_x_kd": 0.002252,
"we_x_ke": 0.082387,
"wacc": 0.084639
}
}
Notes:
- Ke = 8.44% (reference: 8.44%) ✓
- WACC = 8.46% (reference: 8.40%) — small delta from single-year weights
- Pass historical_weights list to use median weights across multiple years
=== 4. valuation/scripts/calculate_valuation.py ===
Input: FCFE=1571.02 Cr, FCFF=1675.01 Cr, Ke=8.44%, WACC=8.40%,
growth=9%, terminal_growth=8%, shares=80.76 Cr, price=₹1441
Output:
{
"inputs": {
"fcfe": 1571.02,
"fcff": 1675.01,
"ke": 0.0844,
"wacc": 0.084,
"growth_rate": 0.09,
"terminal_growth_rate": 0.08,
"shares_outstanding": 80.761712,
"years": 3
},
"equity_valuation": {
"forecasted_fcfe": [1712.41, 1866.53, 2034.52],
"intrinsic_equity_value": 396380.91,
"intrinsic_share_price": 4908.03,
"current_market_price": 1441,
"verdict": "Undervalued"
},
"enterprise_valuation": {
"forecasted_fcff": [1825.76, 1990.08, 2169.19],
"intrinsic_enterprise_value": 464884.94
},
"sensitivity_analysis": {
"0.0801": { "0.07": 2177.44, "0.08": 215976.79, "0.09": null },
"0.0844": { "0.07": 1526.90, "0.08": 4908.03, "0.09": null },
"0.0901": { "0.07": 1093.59, "0.08": 2137.85, "0.09": 212032.63 },
"0.09": { "0.07": 1099.07, "0.08": 2159.23, "0.09": null }
}
}
Notes:
- Intrinsic share price: ₹4908 (reference: ₹4934) — within 0.5%
- Verdict: Undervalued (reference: Undervalued) ✓
- Enterprise value: ₹464,885 Cr (reference: ₹461,268 Cr) — within 0.8%
- null cells = ke <= tg, Gordon Growth undefined
- Sensitivity ke=0.0844, tg=0.08 → ₹4908 matches professor table ✓
KEY DESIGN DECISIONS
--------------------
1. sys.path bootstrap in each script (parents[4] = project root) so scripts
work when invoked directly by an agent without being installed as a package.
2. tolerance=2.0 crore default in cashflow script. yfinance data carries
rounding that spreads the 3 methods by ~0.8 crore. The calculator's default
of 0.10 crore is for exact reference data only. Pass "tolerance": 0.1 to
tighten for test/audit purposes.
3. historical_weights in cost-of-capital script. Accepts a list of
{book_value_debt, book_value_equity} dicts (one per fiscal year, raw INR)
to compute median Wd/We across years, matching the spec's multi-year WACC.
4. ke_values/tg_values auto-generated in valuation script if not supplied.
Produces a ±2 step grid around ke and ±1 step around tg automatically.