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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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import yfinance as yf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define the list of stock symbols\n",
    "stock_symbols = ['JPM', 'GS', 'MS', 'BLK', 'C']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[*********************100%%**********************]  5 of 5 completed\n"
     ]
    }
   ],
   "source": [
    "# Download historical stock price data\n",
    "stock_data = yf.download(stock_symbols, start=\"2020-01-01\", end=\"2023-11-30\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe thead tr:last-of-type th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr>\n",
       "      <th>Price</th>\n",
       "      <th colspan=\"5\" halign=\"left\">Adj Close</th>\n",
       "      <th colspan=\"5\" halign=\"left\">Close</th>\n",
       "      <th>...</th>\n",
       "      <th colspan=\"5\" halign=\"left\">Open</th>\n",
       "      <th colspan=\"5\" halign=\"left\">Volume</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Ticker</th>\n",
       "      <th>BLK</th>\n",
       "      <th>C</th>\n",
       "      <th>GS</th>\n",
       "      <th>JPM</th>\n",
       "      <th>MS</th>\n",
       "      <th>BLK</th>\n",
       "      <th>C</th>\n",
       "      <th>GS</th>\n",
       "      <th>JPM</th>\n",
       "      <th>MS</th>\n",
       "      <th>...</th>\n",
       "      <th>BLK</th>\n",
       "      <th>C</th>\n",
       "      <th>GS</th>\n",
       "      <th>JPM</th>\n",
       "      <th>MS</th>\n",
       "      <th>BLK</th>\n",
       "      <th>C</th>\n",
       "      <th>GS</th>\n",
       "      <th>JPM</th>\n",
       "      <th>MS</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Date</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2020-01-02</th>\n",
       "      <td>457.110931</td>\n",
       "      <td>68.963692</td>\n",
       "      <td>210.857330</td>\n",
       "      <td>123.533600</td>\n",
       "      <td>45.443264</td>\n",
       "      <td>508.980011</td>\n",
       "      <td>81.230003</td>\n",
       "      <td>234.320007</td>\n",
       "      <td>141.089996</td>\n",
       "      <td>52.040001</td>\n",
       "      <td>...</td>\n",
       "      <td>510.000000</td>\n",
       "      <td>80.129997</td>\n",
       "      <td>231.000000</td>\n",
       "      <td>139.789993</td>\n",
       "      <td>51.200001</td>\n",
       "      <td>560400</td>\n",
       "      <td>12728900</td>\n",
       "      <td>3736300</td>\n",
       "      <td>10803700</td>\n",
       "      <td>7808000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-01-03</th>\n",
       "      <td>452.252197</td>\n",
       "      <td>67.664719</td>\n",
       "      <td>208.391678</td>\n",
       "      <td>121.903435</td>\n",
       "      <td>44.709740</td>\n",
       "      <td>503.570007</td>\n",
       "      <td>79.699997</td>\n",
       "      <td>231.580002</td>\n",
       "      <td>138.339996</td>\n",
       "      <td>51.200001</td>\n",
       "      <td>...</td>\n",
       "      <td>501.720001</td>\n",
       "      <td>79.800003</td>\n",
       "      <td>231.600006</td>\n",
       "      <td>137.500000</td>\n",
       "      <td>51.220001</td>\n",
       "      <td>337300</td>\n",
       "      <td>12437400</td>\n",
       "      <td>2274500</td>\n",
       "      <td>10386800</td>\n",
       "      <td>6706000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-01-06</th>\n",
       "      <td>452.638397</td>\n",
       "      <td>67.452461</td>\n",
       "      <td>210.524353</td>\n",
       "      <td>121.806473</td>\n",
       "      <td>44.552567</td>\n",
       "      <td>504.000000</td>\n",
       "      <td>79.449997</td>\n",
       "      <td>233.949997</td>\n",
       "      <td>138.229996</td>\n",
       "      <td>51.020000</td>\n",
       "      <td>...</td>\n",
       "      <td>500.170013</td>\n",
       "      <td>78.720001</td>\n",
       "      <td>229.929993</td>\n",
       "      <td>136.559998</td>\n",
       "      <td>50.669998</td>\n",
       "      <td>411300</td>\n",
       "      <td>10059500</td>\n",
       "      <td>3329300</td>\n",
       "      <td>10259000</td>\n",
       "      <td>7476700</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-01-07</th>\n",
       "      <td>455.530243</td>\n",
       "      <td>66.866661</td>\n",
       "      <td>211.910172</td>\n",
       "      <td>119.735695</td>\n",
       "      <td>44.465233</td>\n",
       "      <td>507.220001</td>\n",
       "      <td>78.760002</td>\n",
       "      <td>235.490005</td>\n",
       "      <td>135.880005</td>\n",
       "      <td>50.919998</td>\n",
       "      <td>...</td>\n",
       "      <td>502.880005</td>\n",
       "      <td>79.290001</td>\n",
       "      <td>235.000000</td>\n",
       "      <td>137.279999</td>\n",
       "      <td>51.040001</td>\n",
       "      <td>453900</td>\n",
       "      <td>10469100</td>\n",
       "      <td>5255200</td>\n",
       "      <td>10531300</td>\n",
       "      <td>4538100</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2020-01-08</th>\n",
       "      <td>455.422516</td>\n",
       "      <td>67.376060</td>\n",
       "      <td>213.952820</td>\n",
       "      <td>120.669746</td>\n",
       "      <td>45.032845</td>\n",
       "      <td>507.100006</td>\n",
       "      <td>79.360001</td>\n",
       "      <td>237.759995</td>\n",
       "      <td>136.940002</td>\n",
       "      <td>51.570000</td>\n",
       "      <td>...</td>\n",
       "      <td>507.769989</td>\n",
       "      <td>78.769997</td>\n",
       "      <td>235.679993</td>\n",
       "      <td>135.699997</td>\n",
       "      <td>50.959999</td>\n",
       "      <td>726500</td>\n",
       "      <td>11292400</td>\n",
       "      <td>3564700</td>\n",
       "      <td>9695300</td>\n",
       "      <td>6185200</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-11-22</th>\n",
       "      <td>717.865295</td>\n",
       "      <td>44.594376</td>\n",
       "      <td>333.518433</td>\n",
       "      <td>151.506546</td>\n",
       "      <td>77.728569</td>\n",
       "      <td>727.140015</td>\n",
       "      <td>45.020000</td>\n",
       "      <td>338.640015</td>\n",
       "      <td>153.330002</td>\n",
       "      <td>78.489998</td>\n",
       "      <td>...</td>\n",
       "      <td>727.000000</td>\n",
       "      <td>45.310001</td>\n",
       "      <td>336.940002</td>\n",
       "      <td>153.410004</td>\n",
       "      <td>78.790001</td>\n",
       "      <td>498100</td>\n",
       "      <td>9441200</td>\n",
       "      <td>1235200</td>\n",
       "      <td>5174500</td>\n",
       "      <td>4265400</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-11-24</th>\n",
       "      <td>720.787537</td>\n",
       "      <td>44.802391</td>\n",
       "      <td>334.020691</td>\n",
       "      <td>151.714050</td>\n",
       "      <td>77.887024</td>\n",
       "      <td>730.099976</td>\n",
       "      <td>45.230000</td>\n",
       "      <td>339.149994</td>\n",
       "      <td>153.539993</td>\n",
       "      <td>78.650002</td>\n",
       "      <td>...</td>\n",
       "      <td>726.719971</td>\n",
       "      <td>44.889999</td>\n",
       "      <td>338.799988</td>\n",
       "      <td>153.589996</td>\n",
       "      <td>78.260002</td>\n",
       "      <td>279600</td>\n",
       "      <td>5941000</td>\n",
       "      <td>460100</td>\n",
       "      <td>3496900</td>\n",
       "      <td>2398000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-11-27</th>\n",
       "      <td>721.360168</td>\n",
       "      <td>44.653809</td>\n",
       "      <td>332.602478</td>\n",
       "      <td>151.368225</td>\n",
       "      <td>77.193810</td>\n",
       "      <td>730.679993</td>\n",
       "      <td>45.080002</td>\n",
       "      <td>337.709991</td>\n",
       "      <td>153.190002</td>\n",
       "      <td>77.949997</td>\n",
       "      <td>...</td>\n",
       "      <td>727.200012</td>\n",
       "      <td>44.959999</td>\n",
       "      <td>339.190002</td>\n",
       "      <td>153.429993</td>\n",
       "      <td>78.269997</td>\n",
       "      <td>868100</td>\n",
       "      <td>14679700</td>\n",
       "      <td>1250500</td>\n",
       "      <td>6259100</td>\n",
       "      <td>5237800</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-11-28</th>\n",
       "      <td>727.362610</td>\n",
       "      <td>44.435886</td>\n",
       "      <td>332.543396</td>\n",
       "      <td>151.714050</td>\n",
       "      <td>76.134186</td>\n",
       "      <td>736.760010</td>\n",
       "      <td>44.860001</td>\n",
       "      <td>337.649994</td>\n",
       "      <td>153.539993</td>\n",
       "      <td>76.879997</td>\n",
       "      <td>...</td>\n",
       "      <td>725.859985</td>\n",
       "      <td>45.029999</td>\n",
       "      <td>337.380005</td>\n",
       "      <td>153.220001</td>\n",
       "      <td>77.360001</td>\n",
       "      <td>610200</td>\n",
       "      <td>14064700</td>\n",
       "      <td>1419000</td>\n",
       "      <td>6582700</td>\n",
       "      <td>9197900</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2023-11-29</th>\n",
       "      <td>737.768188</td>\n",
       "      <td>45.317474</td>\n",
       "      <td>337.865692</td>\n",
       "      <td>152.484787</td>\n",
       "      <td>77.787994</td>\n",
       "      <td>747.299988</td>\n",
       "      <td>45.750000</td>\n",
       "      <td>340.260010</td>\n",
       "      <td>154.320007</td>\n",
       "      <td>78.550003</td>\n",
       "      <td>...</td>\n",
       "      <td>742.280029</td>\n",
       "      <td>45.230000</td>\n",
       "      <td>337.000000</td>\n",
       "      <td>154.169998</td>\n",
       "      <td>77.480003</td>\n",
       "      <td>750000</td>\n",
       "      <td>14027600</td>\n",
       "      <td>2038100</td>\n",
       "      <td>9126100</td>\n",
       "      <td>7420700</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>985 rows × 30 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "Price        Adj Close                                                \\\n",
       "Ticker             BLK          C          GS         JPM         MS   \n",
       "Date                                                                   \n",
       "2020-01-02  457.110931  68.963692  210.857330  123.533600  45.443264   \n",
       "2020-01-03  452.252197  67.664719  208.391678  121.903435  44.709740   \n",
       "2020-01-06  452.638397  67.452461  210.524353  121.806473  44.552567   \n",
       "2020-01-07  455.530243  66.866661  211.910172  119.735695  44.465233   \n",
       "2020-01-08  455.422516  67.376060  213.952820  120.669746  45.032845   \n",
       "...                ...        ...         ...         ...        ...   \n",
       "2023-11-22  717.865295  44.594376  333.518433  151.506546  77.728569   \n",
       "2023-11-24  720.787537  44.802391  334.020691  151.714050  77.887024   \n",
       "2023-11-27  721.360168  44.653809  332.602478  151.368225  77.193810   \n",
       "2023-11-28  727.362610  44.435886  332.543396  151.714050  76.134186   \n",
       "2023-11-29  737.768188  45.317474  337.865692  152.484787  77.787994   \n",
       "\n",
       "Price            Close                                                ...  \\\n",
       "Ticker             BLK          C          GS         JPM         MS  ...   \n",
       "Date                                                                  ...   \n",
       "2020-01-02  508.980011  81.230003  234.320007  141.089996  52.040001  ...   \n",
       "2020-01-03  503.570007  79.699997  231.580002  138.339996  51.200001  ...   \n",
       "2020-01-06  504.000000  79.449997  233.949997  138.229996  51.020000  ...   \n",
       "2020-01-07  507.220001  78.760002  235.490005  135.880005  50.919998  ...   \n",
       "2020-01-08  507.100006  79.360001  237.759995  136.940002  51.570000  ...   \n",
       "...                ...        ...         ...         ...        ...  ...   \n",
       "2023-11-22  727.140015  45.020000  338.640015  153.330002  78.489998  ...   \n",
       "2023-11-24  730.099976  45.230000  339.149994  153.539993  78.650002  ...   \n",
       "2023-11-27  730.679993  45.080002  337.709991  153.190002  77.949997  ...   \n",
       "2023-11-28  736.760010  44.860001  337.649994  153.539993  76.879997  ...   \n",
       "2023-11-29  747.299988  45.750000  340.260010  154.320007  78.550003  ...   \n",
       "\n",
       "Price             Open                                                Volume  \\\n",
       "Ticker             BLK          C          GS         JPM         MS     BLK   \n",
       "Date                                                                           \n",
       "2020-01-02  510.000000  80.129997  231.000000  139.789993  51.200001  560400   \n",
       "2020-01-03  501.720001  79.800003  231.600006  137.500000  51.220001  337300   \n",
       "2020-01-06  500.170013  78.720001  229.929993  136.559998  50.669998  411300   \n",
       "2020-01-07  502.880005  79.290001  235.000000  137.279999  51.040001  453900   \n",
       "2020-01-08  507.769989  78.769997  235.679993  135.699997  50.959999  726500   \n",
       "...                ...        ...         ...         ...        ...     ...   \n",
       "2023-11-22  727.000000  45.310001  336.940002  153.410004  78.790001  498100   \n",
       "2023-11-24  726.719971  44.889999  338.799988  153.589996  78.260002  279600   \n",
       "2023-11-27  727.200012  44.959999  339.190002  153.429993  78.269997  868100   \n",
       "2023-11-28  725.859985  45.029999  337.380005  153.220001  77.360001  610200   \n",
       "2023-11-29  742.280029  45.230000  337.000000  154.169998  77.480003  750000   \n",
       "\n",
       "Price                                             \n",
       "Ticker             C       GS       JPM       MS  \n",
       "Date                                              \n",
       "2020-01-02  12728900  3736300  10803700  7808000  \n",
       "2020-01-03  12437400  2274500  10386800  6706000  \n",
       "2020-01-06  10059500  3329300  10259000  7476700  \n",
       "2020-01-07  10469100  5255200  10531300  4538100  \n",
       "2020-01-08  11292400  3564700   9695300  6185200  \n",
       "...              ...      ...       ...      ...  \n",
       "2023-11-22   9441200  1235200   5174500  4265400  \n",
       "2023-11-24   5941000   460100   3496900  2398000  \n",
       "2023-11-27  14679700  1250500   6259100  5237800  \n",
       "2023-11-28  14064700  1419000   6582700  9197900  \n",
       "2023-11-29  14027600  2038100   9126100  7420700  \n",
       "\n",
       "[985 rows x 30 columns]"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "stock_data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "py312",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}