lucifer7210 commited on
Commit
a7ae94c
·
verified ·
1 Parent(s): eb606e1

Upload 3 files

Browse files
Files changed (3) hide show
  1. .env +3 -0
  2. .gitignore +1 -0
  3. USEME.MD +375 -0
.env ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ # Store your API key securely
2
+ SWARMS_API_KEY=sk-f763a9c6f898aa3ec74bf49047736a0201c293eefc36d5a04be8af647b93b711
3
+
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ __pycache__/
USEME.MD ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ Here are sample inputs for the key POST endpoints in the FastAPI backend:
4
+
5
+ ### 1. POST `/api/v1/funds/sip-calculate`
6
+ **Request Body:**
7
+ ```json
8
+ {
9
+ "monthly_amount": 10000,
10
+ "annual_return": 12.0,
11
+ "years": 10
12
+ }
13
+ ```
14
+
15
+ ### 2. POST `/api/v1/funds/required-sip`
16
+ **Request Body:**
17
+ ```json
18
+ {
19
+ "target_amount": 5000000,
20
+ "years": 15,
21
+ "expected_return": 12.0
22
+ }
23
+ ```
24
+
25
+ ### 3. POST `/api/v1/funds/analyze`
26
+ **Request Body:**
27
+ ```json
28
+ {
29
+ "fund_names": ["HDFC Top 100 Fund", "SBI Bluechip Fund"],
30
+ "investment_amount": 100000,
31
+ "start_date": "2023-01-01T00:00:00",
32
+ "end_date": "2024-01-01T00:00:00"
33
+ }
34
+ ```
35
+
36
+ ### 4. POST `/api/v1/portfolio/metrics`
37
+ **Request Body:**
38
+ ```json
39
+ {
40
+ "holdings": {
41
+ "HDFC Top 100 Fund": {
42
+ "scheme_code": "120503",
43
+ "category": "Large Cap Equity",
44
+ "fund_house": "HDFC Mutual Fund",
45
+ "invested_amount": 50000,
46
+ "current_value": 58000,
47
+ "units": 500,
48
+ "current_nav": 116.0,
49
+ "investment_type": "SIP (Monthly)",
50
+ "nav_data": []
51
+ },
52
+ "SBI Small Cap Fund": {
53
+ "scheme_code": "122639",
54
+ "category": "Small Cap Equity",
55
+ "fund_house": "SBI Mutual Fund",
56
+ "invested_amount": 30000,
57
+ "current_value": 35000,
58
+ "units": 300,
59
+ "current_nav": 116.67,
60
+ "investment_type": "SIP (Monthly)",
61
+ "nav_data": []
62
+ }
63
+ }
64
+ }
65
+ ```
66
+
67
+ ### 5. POST `/api/v1/goals/dashboard`
68
+ **Request Body:**
69
+ ```json
70
+ {
71
+ "goals": [
72
+ {
73
+ "name": "Child's Education",
74
+ "amount": 2000000,
75
+ "inflation_adjusted_amount": 4781564.0,
76
+ "years": 15,
77
+ "priority": "High",
78
+ "required_sip": 10000,
79
+ "expected_inflation": 6.0,
80
+ "id": 0
81
+ },
82
+ {
83
+ "name": "Retirement",
84
+ "amount": 5000000,
85
+ "inflation_adjusted_amount": 11953910.0,
86
+ "years": 25,
87
+ "priority": "Critical",
88
+ "required_sip": 15000,
89
+ "expected_inflation": 6.0,
90
+ "id": 1
91
+ }
92
+ ],
93
+ "monthly_savings": 80000
94
+ }
95
+ ```
96
+
97
+ ### 6. POST `/api/v1/goals/inflation-adjusted`
98
+ **Request Body:**
99
+ ```json
100
+ {
101
+ "target_amount": 1000000,
102
+ "years": 10,
103
+ "expected_inflation": 6.0
104
+ }
105
+ ```
106
+
107
+ ### 7. POST `/api/v1/ai/analyze`
108
+ **Request Body:**
109
+ ```json
110
+ {
111
+ "client_profile": {
112
+ "age": 35,
113
+ "monthly_income": 50000,
114
+ "risk_tolerance": "Moderate",
115
+ "investment_experience": "Intermediate",
116
+ "tax_bracket": "20%",
117
+ "monthly_savings": 15000
118
+ },
119
+ "portfolio_data": {
120
+ "holdings": ["HDFC Top 100 Fund", "SBI Small Cap Fund"],
121
+ "categories": ["Large Cap Equity", "Small Cap Equity"],
122
+ "total_value": 93000,
123
+ "total_invested": 80000,
124
+ "total_gains": 13000,
125
+ "category_allocation": {
126
+ "Large Cap Equity": 62.37,
127
+ "Small Cap Equity": 37.63
128
+ }
129
+ },
130
+ "goals_data": {
131
+ "goals": ["Child's Education", "Retirement"],
132
+ "goal_details": [
133
+ {
134
+ "name": "Child's Education",
135
+ "amount": 2000000,
136
+ "inflation_adjusted_amount": 4781564.0,
137
+ "years": 15,
138
+ "priority": "High",
139
+ "required_sip": 10000,
140
+ "expected_inflation": 6.0,
141
+ "id": 0
142
+ },
143
+ {
144
+ "name": "Retirement",
145
+ "amount": 5000000,
146
+ "inflation_adjusted_amount": 11953910.0,
147
+ "years": 25,
148
+ "priority": "Critical",
149
+ "required_sip": 15000,
150
+ "expected_inflation": 6.0,
151
+ "id": 1
152
+ }
153
+ ],
154
+ "total_required_sip": 25000,
155
+ "timeline_range": "15-25 years",
156
+ "priority_goals": [
157
+ {
158
+ "name": "Retirement",
159
+ "amount": 5000000,
160
+ "inflation_adjusted_amount": 11953910.0,
161
+ "years": 25,
162
+ "priority": "Critical",
163
+ "required_sip": 15000,
164
+ "expected_inflation": 6.0,
165
+ "id": 1
166
+ }
167
+ ]
168
+ },
169
+ "analysis_focus": ["Fund Selection", "Risk Assessment", "Goal Alignment"],
170
+ "market_conditions": "Neutral",
171
+ "investment_horizon": "Medium Term (3-7 years)"
172
+ }
173
+ ```
174
+
175
+ ### 8. POST `/api/v1/ai/fund-selection`
176
+ **Request Body:**
177
+ ```json
178
+ {
179
+ "client_profile": {
180
+ "age": 35,
181
+ "monthly_income": 50000,
182
+ "risk_tolerance": "Moderate",
183
+ "investment_experience": "Intermediate",
184
+ "tax_bracket": "20%",
185
+ "monthly_savings": 15000
186
+ },
187
+ "goals_data": {
188
+ "goals": ["Child's Education", "Retirement"],
189
+ "goal_details": [
190
+ {
191
+ "name": "Child's Education",
192
+ "amount": 2000000,
193
+ "inflation_adjusted_amount": 4781564.0,
194
+ "years": 15,
195
+ "priority": "High",
196
+ "required_sip": 10000,
197
+ "expected_inflation": 6.0,
198
+ "id": 0
199
+ },
200
+ {
201
+ "name": "Retirement",
202
+ "amount": 5000000,
203
+ "inflation_adjusted_amount": 11953910.0,
204
+ "years": 25,
205
+ "priority": "Critical",
206
+ "required_sip": 15000,
207
+ "expected_inflation": 6.0,
208
+ "id": 1
209
+ }
210
+ ],
211
+ "total_required_sip": 25000,
212
+ "timeline_range": "15-25 years",
213
+ "priority_goals": [
214
+ {
215
+ "name": "Retirement",
216
+ "amount": 5000000,
217
+ "inflation_adjusted_amount": 11953910.0,
218
+ "years": 25,
219
+ "priority": "Critical",
220
+ "required_sip": 15000,
221
+ "expected_inflation": 6.0,
222
+ "id": 1
223
+ }
224
+ ]
225
+ },
226
+ "market_conditions": "Neutral",
227
+ "investment_horizon": "Medium Term (3-7 years)"
228
+ }
229
+ ```
230
+
231
+ ### 9. POST `/api/v1/ai/risk-assessment`
232
+ **Request Body:**
233
+ ```json
234
+ {
235
+ "client_profile": {
236
+ "age": 35,
237
+ "monthly_income": 50000,
238
+ "risk_tolerance": "Moderate",
239
+ "investment_experience": "Intermediate",
240
+ "tax_bracket": "20%",
241
+ "monthly_savings": 15000
242
+ },
243
+ "portfolio_data": {
244
+ "holdings": ["HDFC Top 100 Fund", "SBI Small Cap Fund"],
245
+ "categories": ["Large Cap Equity", "Small Cap Equity"],
246
+ "total_value": 93000,
247
+ "total_invested": 80000,
248
+ "total_gains": 13000,
249
+ "category_allocation": {
250
+ "Large Cap Equity": 62.37,
251
+ "Small Cap Equity": 37.63
252
+ }
253
+ },
254
+ "market_conditions": "Neutral"
255
+ }
256
+ ```
257
+
258
+ ### 10. POST `/api/v1/ai/goal-planning`
259
+ **Request Body:**
260
+ ```json
261
+ {
262
+ "client_profile": {
263
+ "age": 35,
264
+ "monthly_income": 50000,
265
+ "risk_tolerance": "Moderate",
266
+ "investment_experience": "Intermediate",
267
+ "tax_bracket": "20%",
268
+ "monthly_savings": 15000
269
+ },
270
+ "goals_data": {
271
+ "goals": ["Child's Education", "Retirement"],
272
+ "goal_details": [
273
+ {
274
+ "name": "Child's Education",
275
+ "amount": 2000000,
276
+ "inflation_adjusted_amount": 4781564.0,
277
+ "years": 15,
278
+ "priority": "High",
279
+ "required_sip": 10000,
280
+ "expected_inflation": 6.0,
281
+ "id": 0
282
+ },
283
+ {
284
+ "name": "Retirement",
285
+ "amount": 5000000,
286
+ "inflation_adjusted_amount": 11953910.0,
287
+ "years": 25,
288
+ "priority": "Critical",
289
+ "required_sip": 15000,
290
+ "expected_inflation": 6.0,
291
+ "id": 1
292
+ }
293
+ ],
294
+ "total_required_sip": 25000,
295
+ "timeline_range": "15-25 years",
296
+ "priority_goals": [
297
+ {
298
+ "name": "Retirement",
299
+ "amount": 5000000,
300
+ "inflation_adjusted_amount": 11953910.0,
301
+ "years": 25,
302
+ "priority": "Critical",
303
+ "required_sip": 15000,
304
+ "expected_inflation": 6.0,
305
+ "id": 1
306
+ }
307
+ ]
308
+ },
309
+ "investment_horizon": "Medium Term (3-7 years)"
310
+ }
311
+ ```
312
+
313
+ ### 11. POST `/api/v1/portfolio/rebalance`
314
+ **Request Body:**
315
+ ```json
316
+ {
317
+ "holdings": {
318
+ "HDFC Top 100 Fund": {
319
+ "scheme_code": "120503",
320
+ "category": "Large Cap Equity",
321
+ "fund_house": "HDFC Mutual Fund",
322
+ "invested_amount": 50000,
323
+ "current_value": 58000,
324
+ "units": 500,
325
+ "current_nav": 116.0,
326
+ "investment_type": "SIP (Monthly)",
327
+ "nav_data": []
328
+ },
329
+ "SBI Small Cap Fund": {
330
+ "scheme_code": "122639",
331
+ "category": "Small Cap Equity",
332
+ "fund_house": "SBI Mutual Fund",
333
+ "invested_amount": 30000,
334
+ "current_value": 35000,
335
+ "units": 300,
336
+ "current_nav": 116.67,
337
+ "investment_type": "SIP (Monthly)",
338
+ "nav_data": []
339
+ }
340
+ }
341
+ }
342
+ ```
343
+
344
+ ### 12. POST `/api/v1/portfolio/performance`
345
+ **Request Body:**
346
+ ```json
347
+ {
348
+ "holdings": {
349
+ "HDFC Top 100 Fund": {
350
+ "scheme_code": "120503",
351
+ "category": "Large Cap Equity",
352
+ "fund_house": "HDFC Mutual Fund",
353
+ "invested_amount": 50000,
354
+ "current_value": 58000,
355
+ "units": 500,
356
+ "current_nav": 116.0,
357
+ "investment_type": "SIP (Monthly)",
358
+ "nav_data": []
359
+ },
360
+ "SBI Small Cap Fund": {
361
+ "scheme_code": "122639",
362
+ "category": "Small Cap Equity",
363
+ "fund_house": "SBI Mutual Fund",
364
+ "invested_amount": 30000,
365
+ "current_value": 35000,
366
+ "units": 300,
367
+ "current_nav": 116.67,
368
+ "investment_type": "SIP (Monthly)",
369
+ "nav_data": []
370
+ }
371
+ }
372
+ }
373
+ ```
374
+
375
+ These sample inputs cover all the major POST endpoints in the FastAPI backend. Each request includes realistic data that matches the expected Pydantic models for each endpoint. You can use these samples to test the API endpoints directly or integrate them with your Streamlit frontend.