File size: 120,147 Bytes
19b91dd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Get envirionment variables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "from dotenv import find_dotenv, dotenv_values\n",
    "\n",
    "keys = list(dotenv_values(find_dotenv('.env')).items())\n",
    "OPENAI_API_KEY = os.environ['OPENAI_API_KEY'] = keys[0][1]\n",
    "LANGCHAIN_API_KEY = os.environ['LANGCHAIN_API_KEY'] = keys[1][1]\n",
    "POLYGON_API_KEY = os.environ['POLYGON_API_KEY'] = keys[2][1]\n",
    "EMAIL = os.environ['EMAIL'] = keys[3][1] #make this a user entry"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Install Required Libraries"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.1.2\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.1.2\u001b[0m\n",
      "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
     ]
    }
   ],
   "source": [
    "!pip install langchain_core langchain_openai langchain_community langsmith openai polygon-api-client pypdf yfinance -qU"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create Tools"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The following tools were ripped directly from the langchain source code to remove the requirement for current data from the API."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "\"\"\"\n",
    "Util that calls several of Polygon's stock market REST APIs.\n",
    "Docs: https://polygon.io/docs/stocks/getting-started\n",
    "\"\"\"\n",
    "\n",
    "import json\n",
    "from typing import Any, Dict, Optional\n",
    "\n",
    "import requests\n",
    "from langchain_core.pydantic_v1 import BaseModel, root_validator\n",
    "from langchain_core.utils import get_from_dict_or_env\n",
    "\n",
    "POLYGON_BASE_URL = \"https://api.polygon.io/\"\n",
    "\n",
    "class PolygonAPIWrapper(BaseModel):\n",
    "    \"\"\"Wrapper for Polygon API.\"\"\"\n",
    "\n",
    "    polygon_api_key: Optional[str] = None\n",
    "\n",
    "    @root_validator(pre=True)\n",
    "    def validate_environment(cls, values: Dict) -> Dict:\n",
    "        \"\"\"Validate that api key in environment.\"\"\"\n",
    "        polygon_api_key = get_from_dict_or_env(\n",
    "            values, \"polygon_api_key\", \"POLYGON_API_KEY\"\n",
    "        )\n",
    "        values[\"polygon_api_key\"] = polygon_api_key\n",
    "\n",
    "        return values\n",
    "\n",
    "    def get_financials(self, ticker: str) -> Optional[dict]:\n",
    "        \"\"\"\n",
    "        Get fundamental financial data, which is found in balance sheets,\n",
    "        income statements, and cash flow statements for a given ticker.\n",
    "\n",
    "        /vX/reference/financials\n",
    "        \"\"\"\n",
    "        url = (\n",
    "            f\"{POLYGON_BASE_URL}vX/reference/financials?\"\n",
    "            f\"ticker={ticker}&\"\n",
    "            f\"apiKey={self.polygon_api_key}\"\n",
    "        )\n",
    "        response = requests.get(url)\n",
    "        data = response.json()\n",
    "\n",
    "        status = data.get(\"status\", None)\n",
    "        if status != \"OK\":\n",
    "            raise ValueError(f\"API Error: {data}\")\n",
    "\n",
    "        return data.get(\"results\", None)\n",
    "\n",
    "    def get_last_quote(self, ticker: str) -> Optional[dict]:\n",
    "        \"\"\"\n",
    "        Get the most recent National Best Bid and Offer (Quote) for a ticker.\n",
    "\n",
    "        /v2/last/nbbo/{ticker}\n",
    "        \"\"\"\n",
    "        url = f\"{POLYGON_BASE_URL}v2/last/nbbo/{ticker}?apiKey={self.polygon_api_key}\"\n",
    "        response = requests.get(url)\n",
    "        data = response.json()\n",
    "\n",
    "        status = data.get(\"status\", None)\n",
    "        if status != \"OK\":\n",
    "            raise ValueError(f\"API Error: {data}\")\n",
    "\n",
    "        return data.get(\"results\", None)\n",
    "\n",
    "    def get_ticker_news(self, ticker: str) -> Optional[dict]:\n",
    "        \"\"\"\n",
    "        Get the most recent news articles relating to a stock ticker symbol,\n",
    "        including a summary of the article and a link to the original source.\n",
    "\n",
    "        /v2/reference/news\n",
    "        \"\"\"\n",
    "        url = (\n",
    "            f\"{POLYGON_BASE_URL}v2/reference/news?\"\n",
    "            f\"ticker={ticker}&\"\n",
    "            f\"apiKey={self.polygon_api_key}\"\n",
    "        )\n",
    "        response = requests.get(url)\n",
    "        data = response.json()\n",
    "\n",
    "        status = data.get(\"status\", None)\n",
    "        if status != \"OK\":\n",
    "            raise ValueError(f\"API Error: {data}\")\n",
    "\n",
    "        return data.get(\"results\", None)\n",
    "\n",
    "    def get_aggregates(self, ticker: str, **kwargs: Any) -> Optional[dict]:\n",
    "        \"\"\"\n",
    "        Get aggregate bars for a stock over a given date range\n",
    "        in custom time window sizes.\n",
    "\n",
    "        /v2/aggs/ticker/{ticker}/range/{multiplier}/{timespan}/{from_date}/{to_date}\n",
    "        \"\"\"\n",
    "        timespan = kwargs.get(\"timespan\", \"day\")\n",
    "        multiplier = kwargs.get(\"timespan_multiplier\", 1)\n",
    "        from_date = kwargs.get(\"from_date\", None)\n",
    "        to_date = kwargs.get(\"to_date\", None)\n",
    "        adjusted = kwargs.get(\"adjusted\", True)\n",
    "        sort = kwargs.get(\"sort\", \"asc\")\n",
    "\n",
    "        url = (\n",
    "            f\"{POLYGON_BASE_URL}v2/aggs\"\n",
    "            f\"/ticker/{ticker}\"\n",
    "            f\"/range/{multiplier}\"\n",
    "            f\"/{timespan}\"\n",
    "            f\"/{from_date}\"\n",
    "            f\"/{to_date}\"\n",
    "            f\"?apiKey={self.polygon_api_key}\"\n",
    "            f\"&adjusted={adjusted}\"\n",
    "            f\"&sort={sort}\"\n",
    "        )\n",
    "        response = requests.get(url)\n",
    "        data = response.json()\n",
    "\n",
    "        status = data.get(\"status\", None)\n",
    "        \n",
    "        return data.get(\"results\", None)\n",
    "\n",
    "    def run(self, mode: str, ticker: str, **kwargs: Any) -> str:\n",
    "        if mode == \"get_financials\":\n",
    "            return json.dumps(self.get_financials(ticker))\n",
    "        elif mode == \"get_last_quote\":\n",
    "            return json.dumps(self.get_last_quote(ticker))\n",
    "        elif mode == \"get_ticker_news\":\n",
    "            return json.dumps(self.get_ticker_news(ticker))\n",
    "        elif mode == \"get_aggregates\":\n",
    "            return json.dumps(self.get_aggregates(ticker, **kwargs))\n",
    "        else:\n",
    "            raise ValueError(f\"Invalid mode {mode} for Polygon API.\")\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import Optional, Type\n",
    "\n",
    "from langchain_core.callbacks import CallbackManagerForToolRun\n",
    "from langchain_core.pydantic_v1 import BaseModel, Field\n",
    "from langchain_core.tools import BaseTool\n",
    "\n",
    "class PolygonAggregatesSchema(BaseModel):\n",
    "    \"\"\"Input for PolygonAggregates.\"\"\"\n",
    "\n",
    "    ticker: str = Field(\n",
    "        description=\"The ticker symbol to fetch aggregates for.\",\n",
    "    )\n",
    "    timespan: str = Field(\n",
    "        description=\"The size of the time window. \"\n",
    "        \"Possible values are: \"\n",
    "        \"second, minute, hour, day, week, month, quarter, year. \"\n",
    "        \"Default is 'day'\",\n",
    "    )\n",
    "    timespan_multiplier: int = Field(\n",
    "        description=\"The number of timespans to aggregate. \"\n",
    "        \"For example, if timespan is 'day' and \"\n",
    "        \"timespan_multiplier is 1, the result will be daily bars. \"\n",
    "        \"If timespan is 'day' and timespan_multiplier is 5, \"\n",
    "        \"the result will be weekly bars.  \"\n",
    "        \"Default is 1.\",\n",
    "    )\n",
    "    from_date: str = Field(\n",
    "        description=\"The start of the aggregate time window. \"\n",
    "        \"Either a date with the format YYYY-MM-DD or \"\n",
    "        \"a millisecond timestamp.\",\n",
    "    )\n",
    "    to_date: str = Field(\n",
    "        description=\"The end of the aggregate time window. \"\n",
    "        \"Either a date with the format YYYY-MM-DD or \"\n",
    "        \"a millisecond timestamp.\",\n",
    "    )\n",
    "\n",
    "\n",
    "class PolygonAggregates(BaseTool):\n",
    "    \"\"\"\n",
    "    Tool that gets aggregate bars (stock prices) over a\n",
    "    given date range for a given ticker from Polygon.\n",
    "    \"\"\"\n",
    "\n",
    "    mode: str = \"get_aggregates\"\n",
    "    name: str = \"polygon_aggregates\"\n",
    "    description: str = (\n",
    "        \"A wrapper around Polygon's Aggregates API. \"\n",
    "        \"This tool is useful for fetching aggregate bars (stock prices) for a ticker. \"\n",
    "        \"Input should be the ticker, date range, timespan, and timespan multiplier\"\n",
    "        \" that you want to get the aggregate bars for. This should be done when \"\n",
    "        \"attempting to retreive the current stock price for any valuation calculation.\"\n",
    "    )\n",
    "    args_schema: Type[PolygonAggregatesSchema] = PolygonAggregatesSchema\n",
    "\n",
    "    api_wrapper: PolygonAPIWrapper\n",
    "\n",
    "    def _run(\n",
    "        self,\n",
    "        ticker: str,\n",
    "        timespan: str,\n",
    "        timespan_multiplier: int,\n",
    "        from_date: str,\n",
    "        to_date: str,\n",
    "        run_manager: Optional[CallbackManagerForToolRun] = None,\n",
    "    ) -> str:\n",
    "        \"\"\"Use the Polygon API tool.\"\"\"\n",
    "        return self.api_wrapper.run(\n",
    "            mode=self.mode,\n",
    "            ticker=ticker,\n",
    "            timespan=timespan,\n",
    "            timespan_multiplier=timespan_multiplier,\n",
    "            from_date=from_date,\n",
    "            to_date=to_date,\n",
    "        )\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import Optional, Type\n",
    "\n",
    "from langchain_core.callbacks import CallbackManagerForToolRun\n",
    "from langchain_core.pydantic_v1 import BaseModel\n",
    "from langchain_core.tools import BaseTool\n",
    "\n",
    "class Inputs(BaseModel):\n",
    "    \"\"\"Inputs for Polygon's Financials API\"\"\"\n",
    "\n",
    "    query: str\n",
    "\n",
    "\n",
    "class PolygonFinancials(BaseTool):\n",
    "    \"\"\"Tool that gets the financials of a ticker from Polygon\"\"\"\n",
    "\n",
    "    mode: str = \"get_financials\"\n",
    "    name: str = \"polygon_financials\"\n",
    "    description: str = (\n",
    "        \"A wrapper around Polygon's Stock Financials API. \"\n",
    "        \"This tool is useful for fetching fundamental financials from \"\n",
    "        \"balance sheets, income statements, and cash flow statements \"\n",
    "        \"for a stock ticker. The input should be the ticker that you want \"\n",
    "        \"to get the latest fundamental financial data for. \"\n",
    "        \"If a duckduckgo_search call returns a list of stocks, \"\n",
    "        \"The tickers for those stocks can be passed to this function to \"\n",
    "        \"retreive financial data and provide an accurate response \"\n",
    "        \"to the user.\"\n",
    "    )\n",
    "    args_schema: Type[BaseModel] = Inputs\n",
    "\n",
    "    api_wrapper: PolygonAPIWrapper\n",
    "\n",
    "    def _run(\n",
    "        self,\n",
    "        query: str,\n",
    "        run_manager: Optional[CallbackManagerForToolRun] = None,\n",
    "    ) -> str:\n",
    "        \"\"\"Use the Polygon API tool.\"\"\"\n",
    "        return self.api_wrapper.run(self.mode, ticker=query)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import Optional, Type\n",
    "\n",
    "from langchain_core.callbacks import CallbackManagerForToolRun\n",
    "from langchain_core.pydantic_v1 import BaseModel\n",
    "from langchain_core.tools import BaseTool\n",
    "\n",
    "class Inputs(BaseModel):\n",
    "    \"\"\"Inputs for Polygon's Ticker News API\"\"\"\n",
    "\n",
    "    query: str\n",
    "\n",
    "\n",
    "class PolygonTickerNews(BaseTool):\n",
    "    \"\"\"Tool that gets the latest news for a given ticker from Polygon\"\"\"\n",
    "\n",
    "    mode: str = \"get_ticker_news\"\n",
    "    name: str = \"polygon_ticker_news\"\n",
    "    description: str = (\n",
    "        \"A wrapper around Polygon's Ticker News API. \"\n",
    "        \"This tool is useful for fetching the latest news for a stock. \"\n",
    "        \"Input should be the ticker that you want to get the latest news for.\"\n",
    "    )\n",
    "    args_schema: Type[BaseModel] = Inputs\n",
    "\n",
    "    api_wrapper: PolygonAPIWrapper\n",
    "\n",
    "    def _run(\n",
    "        self,\n",
    "        query: str,\n",
    "        run_manager: Optional[CallbackManagerForToolRun] = None,\n",
    "    ) -> str:\n",
    "        \"\"\"Use the Polygon API tool.\"\"\"\n",
    "        return self.api_wrapper.run(self.mode, ticker=query)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_openai import OpenAIEmbeddings\n",
    "from langchain_community.vectorstores import FAISS\n",
    "\n",
    "#load the vectorstore and initialize the retriever\n",
    "embeddings = OpenAIEmbeddings(model=\"text-embedding-3-small\")\n",
    "db = FAISS.load_local(\"./data/vectorstore\", embeddings, allow_dangerous_deserialization=True)\n",
    "\n",
    "class RAGInput(BaseModel):\n",
    "    \"\"\"Input for the local data retrieval tool.\"\"\"\n",
    "\n",
    "    query: str = Field(description=\"retreive data from vectorstore\")\n",
    "\n",
    "class RAGAgent(BaseTool):\n",
    "    \"\"\"Tool that retrieves information from a local vectorstore of financial reports. These reports include \n",
    "    11-K, 10-K, 10-Q, 8-K, and SD filings from all of the S&P 500 companies, as of July 18th, 2024. Whenever specific financial \n",
    "    information is requested in the query, ensure to use the Condensed Consolidated Statements of Cash Flows sections of the financial \n",
    "    documents.\"\"\"\n",
    "\n",
    "    name: str = \"vectorstore_retrieval\"\n",
    "    description: str = (\n",
    "        \"\"\"Tool that retrieves information from a local vectorstore of financial reports. These reports include \n",
    "    11-K, 10-K, 10-Q, and SD (Special disclosure) filings from all of the S&P 500 companies, as of July 18th, 2024. The information in this \n",
    "    vector store only pertains to fiscal years 2023 and 2024. Whenever specific financial \n",
    "    information is requested in the query, ensure to use the phrase 'Financial Information'. \n",
    "    If necessary, modify the user query to contain this phrase.\"\"\"\n",
    "    )\n",
    "    args_schema: Type[BaseModel] = RAGInput\n",
    "\n",
    "    def _run(\n",
    "        self,\n",
    "        query: str,\n",
    "        run_manager: Optional[CallbackManagerForToolRun] = None,\n",
    "    ) -> str:\n",
    "        \"\"\"Retrieve data from the vectorstore.\"\"\"\n",
    "        retriever = db.as_retriever()\n",
    "        return retriever.invoke(query)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 432,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain.tools import tool\n",
    "import datetime\n",
    "import yfinance as yf\n",
    "import pandas as pd\n",
    "\n",
    "@tool\n",
    "def get_datetime() -> str:\n",
    "    \"\"\"Get the current date and time in YYYY-MM-DD HH:MM:SS format.\"\"\"\n",
    "    return str(datetime.datetime.now())\n",
    "\n",
    "@tool\n",
    "def get_date() -> str:\n",
    "    \"\"\"Get the current date in YYYY-MM-DD format. Also useful when determining the current quarter.\"\"\"\n",
    "    return str(datetime.datetime.now()).split(\" \")[0]\n",
    "\n",
    "@tool\n",
    "def get_time() -> str:\n",
    "    \"\"\"Get the current time in HH:MM:SS format.\"\"\"\n",
    "    return str(datetime.datetime.now()).split(\" \")[1]\n",
    "\n",
    "@tool\n",
    "def get_quarter(date:str) -> str:\n",
    "    \"\"\"This tool takes a date in YYYY-MM-DD format as an argument and returns the quarter and year in the format 'QQ YYYY'.\"\"\"\n",
    "    quarters = {\n",
    "        \"01\" : \"Q1\",\n",
    "        \"02\" : \"Q1\",\n",
    "        \"03\" : \"Q1\",\n",
    "        \"04\" : \"Q2\",\n",
    "        \"05\" : \"Q2\",\n",
    "        \"06\" : \"Q2\",\n",
    "        \"07\" : \"Q3\",\n",
    "        \"08\" : \"Q3\",\n",
    "        \"09\" : \"Q3\",\n",
    "        \"10\" : \"Q4\",\n",
    "        \"11\" : \"Q4\",\n",
    "        \"12\" : \"Q4\",\n",
    "    }\n",
    "    return quarters[date.split(\"-\")[1]] + f\" {date.split('-')[0]}\"    \n",
    "\n",
    "@tool\n",
    "def calculate_percent_valuation(intrinsic_value:float, current_stock_price:float):\n",
    "    \"\"\"This tool can be used to calculate how overvalued or undervalued a stock is. It takes the calculated intrinsic value and the current stock price as arguments and returns the valuation percentage, in a format similar to '0.50' for 50%. The\n",
    "    math performed by this function is (intrinsic_value-current_stock_price)/abs(intrinsic_value). The current stock price must be retrieved using the 'get_date' tool (to get the current date) and then using that date to access the 'polygon_aggregates' tool. \n",
    "    A positive percentage indicates an overvalued stock and a negative percentage indicates an undervalued stock.\"\"\"\n",
    "    return (intrinsic_value-current_stock_price)/abs(intrinsic_value)\n",
    "\n",
    "@tool\n",
    "def calculate_intrinsic_value(ticker, average_growth_rate):\n",
    "    \"\"\"This tool is helpful for calculating the intrinsic value of a stock. It takes the stock ticker, the average growth rate based on revenue (retrieved from financial reports or with the polygon API. This should be capped at plus or minus 300% per year.)\"\"\"\n",
    "    wacc = calculate_wacc(ticker)\n",
    "\n",
    "@tool\n",
    "def calculate_wacc( #refer to https://www.gurufocus.com/term/wacc/SOFI#:~:text=SoFi%20Technologies%20WACC%20%25%20Calculation,the%20firm's%20cost%20of%20capital.\n",
    "    ticker:str, \n",
    "    market_cap:float, \n",
    "    interest_expense:float, \n",
    "    tax_expense:float, \n",
    "    pre_tax_income:float, \n",
    "    long_term_debt:float\n",
    "    ):\n",
    "    \"\"\"This tool is used to determine the weighted average cost of capital (WACC) when performing a DCF analysis. It takes the following arguments:\n",
    "\n",
    "    ticker\n",
    "    market capitalization - The market capitalization should be retrieved using the duckduckgo_search tool. Explicitly state 'nvidia market cap today'\n",
    "    interest expense - trailing twelve month interest expense calculated from the response of the polygon_financials tool.\n",
    "    tax expense - trailing twelve month tax expense calculated from the response of the polygon_financials tool.\n",
    "    pre-tax income -  trailing twelve month pre-tax income calculated from the response of the polygon_financials tool.\n",
    "    long term debt - long term debt calculated from the response of the polygon_financials tool.\n",
    "\n",
    "    WACC is returned as a percentage in the format '0.057'.\"\"\"\n",
    "    \n",
    "    treasury_yield10 = yf.Ticker(\"^TNX\") \n",
    "    risk_free_rate = round(treasury_yield10.info['regularMarketPreviousClose']/100,2) \n",
    "    sp500_teturn = 0.10\n",
    "    stock = yf.Ticker(f\"{ticker}\")\n",
    "    beta = stock.info[\"beta\"]\n",
    "\n",
    "    cost_of_equity = round(risk_free_rate + beta*(sp500_teturn - risk_free_rate),2)\n",
    "    weight_of_equity, weight_of_debt = get_weights(market_cap, long_term_debt)\n",
    "    cost_of_debt = get_cost_of_debt(interest_expense, long_term_debt)\n",
    "    tax_rate = get_tax_rate(tax_expense, pre_tax_income)\n",
    "    wacc = round((weight_of_equity * cost_of_equity) + ((weight_of_debt * cost_of_debt ) * (1-tax_rate)),3)\n",
    "    return wacc\n",
    "\n",
    "def get_weights(market_cap, long_term_debt):\n",
    "    e = market_cap\n",
    "    d = long_term_debt\n",
    "    weight_of_equity = e/(e+d)\n",
    "    weight_of_debt = d/(e+d)\n",
    "    return weight_of_equity, weight_of_debt\n",
    "\n",
    "def get_cost_of_debt(interest_expense, long_term_debt) -> float:\n",
    "    return interest_expense/long_term_debt\n",
    "\n",
    "def get_tax_rate(tax_expense, pre_tax_income):\n",
    "    tax_rate = tax_expense/pre_tax_income\n",
    "    if tax_rate>1:\n",
    "        return 1.00\n",
    "    if tax_rate<0:\n",
    "        return 0.00\n",
    "    return tax_rate\n",
    "\n",
    "def get_wacc(ticker):\n",
    "    treasury_yield10 = yf.Ticker(\"^TNX\") \n",
    "    risk_free_rate = round(treasury_yield10.info['regularMarketPrice']/100,2)\n",
    "    sp500_teturn = 0.10\n",
    "    stock = yf.Ticker(f\"{ticker}\")\n",
    "    beta = stock.info[\"beta\"]\n",
    "    cost_of_equity = round(risk_free_rate + beta*(sp500_teturn - risk_free_rate),2)\n",
    "    stock_bal = stock.balance_sheet\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up tool belt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 433,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_community.tools.ddg_search import DuckDuckGoSearchRun\n",
    "\n",
    "api_wrapper = PolygonAPIWrapper(polygon_api_key=POLYGON_API_KEY)\n",
    "\n",
    "tool_belt = [\n",
    "    get_datetime,\n",
    "    get_date,\n",
    "    get_time,\n",
    "    get_quarter,\n",
    "    calculate_percent_valuation,\n",
    "    calculate_wacc,\n",
    "    RAGAgent(),\n",
    "    DuckDuckGoSearchRun(),\n",
    "    PolygonAggregates(api_wrapper=api_wrapper),\n",
    "    PolygonFinancials(api_wrapper=api_wrapper),\n",
    "    PolygonTickerNews(api_wrapper=api_wrapper),\n",
    "]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up tool executor"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 434,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langgraph.prebuilt import ToolExecutor\n",
    "\n",
    "tool_executor = ToolExecutor(tool_belt)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 435,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_openai import ChatOpenAI\n",
    "\n",
    "model = ChatOpenAI(model=\"gpt-4o\", temperature=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up function calling"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 436,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langchain_core.utils.function_calling import convert_to_openai_function\n",
    "\n",
    "functions = [convert_to_openai_function(t) for t in tool_belt]\n",
    "model = model.bind_functions(functions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Set up agent state"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 437,
   "metadata": {},
   "outputs": [],
   "source": [
    "from typing import TypedDict, Annotated\n",
    "from langgraph.graph.message import add_messages\n",
    "import operator\n",
    "from langchain_core.messages import BaseMessage\n",
    "\n",
    "class AgentState(TypedDict):\n",
    "  messages: Annotated[list, add_messages]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Create nodes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 438,
   "metadata": {},
   "outputs": [],
   "source": [
    "import json\n",
    "from operator import itemgetter\n",
    "from langgraph.prebuilt import ToolInvocation\n",
    "from langchain_core.messages import FunctionMessage\n",
    "from langchain_core.prompts import PromptTemplate\n",
    "\n",
    "def call_model(state):\n",
    "  messages = state[\"messages\"]\n",
    "  response = model.invoke(messages)\n",
    "  return {\"messages\" : [response]}\n",
    "\n",
    "def call_tool(state):\n",
    "  last_message = state[\"messages\"][-1]\n",
    "\n",
    "  action = ToolInvocation(\n",
    "      tool=last_message.additional_kwargs[\"function_call\"][\"name\"],\n",
    "      tool_input=json.loads(\n",
    "          last_message.additional_kwargs[\"function_call\"][\"arguments\"]\n",
    "      )\n",
    "  )\n",
    "\n",
    "  response = tool_executor.invoke(action)\n",
    "\n",
    "  function_message = FunctionMessage(content=str(response), name=action.tool)\n",
    "\n",
    "  return {\"messages\" : [function_message]}\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 439,
   "metadata": {},
   "outputs": [],
   "source": [
    "from langgraph.graph import StateGraph, END\n",
    "\n",
    "workflow = StateGraph(AgentState)\n",
    "\n",
    "workflow.add_node(\"agent\", call_model)\n",
    "workflow.add_node(\"use tool\", call_tool)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 440,
   "metadata": {},
   "outputs": [],
   "source": [
    "workflow.set_entry_point(\"agent\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 441,
   "metadata": {},
   "outputs": [],
   "source": [
    "def should_continue(state):\n",
    "  last_message = state[\"messages\"][-1]\n",
    "\n",
    "  if \"function_call\" not in last_message.additional_kwargs:\n",
    "    return \"end\"\n",
    "\n",
    "  return \"continue\"\n",
    "\n",
    "workflow.add_conditional_edges(\n",
    "    \"agent\",\n",
    "    should_continue,\n",
    "    {\n",
    "        \"continue\" : \"use tool\",\n",
    "        \"end\" : END\n",
    "    }\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 442,
   "metadata": {},
   "outputs": [],
   "source": [
    "workflow.add_edge(\"use tool\", \"agent\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 443,
   "metadata": {},
   "outputs": [],
   "source": [
    "app = workflow.compile()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 444,
   "metadata": {},
   "outputs": [],
   "source": [
    "def print_messages(messages):\n",
    "  next_is_tool = False\n",
    "  initial_query = True\n",
    "  with open(\"response.md\", \"w\") as f:\n",
    "    for message in messages[\"messages\"]:\n",
    "      if \"function_call\" in message.additional_kwargs:\n",
    "        f.writelines(\"\\n\")\n",
    "        f.writelines(f'Tool Call - Name: {message.additional_kwargs[\"function_call\"][\"name\"]} + Query: {message.additional_kwargs[\"function_call\"][\"arguments\"]}')\n",
    "        print()\n",
    "        print(f'Tool Call - Name: {message.additional_kwargs[\"function_call\"][\"name\"]} + Query: {message.additional_kwargs[\"function_call\"][\"arguments\"]}')\n",
    "        next_is_tool = True\n",
    "        continue\n",
    "      if next_is_tool:\n",
    "        print(f\"Tool Response: {message.content}\")\n",
    "        next_is_tool = False\n",
    "        continue\n",
    "      if initial_query:\n",
    "        f.writelines(f\"Initial Query: {message.content}\")\n",
    "        f.writelines(\"\\n\")\n",
    "        print(f\"Initial Query: {message.content}\")\n",
    "        print()\n",
    "        initial_query = False\n",
    "        continue\n",
    "      f.writelines(\"\\n\")\n",
    "      f.writelines(f\"Agent Response: {message.content}\")\n",
    "      print()\n",
    "      print(f\"Agent Response: {message.content}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 445,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Initial Query: Can you perform a DCF analysis of Nvidia stock? Please list out each step of the calculation.\n",
      "\n",
      "\n",
      "Tool Call - Name: duckduckgo_search + Query: {\"query\":\"Nvidia market cap today\"}\n",
      "Tool Response: Get the latest stock price, news, and analysis for NVIDIA, a leading semiconductor company. See market cap, earnings, dividends, and other metrics for NVDA on Nasdaq. NVIDIA has a market cap of $3.22 trillion as of June 20, 2024, up 229.90% from a year ago. See the historical chart, ranking, and statistics of NVIDIA's market cap since 1999. Today's Open. 121.35. Previous Close. 126.36. July 17, 2024 04:00 PM Pricing delayed by 20 minutes. Stock Chart. Quick Links. Email Alerts; RSS; Request Printed Materials; Download Library; Email Alerts. ... We intend to use our @NVIDIA Twitter account, NVIDIA Facebook page, ... Stock analysis for NVIDIA Corp (NVDA:NASDAQ GS) including stock price, stock chart, company news, key statistics, fundamentals and company profile. Nvidia cofounder and CEO Jensen Huang. Nvidia's rise has been astronomical—it's grown its market capitalization from $1.1 trillion to $3.1 trillion in the past 12 months—and a tech ...\n",
      "\n",
      "Tool Call - Name: polygon_financials + Query: {\"query\":\"NVDA\"}\n",
      "Tool Response: [{\"start_date\": \"2023-04-29\", \"end_date\": \"2024-04-28\", \"timeframe\": \"ttm\", \"fiscal_period\": \"TTM\", \"fiscal_year\": \"\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"financials\": {\"balance_sheet\": {\"liabilities_and_equity\": {\"value\": 77072000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"assets\": {\"value\": 77072000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"equity_attributable_to_parent\": {\"value\": 49142000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"other_current_liabilities\": {\"value\": 11869000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"equity\": {\"value\": 49142000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"intangible_assets\": {\"value\": 986000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"current_assets\": {\"value\": 53729000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"wages\": {\"value\": 639000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"current_liabilities\": {\"value\": 15223000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"noncurrent_assets\": {\"value\": 23343000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"fixed_assets\": {\"value\": 4006000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"long_term_debt\": {\"value\": 9710000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"liabilities\": {\"value\": 27930000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"noncurrent_liabilities\": {\"value\": 12707000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"other_noncurrent_assets\": {\"value\": 18351000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"inventory\": {\"value\": 5864000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"other_noncurrent_liabilities\": {\"value\": 2997000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"accounts_payable\": {\"value\": 2715000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"other_current_assets\": {\"value\": 47865000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}}, \"cash_flow_statement\": {\"net_cash_flow_from_investing_activities\": {\"value\": -15418000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_financing_activities\": {\"value\": -22598000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow\": {\"value\": 2508000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -15418000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 40524000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_continuing\": {\"value\": 2508000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -22598000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_operating_activities\": {\"value\": 40524000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}}, \"income_statement\": {\"income_tax_expense_benefit\": {\"value\": 6291000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"operating_income_loss\": {\"value\": 47740000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"gross_profit\": {\"value\": 60059000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"revenues\": {\"value\": 79774000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"nonoperating_income_loss\": {\"value\": 1148000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"diluted_earnings_per_share\": {\"value\": 17.09, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"selling_general_and_administrative_expenses\": {\"value\": 2800000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"income_tax_expense_benefit_deferred\": {\"value\": -2931000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 48888000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"basic_earnings_per_share\": {\"value\": 17.27, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"benefits_costs_expenses\": {\"value\": 30886000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"basic_average_shares\": {\"value\": 7402000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 42597000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 42597000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"net_income_loss\": {\"value\": 42597000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"research_and_development\": {\"value\": 9519000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"operating_expenses\": {\"value\": 12319000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"net_income_loss_attributable_to_parent\": {\"value\": 42597000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"interest_expense_operating\": {\"value\": 255000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"costs_and_expenses\": {\"value\": 30886000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"cost_of_revenue\": {\"value\": 19715000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"diluted_average_shares\": {\"value\": 7482000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}}, \"comprehensive_income\": {\"comprehensive_income_loss\": {\"value\": 42538000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"other_comprehensive_income_loss\": {\"value\": -59000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 42538000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}}}}, {\"start_date\": \"2024-01-29\", \"end_date\": \"2024-04-28\", \"filing_date\": \"2024-05-29\", \"acceptance_datetime\": \"2024-05-29T20:36:32Z\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q1\", \"fiscal_year\": \"2025\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-24-000124\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-24-000124/files/nvda-20240428_htm.xml\", \"financials\": {\"balance_sheet\": {\"noncurrent_liabilities\": {\"value\": 12707000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"intangible_assets\": {\"value\": 986000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"other_noncurrent_liabilities\": {\"value\": 2997000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"fixed_assets\": {\"value\": 4006000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"long_term_debt\": {\"value\": 9710000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"current_assets\": {\"value\": 53729000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"inventory\": {\"value\": 5864000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"other_noncurrent_assets\": {\"value\": 18351000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"liabilities_and_equity\": {\"value\": 77072000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"other_current_liabilities\": {\"value\": 11869000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"wages\": {\"value\": 639000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"other_current_assets\": {\"value\": 47865000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"equity\": {\"value\": 49142000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"equity_attributable_to_parent\": {\"value\": 49142000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"noncurrent_assets\": {\"value\": 23343000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"liabilities\": {\"value\": 27930000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"accounts_payable\": {\"value\": 2715000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"assets\": {\"value\": 77072000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"current_liabilities\": {\"value\": 15223000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}}, \"cash_flow_statement\": {\"net_cash_flow_from_financing_activities_continuing\": {\"value\": -9345000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_continuing\": {\"value\": 307000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_investing_activities\": {\"value\": -5693000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_operating_activities\": {\"value\": 15345000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -5693000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow\": {\"value\": 307000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 15345000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_from_financing_activities\": {\"value\": -9345000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}}, \"income_statement\": {\"nonoperating_income_loss\": {\"value\": 370000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"basic_average_shares\": {\"value\": 2462000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"benefits_costs_expenses\": {\"value\": 8765000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"costs_and_expenses\": {\"value\": 8765000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 14881000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"income_tax_expense_benefit\": {\"value\": 2398000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 17279000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"selling_general_and_administrative_expenses\": {\"value\": 777000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"net_income_loss_attributable_to_parent\": {\"value\": 14881000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"diluted_earnings_per_share\": {\"value\": 5.98, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 14881000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"research_and_development\": {\"value\": 2720000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"cost_of_revenue\": {\"value\": 5638000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"net_income_loss\": {\"value\": 14881000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"gross_profit\": {\"value\": 20406000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"revenues\": {\"value\": 26044000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"interest_expense_operating\": {\"value\": 64000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"operating_income_loss\": {\"value\": 16909000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"operating_expenses\": {\"value\": 3497000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"income_tax_expense_benefit_deferred\": {\"value\": -1577000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"basic_earnings_per_share\": {\"value\": 6.04, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"diluted_average_shares\": {\"value\": 2489000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}}, \"comprehensive_income\": {\"comprehensive_income_loss\": {\"value\": 14745000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"other_comprehensive_income_loss\": {\"value\": -136000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 14745000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}}}}, {\"start_date\": \"2023-10-30\", \"end_date\": \"2024-01-28\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q4\", \"fiscal_year\": \"2024\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"financials\": {\"balance_sheet\": {\"current_assets\": {\"value\": 44345000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"inventory\": {\"value\": 5282000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"liabilities\": {\"value\": 22750000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"noncurrent_assets\": {\"value\": 21383000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"current_liabilities\": {\"value\": 10631000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"fixed_assets\": {\"value\": 3914000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"liabilities_and_equity\": {\"value\": 65728000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"equity\": {\"value\": 42978000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"other_current_assets\": {\"value\": 39063000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"equity_attributable_to_parent\": {\"value\": 42978000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"other_noncurrent_assets\": {\"value\": 16357000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"intangible_assets\": {\"value\": 1112000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"long_term_debt\": {\"value\": 9709000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"other_current_liabilities\": {\"value\": 7257000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"accounts_payable\": {\"value\": 2699000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"other_noncurrent_liabilities\": {\"value\": 2410000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"noncurrent_liabilities\": {\"value\": 12119000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"wages\": {\"value\": 675000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"assets\": {\"value\": 65728000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}}, \"cash_flow_statement\": {\"net_cash_flow\": {\"value\": 1761000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_investing_activities\": {\"value\": -6109000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_financing_activities\": {\"value\": -3629000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 11499000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_continuing\": {\"value\": 1761000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_operating_activities\": {\"value\": 11499000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -3629000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -6109000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}}, \"comprehensive_income\": {\"comprehensive_income_loss\": {\"value\": 12400000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"other_comprehensive_income_loss\": {\"value\": 115000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 12400000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}}, \"income_statement\": {\"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 14106000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"revenues\": {\"value\": 22103000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 12285000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"net_income_loss_attributable_to_parent\": {\"value\": 12285000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"costs_and_expenses\": {\"value\": 7997000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"gross_profit\": {\"value\": 16791000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"nonoperating_income_loss\": {\"value\": 492000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"net_income_loss\": {\"value\": 12285000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"diluted_average_shares\": {\"value\": 0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 12285000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"income_tax_expense_benefit\": {\"value\": 1821000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"operating_expenses\": {\"value\": 3177000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"basic_earnings_per_share\": {\"value\": 4.98, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"benefits_costs_expenses\": {\"value\": 7997000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"research_and_development\": {\"value\": 2465000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"cost_of_revenue\": {\"value\": 5312000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"basic_average_shares\": {\"value\": -1000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"diluted_earnings_per_share\": {\"value\": 4.92, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"operating_income_loss\": {\"value\": 13614000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"interest_expense_operating\": {\"value\": 63000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"income_tax_expense_benefit_deferred\": {\"value\": -78000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"selling_general_and_administrative_expenses\": {\"value\": 712000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}}}}, {\"start_date\": \"2023-01-30\", \"end_date\": \"2024-01-28\", \"filing_date\": \"2024-02-21\", \"acceptance_datetime\": \"2024-02-21T21:36:57Z\", \"timeframe\": \"annual\", \"fiscal_period\": \"FY\", \"fiscal_year\": \"2024\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-24-000029\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-24-000029/files/nvda-20240128_htm.xml\", \"financials\": {\"income_statement\": {\"cost_of_revenue\": {\"value\": 16621000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"gross_profit\": {\"value\": 44301000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"net_income_loss\": {\"value\": 29760000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"selling_general_and_administrative_expenses\": {\"value\": 2654000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 29760000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"basic_earnings_per_share\": {\"value\": 12.05, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"income_tax_expense_benefit_current\": {\"value\": 6547000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Current\", \"order\": 2300}, \"operating_expenses\": {\"value\": 11329000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 29760000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 33818000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"benefits_costs_expenses\": {\"value\": 27104000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"diluted_average_shares\": {\"value\": 2494000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"costs_and_expenses\": {\"value\": 27104000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"income_tax_expense_benefit_deferred\": {\"value\": -2489000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"operating_income_loss\": {\"value\": 32972000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"nonoperating_income_loss\": {\"value\": 846000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"net_income_loss_attributable_to_parent\": {\"value\": 29760000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"revenues\": {\"value\": 60922000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"income_tax_expense_benefit\": {\"value\": 4058000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"basic_average_shares\": {\"value\": 2469000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"interest_expense_operating\": {\"value\": 257000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"common_stock_dividends\": {\"value\": 0.16, \"unit\": \"USD / shares\", \"label\": \"Common Stock Dividends\", \"order\": 4600}, \"diluted_earnings_per_share\": {\"value\": 11.93, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"research_and_development\": {\"value\": 8675000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}}, \"cash_flow_statement\": {\"net_cash_flow_continuing\": {\"value\": 3891000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 28090000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_from_operating_activities\": {\"value\": 28090000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_financing_activities\": {\"value\": -13633000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow\": {\"value\": 3891000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_investing_activities\": {\"value\": -10566000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -13633000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -10566000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}}, \"balance_sheet\": {\"wages\": {\"value\": 675000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"noncurrent_assets\": {\"value\": 21383000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"current_liabilities\": {\"value\": 10631000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"other_noncurrent_liabilities\": {\"value\": 2410000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"other_current_assets\": {\"value\": 39063000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"equity\": {\"value\": 42978000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"intangible_assets\": {\"value\": 1112000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"assets\": {\"value\": 65728000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"equity_attributable_to_parent\": {\"value\": 42978000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"inventory\": {\"value\": 5282000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"fixed_assets\": {\"value\": 3914000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"liabilities_and_equity\": {\"value\": 65728000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"liabilities\": {\"value\": 22750000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"other_current_liabilities\": {\"value\": 7257000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"current_assets\": {\"value\": 44345000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"other_noncurrent_assets\": {\"value\": 16357000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"noncurrent_liabilities\": {\"value\": 12119000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"accounts_payable\": {\"value\": 2699000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"long_term_debt\": {\"value\": 9709000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 29830000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}, \"other_comprehensive_income_loss\": {\"value\": 70000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss\": {\"value\": 29830000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}}}}, {\"start_date\": \"2023-07-31\", \"end_date\": \"2023-10-29\", \"filing_date\": \"2023-11-21\", \"acceptance_datetime\": \"2023-11-21T21:36:29Z\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q3\", \"fiscal_year\": \"2024\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-23-000227\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-23-000227/files/nvda-20231029_htm.xml\", \"financials\": {\"balance_sheet\": {\"other_noncurrent_liabilities\": {\"value\": 2076000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"other_noncurrent_assets\": {\"value\": 16395000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"noncurrent_liabilities\": {\"value\": 11782000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"current_liabilities\": {\"value\": 9101000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"equity_attributable_to_parent\": {\"value\": 33265000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"inventory\": {\"value\": 4779000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"intangible_assets\": {\"value\": 1251000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"liabilities\": {\"value\": 20883000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"other_current_assets\": {\"value\": 27879000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"accounts_payable\": {\"value\": 2380000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"equity\": {\"value\": 33265000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"wages\": {\"value\": 516000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"other_current_liabilities\": {\"value\": 6205000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"liabilities_and_equity\": {\"value\": 54148000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"fixed_assets\": {\"value\": 3844000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"noncurrent_assets\": {\"value\": 21490000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"assets\": {\"value\": 54148000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"long_term_debt\": {\"value\": 9706000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"current_assets\": {\"value\": 32658000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}}, \"income_statement\": {\"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"diluted_earnings_per_share\": {\"value\": 3.71, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 9243000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 9243000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 10522000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"income_tax_expense_benefit_deferred\": {\"value\": -530000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"net_income_loss\": {\"value\": 9243000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"interest_expense_operating\": {\"value\": 63000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"benefits_costs_expenses\": {\"value\": 7598000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"income_tax_expense_benefit\": {\"value\": 1279000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"cost_of_revenue\": {\"value\": 4720000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"nonoperating_income_loss\": {\"value\": 105000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"basic_average_shares\": {\"value\": 2468000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"research_and_development\": {\"value\": 2294000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"basic_earnings_per_share\": {\"value\": 3.75, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"costs_and_expenses\": {\"value\": 7598000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"net_income_loss_attributable_to_parent\": {\"value\": 9243000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"operating_expenses\": {\"value\": 2983000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"selling_general_and_administrative_expenses\": {\"value\": 689000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"diluted_average_shares\": {\"value\": 2494000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"gross_profit\": {\"value\": 13400000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"revenues\": {\"value\": 18120000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"operating_income_loss\": {\"value\": 10417000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}}, \"cash_flow_statement\": {\"net_cash_flow_from_financing_activities_continuing\": {\"value\": -4525000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_financing_activities\": {\"value\": -4525000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -3170000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow\": {\"value\": -363000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 7332000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_from_investing_activities\": {\"value\": -3170000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_continuing\": {\"value\": -363000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_operating_activities\": {\"value\": 7332000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_parent\": {\"value\": 9206000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}, \"other_comprehensive_income_loss\": {\"value\": -37000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss\": {\"value\": 9206000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}}}}, {\"start_date\": \"2023-05-01\", \"end_date\": \"2023-07-30\", \"filing_date\": \"2023-08-28\", \"acceptance_datetime\": \"2023-08-25T23:36:34Z\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q2\", \"fiscal_year\": \"2024\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-23-000175\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-23-000175/files/nvda-20230730_htm.xml\", \"financials\": {\"income_statement\": {\"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"selling_general_and_administrative_expenses\": {\"value\": 622000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"income_tax_expense_benefit\": {\"value\": 793000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"income_tax_expense_benefit_deferred\": {\"value\": -746000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"diluted_earnings_per_share\": {\"value\": 2.48, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"revenues\": {\"value\": 13507000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"basic_earnings_per_share\": {\"value\": 2.5, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 6188000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"costs_and_expenses\": {\"value\": 6526000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"gross_profit\": {\"value\": 9462000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"net_income_loss_attributable_to_parent\": {\"value\": 6188000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 6981000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"operating_expenses\": {\"value\": 2662000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"basic_average_shares\": {\"value\": 2473000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"net_income_loss\": {\"value\": 6188000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"cost_of_revenue\": {\"value\": 4045000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"benefits_costs_expenses\": {\"value\": 6526000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"research_and_development\": {\"value\": 2040000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"operating_income_loss\": {\"value\": 6800000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"interest_expense_operating\": {\"value\": 65000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"nonoperating_income_loss\": {\"value\": 181000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"diluted_average_shares\": {\"value\": 2499000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 6188000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}}, \"balance_sheet\": {\"noncurrent_liabilities\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"wages\": {\"value\": 642000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"other_noncurrent_liabilities\": {\"value\": 2015000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"other_current_liabilities\": {\"value\": 7763000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"assets\": {\"value\": 49555000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"noncurrent_assets\": {\"value\": 20758000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"other_current_assets\": {\"value\": 24478000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"inventory\": {\"value\": 4319000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"liabilities\": {\"value\": 22054000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"liabilities_and_equity\": {\"value\": 49555000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"current_assets\": {\"value\": 28797000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"current_liabilities\": {\"value\": 10334000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"long_term_debt\": {\"value\": 9705000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"intangible_assets\": {\"value\": 1395000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"other_noncurrent_assets\": {\"value\": 15564000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"fixed_assets\": {\"value\": 3799000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"equity_attributable_to_parent\": {\"value\": 27501000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"equity\": {\"value\": 27501000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"accounts_payable\": {\"value\": 1929000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"other_comprehensive_income_loss\": {\"value\": -1000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss\": {\"value\": 6187000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 6187000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}}, \"cash_flow_statement\": {\"net_cash_flow_from_investing_activities_continuing\": {\"value\": -446000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow_from_operating_activities\": {\"value\": 6348000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -5099000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_financing_activities\": {\"value\": -5099000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow\": {\"value\": 803000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 6348000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_continuing\": {\"value\": 803000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_investing_activities\": {\"value\": -446000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}}}}, {\"start_date\": \"2023-01-30\", \"end_date\": \"2023-04-30\", \"filing_date\": \"2023-05-26\", \"acceptance_datetime\": \"2023-05-26T20:17:32Z\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q1\", \"fiscal_year\": \"2024\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-23-000093\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-23-000093/files/nvda-20230430_htm.xml\", \"financials\": {\"balance_sheet\": {\"noncurrent_liabilities\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"inventory\": {\"value\": 4611000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"current_assets\": {\"value\": 24883000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"liabilities_and_equity\": {\"value\": 44460000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"assets\": {\"value\": 44460000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"noncurrent_assets\": {\"value\": 19577000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"wages\": {\"value\": 320000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"equity_attributable_to_parent\": {\"value\": 24520000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"other_current_assets\": {\"value\": 20272000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"intangible_assets\": {\"value\": 1541000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"other_noncurrent_liabilities\": {\"value\": 1726000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"other_current_liabilities\": {\"value\": 5799000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"fixed_assets\": {\"value\": 3740000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"accounts_payable\": {\"value\": 1141000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"other_noncurrent_assets\": {\"value\": 14296000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"current_liabilities\": {\"value\": 7260000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"equity\": {\"value\": 24520000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"liabilities\": {\"value\": 19940000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"long_term_debt\": {\"value\": 10954000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}}, \"cash_flow_statement\": {\"net_cash_flow_from_operating_activities_continuing\": {\"value\": 2911000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -841000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow_from_financing_activities\": {\"value\": -380000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow_from_operating_activities\": {\"value\": 2911000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_investing_activities\": {\"value\": -841000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow\": {\"value\": 1690000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -380000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_continuing\": {\"value\": 1690000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}}, \"income_statement\": {\"diluted_earnings_per_share\": {\"value\": 0.82, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"net_income_loss_attributable_to_parent\": {\"value\": 2043000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"diluted_average_shares\": {\"value\": 2490000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"interest_expense_operating\": {\"value\": 66000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"gross_profit\": {\"value\": 4648000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"basic_average_shares\": {\"value\": 2470000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"selling_general_and_administrative_expenses\": {\"value\": 633000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"revenues\": {\"value\": 7192000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 2043000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 2209000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"benefits_costs_expenses\": {\"value\": 4983000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"operating_expenses\": {\"value\": 2508000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 2043000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"basic_earnings_per_share\": {\"value\": 0.83, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"research_and_development\": {\"value\": 1875000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"nonoperating_income_loss\": {\"value\": 69000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"operating_income_loss\": {\"value\": 2140000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"cost_of_revenue\": {\"value\": 2544000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"income_tax_expense_benefit\": {\"value\": 166000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"costs_and_expenses\": {\"value\": 4983000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"net_income_loss\": {\"value\": 2043000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"income_tax_expense_benefit_deferred\": {\"value\": -1135000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_parent\": {\"value\": 2036000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}, \"other_comprehensive_income_loss\": {\"value\": -7000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss\": {\"value\": 2036000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}}}}, {\"start_date\": \"2022-10-31\", \"end_date\": \"2023-01-29\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q4\", \"fiscal_year\": \"2023\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"financials\": {\"cash_flow_statement\": {\"net_cash_flow_from_operating_activities\": {\"value\": 2248000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -1656000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_financing_activities\": {\"value\": -1656000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow_from_investing_activities\": {\"value\": -3000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 2248000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow\": {\"value\": 589000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": -3000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow_continuing\": {\"value\": 589000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}}, \"comprehensive_income\": {\"comprehensive_income_loss\": {\"value\": 1494000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 1494000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}, \"other_comprehensive_income_loss\": {\"value\": 80000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}}, \"balance_sheet\": {\"liabilities\": {\"value\": 19081000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"other_current_assets\": {\"value\": 17914000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"current_assets\": {\"value\": 23073000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"wages\": {\"value\": 530000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"noncurrent_assets\": {\"value\": 18109000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"other_current_liabilities\": {\"value\": 4840000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"fixed_assets\": {\"value\": 3807000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"equity_attributable_to_parent\": {\"value\": 22101000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"noncurrent_liabilities\": {\"value\": 12518000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"current_liabilities\": {\"value\": 6563000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"assets\": {\"value\": 41182000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"equity\": {\"value\": 22101000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"inventory\": {\"value\": 5159000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"long_term_debt\": {\"value\": 10953000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"liabilities_and_equity\": {\"value\": 41182000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"accounts_payable\": {\"value\": 1193000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"other_noncurrent_assets\": {\"value\": 12626000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"other_noncurrent_liabilities\": {\"value\": 1565000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"intangible_assets\": {\"value\": 1676000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}}, \"income_statement\": {\"nonoperating_income_loss\": {\"value\": 32000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"interest_expense_operating\": {\"value\": 64000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"research_and_development\": {\"value\": 1952000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"net_income_loss\": {\"value\": 1414000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"selling_general_and_administrative_expenses\": {\"value\": 625000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"operating_income_loss\": {\"value\": 1256000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"operating_expenses\": {\"value\": 2577000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"other_operating_expenses\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Other Operating Expenses\", \"order\": 1040}, \"benefits_costs_expenses\": {\"value\": 4763000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 1288000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"basic_earnings_per_share\": {\"value\": 0.5800000000000001, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"revenues\": {\"value\": 6051000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"income_tax_expense_benefit_deferred\": {\"value\": -647000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"gross_profit\": {\"value\": 3833000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"diluted_earnings_per_share\": {\"value\": 0.5700000000000001, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"costs_and_expenses\": {\"value\": 4763000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"net_income_loss_attributable_to_parent\": {\"value\": 1414000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"cost_of_revenue\": {\"value\": 2218000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"basic_average_shares\": {\"value\": -8000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 1414000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 1414000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"diluted_average_shares\": {\"value\": -10000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"income_tax_expense_benefit\": {\"value\": -126000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}}}}, {\"start_date\": \"2022-01-31\", \"end_date\": \"2023-01-29\", \"filing_date\": \"2023-02-24\", \"timeframe\": \"annual\", \"fiscal_period\": \"FY\", \"fiscal_year\": \"2023\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-23-000017\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-23-000017/files/nvda-20230129_htm.xml\", \"financials\": {\"income_statement\": {\"nonoperating_income_loss\": {\"value\": -43000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"other_operating_expenses\": {\"value\": 1353000000.0, \"unit\": \"USD\", \"label\": \"Other Operating Expenses\", \"order\": 1040}, \"common_stock_dividends\": {\"value\": 0.16, \"unit\": \"USD / shares\", \"label\": \"Common Stock Dividends\", \"order\": 4600}, \"revenues\": {\"value\": 26974000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}, \"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"operating_expenses\": {\"value\": 11132000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 4368000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"cost_of_revenue\": {\"value\": 11618000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"costs_and_expenses\": {\"value\": 22793000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"interest_expense_operating\": {\"value\": 262000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"research_and_development\": {\"value\": 7339000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"net_income_loss\": {\"value\": 4368000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"operating_income_loss\": {\"value\": 4224000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"diluted_earnings_per_share\": {\"value\": 1.74, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 4368000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 4181000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"income_tax_expense_benefit_current\": {\"value\": 1977000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Current\", \"order\": 2300}, \"basic_earnings_per_share\": {\"value\": 1.76, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"selling_general_and_administrative_expenses\": {\"value\": 2440000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"income_tax_expense_benefit\": {\"value\": -187000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"basic_average_shares\": {\"value\": 2487000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"income_tax_expense_benefit_deferred\": {\"value\": -2164000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"gross_profit\": {\"value\": 15356000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"net_income_loss_attributable_to_parent\": {\"value\": 4368000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"benefits_costs_expenses\": {\"value\": 22793000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"diluted_average_shares\": {\"value\": 2507000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}}, \"balance_sheet\": {\"other_noncurrent_liabilities\": {\"value\": 1565000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"noncurrent_assets\": {\"value\": 18109000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"long_term_debt\": {\"value\": 10953000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"equity\": {\"value\": 22101000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"wages\": {\"value\": 530000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"other_current_assets\": {\"value\": 17914000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"other_current_liabilities\": {\"value\": 4840000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"intangible_assets\": {\"value\": 1676000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"other_noncurrent_assets\": {\"value\": 12626000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"accounts_payable\": {\"value\": 1193000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"inventory\": {\"value\": 5159000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"liabilities\": {\"value\": 19081000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"fixed_assets\": {\"value\": 3807000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"liabilities_and_equity\": {\"value\": 41182000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}, \"current_liabilities\": {\"value\": 6563000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"current_assets\": {\"value\": 23073000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"assets\": {\"value\": 41182000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"noncurrent_liabilities\": {\"value\": 12518000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"equity_attributable_to_parent\": {\"value\": 22101000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"other_comprehensive_income_loss\": {\"value\": -32000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}, \"comprehensive_income_loss\": {\"value\": 4336000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 4336000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}}, \"cash_flow_statement\": {\"net_cash_flow_from_financing_activities\": {\"value\": -11617000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow\": {\"value\": 1399000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_continuing\": {\"value\": 1399000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}, \"net_cash_flow_from_financing_activities_continuing\": {\"value\": -11617000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_investing_activities\": {\"value\": 7375000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_operating_activities\": {\"value\": 5641000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 5641000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": 7375000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}}}}, {\"start_date\": \"2022-08-01\", \"end_date\": \"2022-10-30\", \"filing_date\": \"2022-11-18\", \"timeframe\": \"quarterly\", \"fiscal_period\": \"Q3\", \"fiscal_year\": \"2023\", \"cik\": \"0001045810\", \"sic\": \"3674\", \"tickers\": [\"NVDA\"], \"company_name\": \"NVIDIA CORP\", \"source_filing_url\": \"https://api.polygon.io/v1/reference/sec/filings/0001045810-22-000166\", \"source_filing_file_url\": \"http://api.polygon.io/v1/reference/sec/filings/0001045810-22-000166/files/nvda-20221030_htm.xml\", \"financials\": {\"balance_sheet\": {\"equity\": {\"value\": 21349000000.0, \"unit\": \"USD\", \"label\": \"Equity\", \"order\": 1400}, \"long_term_debt\": {\"value\": 10950000000.0, \"unit\": \"USD\", \"label\": \"Long-term Debt\", \"order\": 810}, \"other_current_assets\": {\"value\": 18769000000.0, \"unit\": \"USD\", \"label\": \"Other Current Assets\", \"order\": 250}, \"current_liabilities\": {\"value\": 6855000000.0, \"unit\": \"USD\", \"label\": \"Current Liabilities\", \"order\": 700}, \"fixed_assets\": {\"value\": 3774000000.0, \"unit\": \"USD\", \"label\": \"Fixed Assets\", \"order\": 320}, \"equity_attributable_to_parent\": {\"value\": 21349000000.0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Parent\", \"order\": 1600}, \"other_noncurrent_liabilities\": {\"value\": 1334000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Liabilities\", \"order\": 820}, \"other_noncurrent_assets\": {\"value\": 11641000000.0, \"unit\": \"USD\", \"label\": \"Other Non-current Assets\", \"order\": 350}, \"wages\": {\"value\": 307000000.0, \"unit\": \"USD\", \"label\": \"Wages\", \"order\": 730}, \"assets\": {\"value\": 40488000000.0, \"unit\": \"USD\", \"label\": \"Assets\", \"order\": 100}, \"current_assets\": {\"value\": 23223000000.0, \"unit\": \"USD\", \"label\": \"Current Assets\", \"order\": 200}, \"noncurrent_liabilities\": {\"value\": 12284000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Liabilities\", \"order\": 800}, \"other_current_liabilities\": {\"value\": 5057000000.0, \"unit\": \"USD\", \"label\": \"Other Current Liabilities\", \"order\": 740}, \"inventory\": {\"value\": 4454000000.0, \"unit\": \"USD\", \"label\": \"Inventory\", \"order\": 230}, \"liabilities\": {\"value\": 19139000000.0, \"unit\": \"USD\", \"label\": \"Liabilities\", \"order\": 600}, \"intangible_assets\": {\"value\": 1850000000.0, \"unit\": \"USD\", \"label\": \"Intangible Assets\", \"order\": 330}, \"accounts_payable\": {\"value\": 1491000000.0, \"unit\": \"USD\", \"label\": \"Accounts Payable\", \"order\": 710}, \"noncurrent_assets\": {\"value\": 17265000000.0, \"unit\": \"USD\", \"label\": \"Noncurrent Assets\", \"order\": 300}, \"liabilities_and_equity\": {\"value\": 40488000000.0, \"unit\": \"USD\", \"label\": \"Liabilities And Equity\", \"order\": 1900}, \"equity_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Equity Attributable To Noncontrolling Interest\", \"order\": 1500}}, \"comprehensive_income\": {\"comprehensive_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Noncontrolling Interest\", \"order\": 200}, \"comprehensive_income_loss\": {\"value\": 647000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss\", \"order\": 100}, \"comprehensive_income_loss_attributable_to_parent\": {\"value\": 647000000.0, \"unit\": \"USD\", \"label\": \"Comprehensive Income/Loss Attributable To Parent\", \"order\": 300}, \"other_comprehensive_income_loss\": {\"value\": -33000000.0, \"unit\": \"USD\", \"label\": \"Other Comprehensive Income/Loss\", \"order\": 400}}, \"cash_flow_statement\": {\"net_cash_flow_from_financing_activities_continuing\": {\"value\": -3753000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities, Continuing\", \"order\": 800}, \"net_cash_flow_from_investing_activities\": {\"value\": 3148000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities\", \"order\": 400}, \"net_cash_flow_from_investing_activities_continuing\": {\"value\": 3148000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Investing Activities, Continuing\", \"order\": 500}, \"net_cash_flow_from_operating_activities_continuing\": {\"value\": 392000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities, Continuing\", \"order\": 200}, \"net_cash_flow\": {\"value\": -213000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow\", \"order\": 1100}, \"net_cash_flow_from_operating_activities\": {\"value\": 392000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Operating Activities\", \"order\": 100}, \"net_cash_flow_from_financing_activities\": {\"value\": -3753000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow From Financing Activities\", \"order\": 700}, \"net_cash_flow_continuing\": {\"value\": -213000000.0, \"unit\": \"USD\", \"label\": \"Net Cash Flow, Continuing\", \"order\": 1200}}, \"income_statement\": {\"participating_securities_distributed_and_undistributed_earnings_loss_basic\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Participating Securities, Distributed And Undistributed Earnings/Loss, Basic\", \"order\": 3800}, \"basic_average_shares\": {\"value\": 2483000000.0, \"unit\": \"shares\", \"label\": \"Basic Average Shares\", \"order\": 4400}, \"selling_general_and_administrative_expenses\": {\"value\": 631000000.0, \"unit\": \"USD\", \"label\": \"Selling, General, and Administrative Expenses\", \"order\": 1010}, \"cost_of_revenue\": {\"value\": 2754000000.0, \"unit\": \"USD\", \"label\": \"Cost Of Revenue\", \"order\": 300}, \"operating_expenses\": {\"value\": 2576000000.0, \"unit\": \"USD\", \"label\": \"Operating Expenses\", \"order\": 1000}, \"net_income_loss_attributable_to_noncontrolling_interest\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Noncontrolling Interest\", \"order\": 3300}, \"other_operating_expenses\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Other Operating Expenses\", \"order\": 1040}, \"income_loss_from_continuing_operations_before_tax\": {\"value\": 613000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations Before Tax\", \"order\": 1500}, \"costs_and_expenses\": {\"value\": 5318000000.0, \"unit\": \"USD\", \"label\": \"Costs And Expenses\", \"order\": 600}, \"net_income_loss\": {\"value\": 680000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss\", \"order\": 3200}, \"operating_income_loss\": {\"value\": 601000000.0, \"unit\": \"USD\", \"label\": \"Operating Income/Loss\", \"order\": 1100}, \"income_tax_expense_benefit\": {\"value\": -67000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit\", \"order\": 2200}, \"income_tax_expense_benefit_deferred\": {\"value\": -532000000.0, \"unit\": \"USD\", \"label\": \"Income Tax Expense/Benefit, Deferred\", \"order\": 2400}, \"diluted_earnings_per_share\": {\"value\": 0.27, \"unit\": \"USD / shares\", \"label\": \"Diluted Earnings Per Share\", \"order\": 4300}, \"interest_expense_operating\": {\"value\": 65000000.0, \"unit\": \"USD\", \"label\": \"Interest Expense, Operating\", \"order\": 2700}, \"research_and_development\": {\"value\": 1945000000.0, \"unit\": \"USD\", \"label\": \"Research and Development\", \"order\": 1030}, \"income_loss_from_continuing_operations_after_tax\": {\"value\": 680000000.0, \"unit\": \"USD\", \"label\": \"Income/Loss From Continuing Operations After Tax\", \"order\": 1400}, \"net_income_loss_available_to_common_stockholders_basic\": {\"value\": 680000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Available To Common Stockholders, Basic\", \"order\": 3700}, \"gross_profit\": {\"value\": 3177000000.0, \"unit\": \"USD\", \"label\": \"Gross Profit\", \"order\": 800}, \"nonoperating_income_loss\": {\"value\": 12000000.0, \"unit\": \"USD\", \"label\": \"Nonoperating Income/Loss\", \"order\": 900}, \"diluted_average_shares\": {\"value\": 2499000000.0, \"unit\": \"shares\", \"label\": \"Diluted Average Shares\", \"order\": 4500}, \"preferred_stock_dividends_and_other_adjustments\": {\"value\": 0, \"unit\": \"USD\", \"label\": \"Preferred Stock Dividends And Other Adjustments\", \"order\": 3900}, \"net_income_loss_attributable_to_parent\": {\"value\": 680000000.0, \"unit\": \"USD\", \"label\": \"Net Income/Loss Attributable To Parent\", \"order\": 3500}, \"benefits_costs_expenses\": {\"value\": 5318000000.0, \"unit\": \"USD\", \"label\": \"Benefits Costs and Expenses\", \"order\": 200}, \"basic_earnings_per_share\": {\"value\": 0.27, \"unit\": \"USD / shares\", \"label\": \"Basic Earnings Per Share\", \"order\": 4200}, \"revenues\": {\"value\": 5931000000.0, \"unit\": \"USD\", \"label\": \"Revenues\", \"order\": 100}}}}]\n",
      "\n",
      "Tool Call - Name: get_date + Query: {}\n",
      "Tool Response: 2024-07-19\n",
      "\n",
      "Tool Call - Name: polygon_aggregates + Query: {\"ticker\":\"NVDA\",\"timespan\":\"day\",\"timespan_multiplier\":1,\"from_date\":\"2024-07-19\",\"to_date\":\"2024-07-19\"}\n",
      "Tool Response: [{\"v\": 148930435.0, \"vw\": 119.4135, \"o\": 120.35, \"c\": 118.22, \"h\": 121.6, \"l\": 117.37, \"t\": 1721361600000, \"n\": 1226882}]\n",
      "\n",
      "Agent Response: ### Step 8: Compare Intrinsic Value with Current Market Price\n",
      "\n",
      "- **Intrinsic Value per Share**: $464.8\n",
      "- **Current Market Price**: $118.22\n",
      "\n",
      "### Step 9: Calculate Valuation Percentage\n",
      "\n",
      "Let's calculate how overvalued or undervalued Nvidia stock is by comparing the intrinsic value with the current market price.\n",
      "\n",
      "\\[ \\text{Valuation Percentage} = \\frac{\\text{Intrinsic Value} - \\text{Current Market Price}}{\\text{Intrinsic Value}} \\]\n",
      "\n",
      "\\[ \\text{Valuation Percentage} = \\frac{464.8 - 118.22}{464.8} \\]\n",
      "\n",
      "\\[ \\text{Valuation Percentage} = \\frac{346.58}{464.8} \\]\n",
      "\n",
      "\\[ \\text{Valuation Percentage} = 0.7455 \\text{ or } 74.55\\% \\]\n",
      "\n",
      "### Conclusion\n",
      "\n",
      "Nvidia stock appears to be **undervalued** by approximately **74.55%** based on the DCF analysis. The intrinsic value per share is $464.8, while the current market price is $118.22.\n"
     ]
    }
   ],
   "source": [
    "from langchain_core.messages import HumanMessage\n",
    "\n",
    "inputs = {\"messages\" : [HumanMessage(content=\"Can you perform a DCF analysis of Nvidia stock? Please list out each step of the calculation.\")]}\n",
    "\n",
    "messages = app.invoke(inputs)\n",
    "\n",
    "print_messages(messages)\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "venv",
   "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.11.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}