finance-query 3.3.0

A Rust library for querying financial data
Documentation
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
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
3264
3265
3266
3267
3268
3269
3270
3271
3272
3273
3274
3275
3276
3277
3278
3279
3280
3281
3282
3283
3284
3285
3286
3287
3288
3289
3290
3291
3292
3293
3294
3295
3296
3297
3298
3299
3300
3301
3302
3303
3304
3305
3306
3307
3308
3309
3310
3311
3312
3313
3314
3315
3316
3317
3318
3319
3320
3321
3322
3323
3324
3325
3326
3327
3328
3329
3330
3331
3332
3333
3334
3335
3336
3337
3338
3339
3340
3341
3342
3343
3344
3345
3346
3347
3348
3349
3350
3351
3352
3353
3354
3355
3356
3357
3358
3359
3360
3361
3362
3363
3364
3365
3366
3367
3368
3369
3370
3371
3372
3373
3374
3375
3376
3377
3378
3379
3380
3381
3382
3383
3384
3385
3386
3387
3388
3389
3390
3391
3392
3393
3394
3395
3396
3397
3398
3399
3400
3401
3402
3403
3404
3405
3406
3407
3408
3409
3410
3411
3412
3413
3414
3415
3416
3417
3418
3419
3420
3421
3422
3423
3424
3425
3426
3427
3428
3429
3430
3431
3432
3433
3434
3435
3436
3437
3438
3439
3440
3441
3442
3443
3444
3445
3446
3447
3448
3449
3450
3451
3452
3453
3454
3455
3456
3457
3458
3459
3460
3461
3462
3463
3464
3465
3466
3467
3468
3469
3470
3471
3472
3473
3474
3475
3476
3477
3478
3479
3480
3481
3482
3483
3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
3500
3501
3502
3503
3504
3505
3506
3507
3508
3509
3510
3511
3512
3513
3514
3515
3516
3517
3518
3519
3520
3521
3522
3523
3524
3525
3526
3527
3528
3529
3530
3531
3532
3533
3534
3535
3536
3537
3538
3539
3540
3541
3542
3543
3544
3545
3546
3547
3548
3549
3550
3551
3552
3553
3554
3555
3556
3557
3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
3569
3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
3583
3584
3585
3586
3587
3588
3589
3590
3591
3592
3593
3594
3595
3596
3597
3598
3599
3600
3601
3602
3603
3604
3605
3606
3607
3608
3609
3610
3611
3612
3613
3614
# Code generated by `cargo soothfast sdk gen`. DO NOT EDIT.
"""Wire models for finance-query."""
from __future__ import annotations

import dataclasses
import typing


@dataclasses.dataclass(frozen=True)
class BacktestRequest:
    """Request body for `POST /v2/backtest/{symbol}`."""

    strategy: str
    equity_cursor: str | None = None
    equity_limit: int | None = None
    fields: str | None = None
    interval: Interval | None = None
    params: GqlBacktestParams | None = None
    range: TimeRange | None = None
    trades_cursor: str | None = None
    trades_limit: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "equity_cursor": "equityCursor",
        "equity_limit": "equityLimit",
        "trades_cursor": "tradesCursor",
        "trades_limit": "tradesLimit",
    }


@dataclasses.dataclass(frozen=True)
class CustomScreenerRequest:
    """Request body for `POST /v2/screeners/custom`."""

    fields: str | None = None
    filters: list[FilterCondition] | None = None
    format: ValueFormat | None = None
    offset: int | None = None
    quote_type: QuoteType | None = None
    size: int | None = None
    sort_field: str | None = None
    sort_type: SortType | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "quote_type": "quoteType",
        "sort_field": "sortField",
        "sort_type": "sortType",
    }


@dataclasses.dataclass(frozen=True)
class FilterCondition:
    """A single custom-screener filter condition."""

    field: str
    operator: str
    value: typing.Any


@dataclasses.dataclass(frozen=True)
class GqlAroonData:
    aroon_down: float | None = None
    aroon_up: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "aroon_down": "aroonDown",
        "aroon_up": "aroonUp",
    }


@dataclasses.dataclass(frozen=True)
class GqlBacktestMetrics:
    """Performance summary over the whole run."""

    annualized_return_pct: float
    avg_loss_duration: float
    avg_loss_pct: float
    avg_trade_duration: float
    avg_trade_return_pct: float
    avg_win_duration: float
    avg_win_pct: float
    calmar_ratio: float
    executed_signals: int
    expectancy: float
    kelly_criterion: float
    largest_loss: float
    largest_win: float
    long_trades: int
    losing_trades: int
    max_consecutive_losses: int
    max_consecutive_wins: int
    max_drawdown_duration: int
    max_drawdown_pct: float
    max_idle_period: int
    omega_ratio: float
    profit_factor: float
    recovery_factor: float
    serenity_ratio: float
    sharpe_ratio: float
    short_trades: int
    sortino_ratio: float
    sqn: float
    tail_ratio: float
    time_in_market_pct: float
    total_commission: float
    total_dividend_income: float
    total_financing_cost: float
    total_return_pct: float
    total_signals: int
    total_trades: int
    ulcer_index: float
    win_rate: float
    winning_trades: int

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "annualized_return_pct": "annualizedReturnPct",
        "avg_loss_duration": "avgLossDuration",
        "avg_loss_pct": "avgLossPct",
        "avg_trade_duration": "avgTradeDuration",
        "avg_trade_return_pct": "avgTradeReturnPct",
        "avg_win_duration": "avgWinDuration",
        "avg_win_pct": "avgWinPct",
        "calmar_ratio": "calmarRatio",
        "executed_signals": "executedSignals",
        "kelly_criterion": "kellyCriterion",
        "largest_loss": "largestLoss",
        "largest_win": "largestWin",
        "long_trades": "longTrades",
        "losing_trades": "losingTrades",
        "max_consecutive_losses": "maxConsecutiveLosses",
        "max_consecutive_wins": "maxConsecutiveWins",
        "max_drawdown_duration": "maxDrawdownDuration",
        "max_drawdown_pct": "maxDrawdownPct",
        "max_idle_period": "maxIdlePeriod",
        "omega_ratio": "omegaRatio",
        "profit_factor": "profitFactor",
        "recovery_factor": "recoveryFactor",
        "serenity_ratio": "serenityRatio",
        "sharpe_ratio": "sharpeRatio",
        "short_trades": "shortTrades",
        "sortino_ratio": "sortinoRatio",
        "tail_ratio": "tailRatio",
        "time_in_market_pct": "timeInMarketPct",
        "total_commission": "totalCommission",
        "total_dividend_income": "totalDividendIncome",
        "total_financing_cost": "totalFinancingCost",
        "total_return_pct": "totalReturnPct",
        "total_signals": "totalSignals",
        "total_trades": "totalTrades",
        "ulcer_index": "ulcerIndex",
        "win_rate": "winRate",
        "winning_trades": "winningTrades",
    }


@dataclasses.dataclass(frozen=True)
class GqlBacktestParams:
    """Strategy and execution knobs. Every field falls back to the library default."""

    allow_short: bool | None = None
    commission_pct: float | None = None
    exit_at_middle: bool | None = None
    fast_period: int | None = None
    initial_capital: float | None = None
    maintenance_margin_pct: float | None = None
    margin_interest_rate: float | None = None
    max_leverage: float | None = None
    multiplier: float | None = None
    overbought: float | None = None
    oversold: float | None = None
    period: int | None = None
    position_size_pct: float | None = None
    short_borrow_rate: float | None = None
    signal_period: int | None = None
    slippage_pct: float | None = None
    slow_period: int | None = None
    std_dev: float | None = None
    stop_loss_pct: float | None = None
    take_profit_pct: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "allow_short": "allowShort",
        "commission_pct": "commissionPct",
        "exit_at_middle": "exitAtMiddle",
        "fast_period": "fastPeriod",
        "initial_capital": "initialCapital",
        "maintenance_margin_pct": "maintenanceMarginPct",
        "margin_interest_rate": "marginInterestRate",
        "max_leverage": "maxLeverage",
        "position_size_pct": "positionSizePct",
        "short_borrow_rate": "shortBorrowRate",
        "signal_period": "signalPeriod",
        "slippage_pct": "slippagePct",
        "slow_period": "slowPeriod",
        "std_dev": "stdDev",
        "stop_loss_pct": "stopLossPct",
        "take_profit_pct": "takeProfitPct",
    }


@dataclasses.dataclass(frozen=True)
class GqlBacktestResult:
    """A completed backtest."""

    end_timestamp: int
    equity_curve: Page_GqlEquityPoint
    final_equity: float
    initial_capital: float
    max_leverage_used: float
    metrics: GqlBacktestMetrics
    start_timestamp: int
    strategy_name: str
    symbol: str
    trades: Page_GqlTrade
    diagnostics: list[str] | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "end_timestamp": "endTimestamp",
        "equity_curve": "equityCurve",
        "final_equity": "finalEquity",
        "initial_capital": "initialCapital",
        "max_leverage_used": "maxLeverageUsed",
        "start_timestamp": "startTimestamp",
        "strategy_name": "strategyName",
    }


@dataclasses.dataclass(frozen=True)
class GqlBatchError:
    """A single symbol's fetch failure within a batch root field."""

    message: str
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlBenchmarkPerformance:
    day_change_percent: float | None = None
    five_year_change_percent: float | None = None
    name: str | None = None
    one_year_change_percent: float | None = None
    three_year_change_percent: float | None = None
    ytd_change_percent: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "five_year_change_percent": "fiveYearChangePercent",
        "one_year_change_percent": "oneYearChangePercent",
        "three_year_change_percent": "threeYearChangePercent",
        "ytd_change_percent": "ytdChangePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlBollingerBandsData:
    lower: float | None = None
    middle: float | None = None
    upper: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlBullBearPowerData:
    bear_power: float | None = None
    bull_power: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "bear_power": "bearPower",
        "bull_power": "bullPower",
    }


@dataclasses.dataclass(frozen=True)
class GqlCalendarEvent:
    """A single upcoming financial event."""

    date: str
    event: GqlEventKind
    timestamp: int
    symbol: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlCandle:
    """A single OHLCV candle / price bar."""

    close: float
    high: float
    low: float
    open: float
    timestamp: int
    volume: int
    adj_close: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "adj_close": "adjClose",
    }


@dataclasses.dataclass(frozen=True)
class GqlCapitalGain:
    """A single capital gain distribution."""

    amount: float
    timestamp: int


@dataclasses.dataclass(frozen=True)
class GqlCapitalGainsBatch:
    """Result of the batch `capitalGainsBatch` root field: successfully fetched
capital gains histories plus any per-symbol fetch errors."""

    capital_gains: list[GqlSymbolCapitalGains]
    errors: list[GqlBatchError]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "capital_gains": "capitalGains",
    }


@dataclasses.dataclass(frozen=True)
class GqlChainAllocation:
    """One chain's share of a protocol's TVL."""

    chain: str
    tvl: float


@dataclasses.dataclass(frozen=True)
class GqlChart:
    """Historical chart data for a single symbol."""

    candles: Page_GqlCandle
    meta: GqlChartMeta
    symbol: str
    interval: str | None = None
    range: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlChartMeta:
    """Metadata associated with a chart response."""

    symbol: str
    chart_previous_close: float | None = None
    currency: str | None = None
    data_granularity: str | None = None
    exchange_name: str | None = None
    exchange_timezone_name: str | None = None
    fifty_two_week_high: float | None = None
    fifty_two_week_low: float | None = None
    first_trade_date: int | None = None
    full_exchange_name: str | None = None
    gmt_offset: int | None = None
    has_pre_post_market_data: bool | None = None
    instrument_type: str | None = None
    previous_close: float | None = None
    price_hint: int | None = None
    range: str | None = None
    regular_market_day_high: float | None = None
    regular_market_day_low: float | None = None
    regular_market_price: float | None = None
    regular_market_time: int | None = None
    regular_market_volume: int | None = None
    timezone: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "chart_previous_close": "chartPreviousClose",
        "data_granularity": "dataGranularity",
        "exchange_name": "exchangeName",
        "exchange_timezone_name": "exchangeTimezoneName",
        "fifty_two_week_high": "fiftyTwoWeekHigh",
        "fifty_two_week_low": "fiftyTwoWeekLow",
        "first_trade_date": "firstTradeDate",
        "full_exchange_name": "fullExchangeName",
        "gmt_offset": "gmtOffset",
        "has_pre_post_market_data": "hasPrePostMarketData",
        "instrument_type": "instrumentType",
        "previous_close": "previousClose",
        "price_hint": "priceHint",
        "regular_market_day_high": "regularMarketDayHigh",
        "regular_market_day_low": "regularMarketDayLow",
        "regular_market_price": "regularMarketPrice",
        "regular_market_time": "regularMarketTime",
        "regular_market_volume": "regularMarketVolume",
    }


@dataclasses.dataclass(frozen=True)
class GqlChartsBatch:
    """Result of the batch `charts` root field: successfully fetched charts plus
any per-symbol fetch errors."""

    charts: Page_GqlSymbolChart
    errors: list[GqlBatchError]


@dataclasses.dataclass(frozen=True)
class GqlCoinQuote:
    """A cryptocurrency quote from CoinGecko, mirroring `finance_query::CoinQuote`,
which has no serde rename of its own (plain snake_case JSON keys) — must
not rename for deserialization either, even though GraphQL field names
are camelCase."""

    id: str
    name: str
    symbol: str
    circulating_supply: float | None = None
    current_price: float | None = None
    image: str | None = None
    market_cap: float | None = None
    market_cap_rank: int | None = None
    price_change_percentage24_h: float | None = None
    total_volume: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "circulating_supply": "circulatingSupply",
        "current_price": "currentPrice",
        "market_cap": "marketCap",
        "market_cap_rank": "marketCapRank",
        "price_change_percentage24_h": "priceChangePercentage24H",
        "total_volume": "totalVolume",
    }


@dataclasses.dataclass(frozen=True)
class GqlCommitmentsOfTraders:
    """Mirrors `finance_query::cftc::CommitmentsOfTraders`."""

    cftc_contract_market_code: str
    market_and_exchange_name: str
    observations: Page_GqlCotObservation
    symbol: str

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "cftc_contract_market_code": "cftcContractMarketCode",
        "market_and_exchange_name": "marketAndExchangeName",
    }


@dataclasses.dataclass(frozen=True)
class GqlCommodityQuote:
    """Mirrors `finance_query::CommodityQuote`."""

    symbol: str
    change: float | None = None
    change_percent: float | None = None
    name: str | None = None
    price: float | None = None
    timestamp: int | None = None
    unit: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "change_percent": "changePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlCompanyProfile:
    """Mirrors `finance_query::CompanyProfile`, which has no serde rename of its
own — this deserializes snake_case keys while its GraphQL name stays
camelCase."""

    active: bool | None = None
    asset_type: str | None = None
    cik: str | None = None
    country: str | None = None
    currency: str | None = None
    cusip: str | None = None
    description: str | None = None
    exchange: str | None = None
    industry: str | None = None
    ipo_date: str | None = None
    is_adr: bool | None = None
    is_etf: bool | None = None
    is_fund: bool | None = None
    isin: str | None = None
    market_capitalization: float | None = None
    name: str | None = None
    provider_id: str | None = None
    sector: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_type": "assetType",
        "ipo_date": "ipoDate",
        "is_adr": "isAdr",
        "is_etf": "isEtf",
        "is_fund": "isFund",
        "market_capitalization": "marketCapitalization",
        "provider_id": "providerId",
    }


@dataclasses.dataclass(frozen=True)
class GqlCongressionalTrade:
    """Mirrors `finance_query::CongressionalTrade`, which has no serde rename of
its own — this deserializes snake_case keys while its GraphQL name stays
camelCase."""

    amount: str | None = None
    asset_description: str | None = None
    disclosure_date: str | None = None
    district: str | None = None
    first_name: str | None = None
    last_name: str | None = None
    link: str | None = None
    office: str | None = None
    symbol: str | None = None
    trade_type: str | None = None
    transaction_date: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_description": "assetDescription",
        "disclosure_date": "disclosureDate",
        "first_name": "firstName",
        "last_name": "lastName",
        "trade_type": "tradeType",
        "transaction_date": "transactionDate",
    }


@dataclasses.dataclass(frozen=True)
class GqlCotObservation:
    """Mirrors `finance_query::cftc::CotObservation` — one weekly report row,
broken down by trader category."""

    report_date: str
    managed_money_long: int | None = None
    managed_money_short: int | None = None
    managed_money_spread: int | None = None
    nonreportable_long: int | None = None
    nonreportable_short: int | None = None
    open_interest: int | None = None
    other_reportable_long: int | None = None
    other_reportable_short: int | None = None
    other_reportable_spread: int | None = None
    producer_merchant_long: int | None = None
    producer_merchant_short: int | None = None
    swap_dealer_long: int | None = None
    swap_dealer_short: int | None = None
    swap_dealer_spread: int | None = None
    total_reportable_long: int | None = None
    total_reportable_short: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "managed_money_long": "managedMoneyLong",
        "managed_money_short": "managedMoneyShort",
        "managed_money_spread": "managedMoneySpread",
        "nonreportable_long": "nonreportableLong",
        "nonreportable_short": "nonreportableShort",
        "open_interest": "openInterest",
        "other_reportable_long": "otherReportableLong",
        "other_reportable_short": "otherReportableShort",
        "other_reportable_spread": "otherReportableSpread",
        "producer_merchant_long": "producerMerchantLong",
        "producer_merchant_short": "producerMerchantShort",
        "report_date": "reportDate",
        "swap_dealer_long": "swapDealerLong",
        "swap_dealer_short": "swapDealerShort",
        "swap_dealer_spread": "swapDealerSpread",
        "total_reportable_long": "totalReportableLong",
        "total_reportable_short": "totalReportableShort",
    }


@dataclasses.dataclass(frozen=True)
class GqlCurrency:
    """A currency pair supported by Yahoo Finance."""

    local_long_name: str | None = None
    long_name: str | None = None
    short_name: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "local_long_name": "localLongName",
        "long_name": "longName",
        "short_name": "shortName",
    }


@dataclasses.dataclass(frozen=True)
class GqlDividend:
    """A single dividend payment."""

    amount: float
    timestamp: int


@dataclasses.dataclass(frozen=True)
class GqlDividendAnalytics:
    """Computed dividend analytics."""

    average_payment: float
    payment_count: int
    total_paid: float
    cagr: float | None = None
    first_payment: GqlDividend | None = None
    last_payment: GqlDividend | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "average_payment": "averagePayment",
        "first_payment": "firstPayment",
        "last_payment": "lastPayment",
        "payment_count": "paymentCount",
        "total_paid": "totalPaid",
    }


@dataclasses.dataclass(frozen=True)
class GqlDividends:
    """Dividends response: payment history + computed analytics."""

    analytics: GqlDividendAnalytics
    dividends: Page_GqlDividend


@dataclasses.dataclass(frozen=True)
class GqlDividendsBatch:
    """Result of the batch `dividendsBatch` root field: successfully fetched
dividend histories plus any per-symbol fetch errors."""

    dividends: Page_GqlSymbolDividends
    errors: list[GqlBatchError]


@dataclasses.dataclass(frozen=True)
class GqlDonchianChannelsData:
    lower: float | None = None
    middle: float | None = None
    upper: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlEarningsSurprise:
    actual_eps: float | None = None
    date: str | None = None
    estimated_eps: float | None = None
    surprise: float | None = None
    surprise_percent: float | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "actual_eps": "actualEps",
        "estimated_eps": "estimatedEps",
        "surprise_percent": "surprisePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlEarningsSurpriseHistory:
    surprises: list[GqlEarningsSurprise]


@dataclasses.dataclass(frozen=True)
class GqlEarningsTranscript:
    text: str
    date: str | None = None
    quarter: str | None = None
    symbol: str | None = None
    year: int | None = None


@dataclasses.dataclass(frozen=True)
class GqlEdgarCik:
    """Result of resolving a ticker symbol to its SEC CIK number."""

    cik: int
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlEdgarFiling:
    accession_number: str
    filing_date: str
    form: str
    primary_doc_description: str
    primary_document: str
    report_date: str
    size: int

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "accession_number": "accessionNumber",
        "filing_date": "filingDate",
        "primary_doc_description": "primaryDocDescription",
        "primary_document": "primaryDocument",
        "report_date": "reportDate",
    }


@dataclasses.dataclass(frozen=True)
class GqlEdgarSearchHit:
    ciks: list[str]
    display_names: list[str]
    adsh: str | None = None
    file_date: str | None = None
    form: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "display_names": "displayNames",
        "file_date": "fileDate",
    }


@dataclasses.dataclass(frozen=True)
class GqlEdgarSearchResults:
    hits: list[GqlEdgarSearchHit]
    page_info: GqlPageInfo | None = None
    total_hits: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
        "total_hits": "totalHits",
    }


@dataclasses.dataclass(frozen=True)
class GqlEdgarSubmissions:
    exchanges: list[str]
    filings: Page_GqlEdgarFiling
    tickers: list[str]
    category: str | None = None
    cik: str | None = None
    ein: str | None = None
    entity_type: str | None = None
    fiscal_year_end: str | None = None
    insider_transaction_for_issuer_exists: int | None = None
    insider_transaction_for_owner_exists: int | None = None
    name: str | None = None
    sic: str | None = None
    sic_description: str | None = None
    state_of_incorporation: str | None = None
    website: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "entity_type": "entityType",
        "fiscal_year_end": "fiscalYearEnd",
        "insider_transaction_for_issuer_exists": "insiderTransactionForIssuerExists",
        "insider_transaction_for_owner_exists": "insiderTransactionForOwnerExists",
        "sic_description": "sicDescription",
        "state_of_incorporation": "stateOfIncorporation",
    }


@dataclasses.dataclass(frozen=True)
class GqlElderRayData:
    bear_power: float | None = None
    bull_power: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "bear_power": "bearPower",
        "bull_power": "bullPower",
    }


@dataclasses.dataclass(frozen=True)
class GqlEquityPoint:
    """Portfolio value at one bar."""

    drawdown_pct: float
    equity: float
    timestamp: int

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "drawdown_pct": "drawdownPct",
    }


@dataclasses.dataclass(frozen=True)
class GqlEtfCountryWeighting:
    """Mirrors `finance_query::EtfCountryWeighting`."""

    country: str | None = None
    weight: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlEtfHolding:
    """Mirrors `finance_query::EtfHolding`."""

    description: str | None = None
    symbol: str | None = None
    weight: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlEtfProfile:
    """Mirrors `finance_query::EtfProfile`."""

    country_weightings: list[GqlEtfCountryWeighting]
    holdings: list[GqlEtfHolding]
    sector_weightings: list[GqlEtfSectorWeighting]
    asset_type: str | None = None
    dividend_yield: float | None = None
    inception_date: str | None = None
    name: str | None = None
    net_assets: float | None = None
    net_expense_ratio: float | None = None
    portfolio_turnover: float | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_type": "assetType",
        "country_weightings": "countryWeightings",
        "dividend_yield": "dividendYield",
        "inception_date": "inceptionDate",
        "net_assets": "netAssets",
        "net_expense_ratio": "netExpenseRatio",
        "portfolio_turnover": "portfolioTurnover",
        "sector_weightings": "sectorWeightings",
    }


@dataclasses.dataclass(frozen=True)
class GqlEtfSectorWeighting:
    """Mirrors `finance_query::EtfSectorWeighting`."""

    sector: str | None = None
    weight: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlExchange:
    """A supported stock exchange with its symbol suffix and data provider."""

    country: str
    data_provider: str
    delay: str
    market: str
    suffix: str

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "data_provider": "dataProvider",
    }


@dataclasses.dataclass(frozen=True)
class GqlExecutiveCompensation:
    """One executive's disclosed compensation for a year."""

    bonus: float | None = None
    cik: str | None = None
    company_name: str | None = None
    filing_date: str | None = None
    incentive_plan_compensation: float | None = None
    name_and_position: str | None = None
    option_award: float | None = None
    other_compensation: float | None = None
    salary: float | None = None
    stock_award: float | None = None
    symbol: str | None = None
    total: float | None = None
    url: str | None = None
    year: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "company_name": "companyName",
        "filing_date": "filingDate",
        "incentive_plan_compensation": "incentivePlanCompensation",
        "name_and_position": "nameAndPosition",
        "option_award": "optionAward",
        "other_compensation": "otherCompensation",
        "stock_award": "stockAward",
    }


@dataclasses.dataclass(frozen=True)
class GqlFactConcept:
    """A single XBRL fact concept with its data points."""

    concept: str
    data_points: Page_GqlFactDataPoint
    taxonomy: str
    unit: str
    description: str | None = None
    label: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "data_points": "dataPoints",
    }


@dataclasses.dataclass(frozen=True)
class GqlFactDataPoint:
    accn: str | None = None
    end: str | None = None
    filed: str | None = None
    form: str | None = None
    fp: str | None = None
    frame: str | None = None
    fy: int | None = None
    start: str | None = None
    val: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlFailToDeliver:
    """Mirrors `finance_query::FailToDeliver`, which has no serde rename of its
own — this deserializes snake_case keys while its GraphQL name stays
camelCase."""

    date: str | None = None
    description: str | None = None
    name: str | None = None
    price: float | None = None
    quantity: float | None = None
    symbol: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlFearAndGreed:
    """Fear & Greed index response, mirroring `finance_query::models::sentiment::FearAndGreed`."""

    classification: str | None = None
    timestamp: int | None = None
    value: int | None = None


@dataclasses.dataclass(frozen=True)
class GqlFeedEntry:
    """A single entry from an RSS/Atom feed."""

    source: str
    title: str
    url: str
    published: str | None = None
    summary: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlFibonacciLevels:
    """Mirrors `finance_query::indicators::FibonacciLevels`, which has no serde
rename of its own (plain snake_case keys)."""

    level236: float | None = None
    level382: float | None = None
    level50: float | None = None
    level618: float | None = None
    level786: float | None = None
    swing_high: float | None = None
    swing_low: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "swing_high": "swingHigh",
        "swing_low": "swingLow",
    }


@dataclasses.dataclass(frozen=True)
class GqlFilingSection:
    """Mirrors `finance_query::FilingSection`."""

    content: str | None = None
    section: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlFinancialDataPoint:
    """A single data point in a financial time series."""

    date: str
    value: float


@dataclasses.dataclass(frozen=True)
class GqlFinancialLineItem:
    """A single line item in a financial statement (e.g., "TotalRevenue")."""

    metric: str
    values: list[GqlFinancialDataPoint]


@dataclasses.dataclass(frozen=True)
class GqlFinancialRatiosTtm:
    """Trailing-twelve-month financial ratios."""

    asset_turnover: float | None = None
    book_value_per_share: float | None = None
    bottom_line_profit_margin: float | None = None
    capex_per_share: float | None = None
    capital_expenditure_coverage_ratio: float | None = None
    cash_per_share: float | None = None
    cash_ratio: float | None = None
    continuous_operations_profit_margin: float | None = None
    current_ratio: float | None = None
    debt_equity_ratio: float | None = None
    debt_ratio: float | None = None
    debt_service_coverage_ratio: float | None = None
    debt_to_capital_ratio: float | None = None
    debt_to_market_cap: float | None = None
    dividend_paid_and_capex_coverage_ratio: float | None = None
    dividend_per_share: float | None = None
    dividend_yield: float | None = None
    ebit_margin: float | None = None
    ebitda_margin: float | None = None
    ebt_per_ebit: float | None = None
    effective_tax_rate: float | None = None
    enterprise_value: float | None = None
    enterprise_value_multiple: float | None = None
    financial_leverage_ratio: float | None = None
    fixed_asset_turnover: float | None = None
    forward_peg_ratio: float | None = None
    free_cash_flow_operating_cash_flow_ratio: float | None = None
    free_cash_flow_per_share: float | None = None
    gross_profit_margin: float | None = None
    interest_coverage: float | None = None
    interest_debt_per_share: float | None = None
    inventory_turnover: float | None = None
    long_term_debt_to_capital_ratio: float | None = None
    net_income_per_ebt: float | None = None
    net_income_per_share: float | None = None
    net_profit_margin: float | None = None
    operating_cash_flow_coverage_ratio: float | None = None
    operating_cash_flow_per_share: float | None = None
    operating_cash_flow_ratio: float | None = None
    operating_cash_flow_sales_ratio: float | None = None
    operating_profit_margin: float | None = None
    payables_turnover: float | None = None
    payout_ratio: float | None = None
    peg_ratio: float | None = None
    pretax_profit_margin: float | None = None
    price_earnings_ratio: float | None = None
    price_to_book_ratio: float | None = None
    price_to_earnings_diluted_growth_ratio: float | None = None
    price_to_earnings_diluted_ratio: float | None = None
    price_to_fair_value: float | None = None
    price_to_free_cash_flows_ratio: float | None = None
    price_to_operating_cash_flow_ratio: float | None = None
    price_to_sales_ratio: float | None = None
    quick_ratio: float | None = None
    receivables_turnover: float | None = None
    revenue_per_share: float | None = None
    shareholders_equity_per_share: float | None = None
    short_term_operating_cash_flow_coverage_ratio: float | None = None
    solvency_ratio: float | None = None
    symbol: str | None = None
    tangible_book_value_per_share: float | None = None
    working_capital_turnover_ratio: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_turnover": "assetTurnover",
        "book_value_per_share": "bookValuePerShare",
        "bottom_line_profit_margin": "bottomLineProfitMargin",
        "capex_per_share": "capexPerShare",
        "capital_expenditure_coverage_ratio": "capitalExpenditureCoverageRatio",
        "cash_per_share": "cashPerShare",
        "cash_ratio": "cashRatio",
        "continuous_operations_profit_margin": "continuousOperationsProfitMargin",
        "current_ratio": "currentRatio",
        "debt_equity_ratio": "debtEquityRatio",
        "debt_ratio": "debtRatio",
        "debt_service_coverage_ratio": "debtServiceCoverageRatio",
        "debt_to_capital_ratio": "debtToCapitalRatio",
        "debt_to_market_cap": "debtToMarketCap",
        "dividend_paid_and_capex_coverage_ratio": "dividendPaidAndCapexCoverageRatio",
        "dividend_per_share": "dividendPerShare",
        "dividend_yield": "dividendYield",
        "ebit_margin": "ebitMargin",
        "ebitda_margin": "ebitdaMargin",
        "ebt_per_ebit": "ebtPerEbit",
        "effective_tax_rate": "effectiveTaxRate",
        "enterprise_value": "enterpriseValue",
        "enterprise_value_multiple": "enterpriseValueMultiple",
        "financial_leverage_ratio": "financialLeverageRatio",
        "fixed_asset_turnover": "fixedAssetTurnover",
        "forward_peg_ratio": "forwardPegRatio",
        "free_cash_flow_operating_cash_flow_ratio": "freeCashFlowOperatingCashFlowRatio",
        "free_cash_flow_per_share": "freeCashFlowPerShare",
        "gross_profit_margin": "grossProfitMargin",
        "interest_coverage": "interestCoverage",
        "interest_debt_per_share": "interestDebtPerShare",
        "inventory_turnover": "inventoryTurnover",
        "long_term_debt_to_capital_ratio": "longTermDebtToCapitalRatio",
        "net_income_per_ebt": "netIncomePerEbt",
        "net_income_per_share": "netIncomePerShare",
        "net_profit_margin": "netProfitMargin",
        "operating_cash_flow_coverage_ratio": "operatingCashFlowCoverageRatio",
        "operating_cash_flow_per_share": "operatingCashFlowPerShare",
        "operating_cash_flow_ratio": "operatingCashFlowRatio",
        "operating_cash_flow_sales_ratio": "operatingCashFlowSalesRatio",
        "operating_profit_margin": "operatingProfitMargin",
        "payables_turnover": "payablesTurnover",
        "payout_ratio": "payoutRatio",
        "peg_ratio": "pegRatio",
        "pretax_profit_margin": "pretaxProfitMargin",
        "price_earnings_ratio": "priceEarningsRatio",
        "price_to_book_ratio": "priceToBookRatio",
        "price_to_earnings_diluted_growth_ratio": "priceToEarningsDilutedGrowthRatio",
        "price_to_earnings_diluted_ratio": "priceToEarningsDilutedRatio",
        "price_to_fair_value": "priceToFairValue",
        "price_to_free_cash_flows_ratio": "priceToFreeCashFlowsRatio",
        "price_to_operating_cash_flow_ratio": "priceToOperatingCashFlowRatio",
        "price_to_sales_ratio": "priceToSalesRatio",
        "quick_ratio": "quickRatio",
        "receivables_turnover": "receivablesTurnover",
        "revenue_per_share": "revenuePerShare",
        "shareholders_equity_per_share": "shareholdersEquityPerShare",
        "short_term_operating_cash_flow_coverage_ratio": "shortTermOperatingCashFlowCoverageRatio",
        "solvency_ratio": "solvencyRatio",
        "tangible_book_value_per_share": "tangibleBookValuePerShare",
        "working_capital_turnover_ratio": "workingCapitalTurnoverRatio",
    }


@dataclasses.dataclass(frozen=True)
class GqlFinancialsBatch:
    """Result of the batch `financialsBatch` root field: successfully fetched
statements plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    financials: list[GqlSymbolFinancials]


@dataclasses.dataclass(frozen=True)
class GqlForexQuote:
    """Mirrors `finance_query::ForexQuote`."""

    symbol: str
    ask: float | None = None
    base_currency: str | None = None
    bid: float | None = None
    change: float | None = None
    change_percent: float | None = None
    price: float | None = None
    quote_currency: str | None = None
    timestamp: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "base_currency": "baseCurrency",
        "change_percent": "changePercent",
        "quote_currency": "quoteCurrency",
    }


@dataclasses.dataclass(frozen=True)
class GqlFormattedObject:
    """The `{raw, fmt, longFmt}` wrapper as it reaches the wire under `format=both`."""

    raw: typing.Any
    fmt: str | None = None
    long_fmt: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "long_fmt": "longFmt",
    }


@dataclasses.dataclass(frozen=True)
class GqlFuturesQuote:
    """Mirrors `finance_query::FuturesQuote`."""

    symbol: str
    change: float | None = None
    change_percent: float | None = None
    exchange: str | None = None
    expiration_date: str | None = None
    name: str | None = None
    open_interest: int | None = None
    price: float | None = None
    timestamp: int | None = None
    underlying: str | None = None
    volume: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "change_percent": "changePercent",
        "expiration_date": "expirationDate",
        "open_interest": "openInterest",
    }


@dataclasses.dataclass(frozen=True)
class GqlGlobalCryptoStats:
    """Mirrors `finance_query::crypto::GlobalCryptoStats`."""

    active_cryptocurrencies: int | None = None
    btc_dominance: float | None = None
    eth_dominance: float | None = None
    market_cap_change_percentage24_husd: float | None = None
    markets: int | None = None
    total_market_cap_usd: float | None = None
    total_volume_usd: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "active_cryptocurrencies": "activeCryptocurrencies",
        "btc_dominance": "btcDominance",
        "eth_dominance": "ethDominance",
        "market_cap_change_percentage24_husd": "marketCapChangePercentage24HUsd",
        "total_market_cap_usd": "totalMarketCapUsd",
        "total_volume_usd": "totalVolumeUsd",
    }


@dataclasses.dataclass(frozen=True)
class GqlGradingAction:
    """One analyst upgrade or downgrade, provider-routed."""

    date: str | None = None
    grading_company: str | None = None
    new_grade: str | None = None
    previous_grade: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "grading_company": "gradingCompany",
        "new_grade": "newGrade",
        "previous_grade": "previousGrade",
    }


@dataclasses.dataclass(frozen=True)
class GqlGrowthCompany:
    symbol: str
    growth_estimate: float | None = None
    last_price: float | None = None
    name: str | None = None
    ytd_return: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "growth_estimate": "growthEstimate",
        "last_price": "lastPrice",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlHeikinAshiCandle:
    """Mirrors `finance_query::Candle` (camelCase serde keys)."""

    adj_close: float | None = None
    close: float | None = None
    high: float | None = None
    low: float | None = None
    open: float | None = None
    timestamp: int | None = None
    volume: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "adj_close": "adjClose",
    }


@dataclasses.dataclass(frozen=True)
class GqlIchimokuData:
    base_line: float | None = None
    conversion_line: float | None = None
    lagging_span: float | None = None
    leading_span_a: float | None = None
    leading_span_b: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "base_line": "baseLine",
        "conversion_line": "conversionLine",
        "lagging_span": "laggingSpan",
        "leading_span_a": "leadingSpanA",
        "leading_span_b": "leadingSpanB",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndexConstituent:
    """Mirrors `finance_query::IndexConstituent`."""

    symbol: str
    cik: str | None = None
    date_first_added: str | None = None
    founded: str | None = None
    headquarters: str | None = None
    name: str | None = None
    sector: str | None = None
    sub_sector: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "date_first_added": "dateFirstAdded",
        "sub_sector": "subSector",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndexConstituentChange:
    """One addition or removal from an index's constituent list."""

    added_security: str | None = None
    date: str | None = None
    reason: str | None = None
    removed_security: str | None = None
    removed_ticker: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "added_security": "addedSecurity",
        "removed_security": "removedSecurity",
        "removed_ticker": "removedTicker",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndicatorsBatch:
    """Result of the batch `indicatorsBatch` root field: successfully computed
indicators plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    indicators: Page_GqlSymbolIndicators


@dataclasses.dataclass(frozen=True)
class GqlIndicatorsSummary:
    """All technical indicators for a symbol (latest values)."""

    accumulation_distribution: float | None = None
    adx14: float | None = None
    alma9: float | None = None
    aroon: GqlAroonData | None = None
    atr14: float | None = None
    awesome_oscillator: float | None = None
    balance_of_power: float | None = None
    bollinger_bands: GqlBollingerBandsData | None = None
    bull_bear_power: GqlBullBearPowerData | None = None
    cci20: float | None = None
    chaikin_oscillator: float | None = None
    choppiness_index14: float | None = None
    cmf20: float | None = None
    cmo14: float | None = None
    coppock_curve: float | None = None
    dema20: float | None = None
    donchian_channels: GqlDonchianChannelsData | None = None
    elder_ray_index: GqlElderRayData | None = None
    ema10: float | None = None
    ema100: float | None = None
    ema20: float | None = None
    ema200: float | None = None
    ema50: float | None = None
    fibonacci_pivot_points: GqlPivotPointsData | None = None
    fibonacci_retracement50: GqlFibonacciLevels | None = None
    heikin_ashi: GqlHeikinAshiCandle | None = None
    hma20: float | None = None
    ichimoku: GqlIchimokuData | None = None
    keltner_channels: GqlKeltnerChannelsData | None = None
    macd: GqlMacdData | None = None
    mcginley_dynamic20: float | None = None
    mfi14: float | None = None
    momentum10: float | None = None
    obv: float | None = None
    parabolic_sar: float | None = None
    pivot_points: GqlPivotPointsData | None = None
    roc12: float | None = None
    rsi14: float | None = None
    sma10: float | None = None
    sma100: float | None = None
    sma20: float | None = None
    sma200: float | None = None
    sma50: float | None = None
    stochastic: GqlStochasticData | None = None
    stochastic_rsi: GqlStochasticData | None = None
    supertrend: GqlSuperTrendData | None = None
    tema20: float | None = None
    true_range: float | None = None
    vwap: float | None = None
    vwma20: float | None = None
    williams_r14: float | None = None
    wma10: float | None = None
    wma100: float | None = None
    wma20: float | None = None
    wma200: float | None = None
    wma50: float | None = None
    zigzag_last_pivot: GqlZigZagPoint | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "accumulation_distribution": "accumulationDistribution",
        "awesome_oscillator": "awesomeOscillator",
        "balance_of_power": "balanceOfPower",
        "bollinger_bands": "bollingerBands",
        "bull_bear_power": "bullBearPower",
        "chaikin_oscillator": "chaikinOscillator",
        "choppiness_index14": "choppinessIndex14",
        "coppock_curve": "coppockCurve",
        "donchian_channels": "donchianChannels",
        "elder_ray_index": "elderRayIndex",
        "fibonacci_pivot_points": "fibonacciPivotPoints",
        "fibonacci_retracement50": "fibonacciRetracement50",
        "heikin_ashi": "heikinAshi",
        "keltner_channels": "keltnerChannels",
        "mcginley_dynamic20": "mcginleyDynamic20",
        "parabolic_sar": "parabolicSar",
        "pivot_points": "pivotPoints",
        "stochastic_rsi": "stochasticRsi",
        "true_range": "trueRange",
        "williams_r14": "williamsR14",
        "zigzag_last_pivot": "zigzagLastPivot",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndustryCompany:
    symbol: str
    day_change_percent: float | None = None
    last_price: float | None = None
    market_cap: float | None = None
    market_weight: float | None = None
    name: str | None = None
    rating: str | None = None
    target_price: float | None = None
    ytd_return: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "last_price": "lastPrice",
        "market_cap": "marketCap",
        "market_weight": "marketWeight",
        "target_price": "targetPrice",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndustryData:
    key: str
    name: str
    research_reports: list[GqlIndustryResearchReport]
    top_companies: list[GqlIndustryCompany]
    top_growth_companies: list[GqlGrowthCompany]
    top_performing_companies: list[GqlPerformingCompany]
    benchmark: GqlBenchmarkPerformance | None = None
    overview: GqlIndustryOverview | None = None
    performance: GqlIndustryPerformance | None = None
    sector_key: str | None = None
    sector_name: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "research_reports": "researchReports",
        "sector_key": "sectorKey",
        "sector_name": "sectorName",
        "top_companies": "topCompanies",
        "top_growth_companies": "topGrowthCompanies",
        "top_performing_companies": "topPerformingCompanies",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndustryOverview:
    companies_count: int | None = None
    description: str | None = None
    employee_count: int | None = None
    market_cap: float | None = None
    market_weight: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "companies_count": "companiesCount",
        "employee_count": "employeeCount",
        "market_cap": "marketCap",
        "market_weight": "marketWeight",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndustryPerformance:
    day_change_percent: float | None = None
    five_year_change_percent: float | None = None
    one_year_change_percent: float | None = None
    three_year_change_percent: float | None = None
    ytd_change_percent: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "five_year_change_percent": "fiveYearChangePercent",
        "one_year_change_percent": "oneYearChangePercent",
        "three_year_change_percent": "threeYearChangePercent",
        "ytd_change_percent": "ytdChangePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlIndustryResearchReport:
    id: str | None = None
    investment_rating: str | None = None
    provider: str | None = None
    report_date: str | None = None
    report_type: str | None = None
    target_price: float | None = None
    target_price_status: str | None = None
    title: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "investment_rating": "investmentRating",
        "report_date": "reportDate",
        "report_type": "reportType",
        "target_price": "targetPrice",
        "target_price_status": "targetPriceStatus",
    }


@dataclasses.dataclass(frozen=True)
class GqlKeltnerChannelsData:
    lower: float | None = None
    middle: float | None = None
    upper: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlKeyMetricsTtm:
    """Trailing-twelve-month key metrics."""

    average_inventory: float | None = None
    average_payables: float | None = None
    average_receivables: float | None = None
    capex_to_depreciation: float | None = None
    capex_to_operating_cash_flow: float | None = None
    capex_to_revenue: float | None = None
    cash_conversion_cycle: float | None = None
    current_ratio: float | None = None
    days_of_inventory_outstanding: float | None = None
    days_of_payables_outstanding: float | None = None
    days_of_sales_outstanding: float | None = None
    earnings_yield: float | None = None
    enterprise_value: float | None = None
    ev_to_ebitda: float | None = None
    ev_to_free_cash_flow: float | None = None
    ev_to_operating_cash_flow: float | None = None
    ev_to_sales: float | None = None
    free_cash_flow_to_equity: float | None = None
    free_cash_flow_to_firm: float | None = None
    free_cash_flow_yield: float | None = None
    graham_net_net: float | None = None
    graham_number: float | None = None
    income_quality: float | None = None
    intangibles_to_total_assets: float | None = None
    interest_burden: float | None = None
    invested_capital: float | None = None
    market_cap: float | None = None
    net_current_asset_value: float | None = None
    net_debt_to_ebitda: float | None = None
    operating_cycle: float | None = None
    operating_return_on_assets: float | None = None
    research_and_development_to_revenue: float | None = None
    return_on_assets: float | None = None
    return_on_capital_employed: float | None = None
    return_on_equity: float | None = None
    return_on_invested_capital: float | None = None
    return_on_tangible_assets: float | None = None
    sales_general_and_administrative_to_revenue: float | None = None
    stock_based_compensation_to_revenue: float | None = None
    symbol: str | None = None
    tangible_asset_value: float | None = None
    tax_burden: float | None = None
    working_capital: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "average_inventory": "averageInventory",
        "average_payables": "averagePayables",
        "average_receivables": "averageReceivables",
        "capex_to_depreciation": "capexToDepreciation",
        "capex_to_operating_cash_flow": "capexToOperatingCashFlow",
        "capex_to_revenue": "capexToRevenue",
        "cash_conversion_cycle": "cashConversionCycle",
        "current_ratio": "currentRatio",
        "days_of_inventory_outstanding": "daysOfInventoryOutstanding",
        "days_of_payables_outstanding": "daysOfPayablesOutstanding",
        "days_of_sales_outstanding": "daysOfSalesOutstanding",
        "earnings_yield": "earningsYield",
        "enterprise_value": "enterpriseValue",
        "ev_to_ebitda": "evToEbitda",
        "ev_to_free_cash_flow": "evToFreeCashFlow",
        "ev_to_operating_cash_flow": "evToOperatingCashFlow",
        "ev_to_sales": "evToSales",
        "free_cash_flow_to_equity": "freeCashFlowToEquity",
        "free_cash_flow_to_firm": "freeCashFlowToFirm",
        "free_cash_flow_yield": "freeCashFlowYield",
        "graham_net_net": "grahamNetNet",
        "graham_number": "grahamNumber",
        "income_quality": "incomeQuality",
        "intangibles_to_total_assets": "intangiblesToTotalAssets",
        "interest_burden": "interestBurden",
        "invested_capital": "investedCapital",
        "market_cap": "marketCap",
        "net_current_asset_value": "netCurrentAssetValue",
        "net_debt_to_ebitda": "netDebtToEbitda",
        "operating_cycle": "operatingCycle",
        "operating_return_on_assets": "operatingReturnOnAssets",
        "research_and_development_to_revenue": "researchAndDevelopmentToRevenue",
        "return_on_assets": "returnOnAssets",
        "return_on_capital_employed": "returnOnCapitalEmployed",
        "return_on_equity": "returnOnEquity",
        "return_on_invested_capital": "returnOnInvestedCapital",
        "return_on_tangible_assets": "returnOnTangibleAssets",
        "sales_general_and_administrative_to_revenue": "salesGeneralAndAdministrativeToRevenue",
        "stock_based_compensation_to_revenue": "stockBasedCompensationToRevenue",
        "tangible_asset_value": "tangibleAssetValue",
        "tax_burden": "taxBurden",
        "working_capital": "workingCapital",
    }


@dataclasses.dataclass(frozen=True)
class GqlLookupQuote:
    """A quote/document result from `lookup`."""

    symbol: str
    company_logo_url: str | None = None
    exch_disp: str | None = None
    exchange: str | None = None
    industry: str | None = None
    logo_url: str | None = None
    long_name: str | None = None
    quote_type: str | None = None
    regular_market_change: float | None = None
    regular_market_change_percent: float | None = None
    regular_market_previous_close: float | None = None
    regular_market_price: float | None = None
    sector: str | None = None
    short_name: str | None = None
    type_disp: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "company_logo_url": "companyLogoUrl",
        "exch_disp": "exchDisp",
        "logo_url": "logoUrl",
        "long_name": "longName",
        "quote_type": "quoteType",
        "regular_market_change": "regularMarketChange",
        "regular_market_change_percent": "regularMarketChangePercent",
        "regular_market_previous_close": "regularMarketPreviousClose",
        "regular_market_price": "regularMarketPrice",
        "short_name": "shortName",
        "type_disp": "typeDisp",
    }


@dataclasses.dataclass(frozen=True)
class GqlLookupResults:
    """Type-filtered symbol lookup results."""

    quotes: list[GqlLookupQuote]
    count: int | None = None
    start: int | None = None


@dataclasses.dataclass(frozen=True)
class GqlMacdData:
    histogram: float | None = None
    macd: float | None = None
    signal: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlMacroObservation:
    """A single observation in a FRED data series."""

    date: str
    value: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlMacroSeries:
    """A FRED macro-economic time series with all its observations."""

    id: str
    observations: Page_GqlMacroObservation


@dataclasses.dataclass(frozen=True)
class GqlMarketCalendarEntry:
    """A single market-wide calendar entry."""

    detail: GqlMarketCalendarDetail
    date: str | None = None
    symbol: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlMarketHours:
    """Market hours for one or more markets."""

    markets: list[GqlMarketTime]


@dataclasses.dataclass(frozen=True)
class GqlMarketSectorPe:
    """A sector's aggregate price/earnings ratio, provider-routed via
`Providers::market()`."""

    sector: str
    date: str | None = None
    exchange: str | None = None
    pe: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlMarketSectorPerformance:
    """A sector's aggregate performance, provider-routed via `Providers::market()`
(`Capability::MARKET`). Distinct from `GqlSectorPerformance` in
`types/sector.rs`, which is a nested field on Yahoo-only `finance::sector`."""

    sector: str
    change_percent: float | None = None
    exchange: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "change_percent": "changePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlMarketSummaryQuote:
    """A market summary quote (major index / currency / commodity)."""

    exchange: str | None = None
    full_exchange_name: str | None = None
    market_state: str | None = None
    quote_type: str | None = None
    regular_market_change: GqlFormattedValue | None = None
    regular_market_change_percent: GqlFormattedValue | None = None
    regular_market_previous_close: GqlFormattedValue | None = None
    regular_market_price: GqlFormattedValue | None = None
    regular_market_time: GqlFormattedValue | None = None
    short_name: str | None = None
    spark: typing.Any | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "full_exchange_name": "fullExchangeName",
        "market_state": "marketState",
        "quote_type": "quoteType",
        "regular_market_change": "regularMarketChange",
        "regular_market_change_percent": "regularMarketChangePercent",
        "regular_market_previous_close": "regularMarketPreviousClose",
        "regular_market_price": "regularMarketPrice",
        "regular_market_time": "regularMarketTime",
        "short_name": "shortName",
    }


@dataclasses.dataclass(frozen=True)
class GqlMarketTime:
    """Market open/close status for a single market."""

    id: str
    name: str
    status: str
    close: str | None = None
    dst: bool | None = None
    gmt_offset: int | None = None
    message: str | None = None
    open: str | None = None
    time: str | None = None
    timezone: str | None = None
    timezone_short: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "gmt_offset": "gmtOffset",
        "timezone_short": "timezoneShort",
    }


@dataclasses.dataclass(frozen=True)
class GqlNews:
    """A scraped news article."""

    img: str
    link: str
    source: str
    time: str
    title: str
    sentiment: GqlSentiment | None = None


@dataclasses.dataclass(frozen=True)
class GqlOptionContract:
    """An option contract (call or put)."""

    contract_symbol: str
    strike: float
    ask: float | None = None
    bid: float | None = None
    change: float | None = None
    contract_size: str | None = None
    currency: str | None = None
    expiration: int | None = None
    implied_volatility: float | None = None
    in_the_money: bool | None = None
    last_price: float | None = None
    last_trade_date: int | None = None
    open_interest: int | None = None
    percent_change: float | None = None
    volume: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "contract_size": "contractSize",
        "contract_symbol": "contractSymbol",
        "implied_volatility": "impliedVolatility",
        "in_the_money": "inTheMoney",
        "last_price": "lastPrice",
        "last_trade_date": "lastTradeDate",
        "open_interest": "openInterest",
        "percent_change": "percentChange",
    }


@dataclasses.dataclass(frozen=True)
class GqlOptions:
    """Options chain data for a symbol."""

    calls: Page_GqlOptionContract
    expiration_dates: list[int]
    puts: Page_GqlOptionContract
    strikes: list[float]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "expiration_dates": "expirationDates",
    }


@dataclasses.dataclass(frozen=True)
class GqlOptionsBatch:
    """Result of the batch `optionsBatch` root field: successfully fetched
options chains plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    options: Page_GqlSymbolOptions


@dataclasses.dataclass(frozen=True)
class GqlPageInfo:
    """Pagination metadata for fields whose pagination genuinely happens at the
*input* level (an `offset`/`size`-style arg the upstream API already
consumes to fetch the requested slice directly — screener's `customScreener`,
EDGAR's `edgarSearch`) rather than by fetching everything and slicing in
Rust. These fields keep returning a plain `Vec<T>` (no `edges`/`node`
wrapping — that would just be redundant pagination vocabulary layered on
top of the offset/size that already did the real work) and add this as a
`pageInfo` sibling field alongside their existing `total`/`totalHits`."""

    has_next_page: bool
    has_previous_page: bool
    end_cursor: str | None = None
    start_cursor: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "end_cursor": "endCursor",
        "has_next_page": "hasNextPage",
        "has_previous_page": "hasPreviousPage",
        "start_cursor": "startCursor",
    }


@dataclasses.dataclass(frozen=True)
class GqlParagraph:
    end: float
    sentences: list[GqlSentence]
    speaker: int
    start: float
    text: str


@dataclasses.dataclass(frozen=True)
class GqlPerformingCompany:
    symbol: str
    last_price: float | None = None
    name: str | None = None
    target_price: float | None = None
    ytd_return: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "last_price": "lastPrice",
        "target_price": "targetPrice",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlPivotPointsData:
    pivot: float | None = None
    r1: float | None = None
    r2: float | None = None
    r3: float | None = None
    s1: float | None = None
    s2: float | None = None
    s3: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlPressRelease:
    """Mirrors `finance_query::PressRelease`."""

    date: str | None = None
    symbol: str | None = None
    text: str | None = None
    title: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlPriceTargetConsensus:
    """Mirrors `finance_query::PriceTargetConsensus`."""

    symbol: str | None = None
    target_consensus: float | None = None
    target_high: float | None = None
    target_low: float | None = None
    target_median: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "target_consensus": "targetConsensus",
        "target_high": "targetHigh",
        "target_low": "targetLow",
        "target_median": "targetMedian",
    }


@dataclasses.dataclass(frozen=True)
class GqlPriceTargetSummary:
    """Analyst price-target publication counts and averages by window."""

    all_time_avg: float | None = None
    all_time_count: int | None = None
    last_month_avg: float | None = None
    last_month_count: int | None = None
    last_quarter_avg: float | None = None
    last_quarter_count: int | None = None
    last_year_avg: float | None = None
    last_year_count: int | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "all_time_avg": "allTimeAvg",
        "all_time_count": "allTimeCount",
        "last_month_avg": "lastMonthAvg",
        "last_month_count": "lastMonthCount",
        "last_quarter_avg": "lastQuarterAvg",
        "last_quarter_count": "lastQuarterCount",
        "last_year_avg": "lastYearAvg",
        "last_year_count": "lastYearCount",
    }


@dataclasses.dataclass(frozen=True)
class GqlProtocolTvl:
    """A DeFi protocol's total value locked, provider-routed (DefiLlama, keyless)."""

    chains: list[str]
    slug: str
    tvl_by_chain: list[GqlChainAllocation]
    change1_dpercent: float | None = None
    change7_dpercent: float | None = None
    market_cap: float | None = None
    name: str | None = None
    symbol: str | None = None
    tvl: float | None = None
    url: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "change1_dpercent": "change1DPercent",
        "change7_dpercent": "change7DPercent",
        "market_cap": "marketCap",
        "tvl_by_chain": "tvlByChain",
    }


@dataclasses.dataclass(frozen=True)
class GqlQuote:
    """Full quote data for a stock / ETF / fund, mirroring `finance_query::Quote`."""

    all_time_high: GqlFormattedValue | None = None
    all_time_low: GqlFormattedValue | None = None
    ask: GqlFormattedValue | None = None
    ask_size: GqlFormattedValue | None = None
    audit_risk: int | None = None
    average_volume: GqlFormattedValue | None = None
    balance_sheet_history: typing.Any | None = None
    balance_sheet_history_quarterly: typing.Any | None = None
    beta: GqlFormattedValue | None = None
    bid: GqlFormattedValue | None = None
    bid_size: GqlFormattedValue | None = None
    board_risk: int | None = None
    book_value: GqlFormattedValue | None = None
    calendar_events: typing.Any | None = None
    cashflow_statement_history: typing.Any | None = None
    cashflow_statement_history_quarterly: typing.Any | None = None
    category: str | None = None
    city: str | None = None
    company_logo_url: str | None = None
    company_officers: typing.Any | None = None
    compensation_risk: int | None = None
    country: str | None = None
    currency: str | None = None
    currency_symbol: str | None = None
    current_price: GqlFormattedValue | None = None
    current_ratio: GqlFormattedValue | None = None
    date_short_interest: GqlFormattedValue | None = None
    day_high: GqlFormattedValue | None = None
    day_low: GqlFormattedValue | None = None
    debt_to_equity: GqlFormattedValue | None = None
    dividend_rate: GqlFormattedValue | None = None
    dividend_yield: GqlFormattedValue | None = None
    earnings: typing.Any | None = None
    earnings_growth: GqlFormattedValue | None = None
    earnings_history: typing.Any | None = None
    earnings_quarterly_growth: GqlFormattedValue | None = None
    earnings_trend: typing.Any | None = None
    ebitda_margins: GqlFormattedValue | None = None
    enterprise_to_ebitda: GqlFormattedValue | None = None
    enterprise_to_revenue: GqlFormattedValue | None = None
    enterprise_value: GqlFormattedValue | None = None
    equity_performance: typing.Any | None = None
    ex_dividend_date: GqlFormattedValue | None = None
    exchange: str | None = None
    exchange_data_delayed_by: int | None = None
    exchange_name: str | None = None
    fifty_day_average: GqlFormattedValue | None = None
    fifty_two_week_high: GqlFormattedValue | None = None
    fifty_two_week_low: GqlFormattedValue | None = None
    financial_currency: str | None = None
    first_trade_date_epoch_utc: int | None = None
    five_year_avg_dividend_yield: GqlFormattedValue | None = None
    float_shares: GqlFormattedValue | None = None
    forward_eps: GqlFormattedValue | None = None
    forward_pe: GqlFormattedValue | None = None
    free_cashflow: GqlFormattedValue | None = None
    from_currency: str | None = None
    full_time_employees: int | None = None
    fund_family: str | None = None
    fund_ownership: typing.Any | None = None
    fund_performance: typing.Any | None = None
    fund_profile: typing.Any | None = None
    gmt_off_set_milliseconds: int | None = None
    gross_margins: GqlFormattedValue | None = None
    gross_profits: GqlFormattedValue | None = None
    held_percent_insiders: GqlFormattedValue | None = None
    held_percent_institutions: GqlFormattedValue | None = None
    implied_shares_outstanding: GqlFormattedValue | None = None
    income_statement_history: typing.Any | None = None
    income_statement_history_quarterly: typing.Any | None = None
    index_trend: typing.Any | None = None
    industry: str | None = None
    industry_disp: str | None = None
    industry_key: str | None = None
    industry_trend: typing.Any | None = None
    insider_holders: typing.Any | None = None
    insider_transactions: typing.Any | None = None
    institution_ownership: typing.Any | None = None
    ir_website: str | None = None
    last_dividend_date: GqlFormattedValue | None = None
    last_dividend_value: GqlFormattedValue | None = None
    last_fiscal_year_end: GqlFormattedValue | None = None
    last_split_date: GqlFormattedValue | None = None
    last_split_factor: str | None = None
    logo_url: str | None = None
    long_business_summary: str | None = None
    long_name: str | None = None
    major_holders_breakdown: typing.Any | None = None
    market_cap: GqlFormattedValue | None = None
    market_state: str | None = None
    most_recent_quarter: GqlFormattedValue | None = None
    nav_price: GqlFormattedValue | None = None
    net_income_to_common: GqlFormattedValue | None = None
    net_share_purchase_activity: typing.Any | None = None
    next_fiscal_year_end: GqlFormattedValue | None = None
    number_of_analyst_opinions: GqlFormattedValue | None = None
    open: GqlFormattedValue | None = None
    operating_cashflow: GqlFormattedValue | None = None
    operating_margins: GqlFormattedValue | None = None
    overall_risk: int | None = None
    payout_ratio: GqlFormattedValue | None = None
    phone: str | None = None
    post_market_change: GqlFormattedValue | None = None
    post_market_change_percent: GqlFormattedValue | None = None
    post_market_price: GqlFormattedValue | None = None
    post_market_time: int | None = None
    pre_market_change: GqlFormattedValue | None = None
    pre_market_change_percent: GqlFormattedValue | None = None
    pre_market_price: GqlFormattedValue | None = None
    pre_market_time: int | None = None
    previous_close: GqlFormattedValue | None = None
    price_hint: GqlFormattedValue | None = None
    price_to_book: GqlFormattedValue | None = None
    profit_margins: GqlFormattedValue | None = None
    quick_ratio: GqlFormattedValue | None = None
    quote_type: str | None = None
    recommendation_key: str | None = None
    recommendation_mean: GqlFormattedValue | None = None
    recommendation_trend: typing.Any | None = None
    regular_market_change: GqlFormattedValue | None = None
    regular_market_change_percent: GqlFormattedValue | None = None
    regular_market_day_high: GqlFormattedValue | None = None
    regular_market_day_low: GqlFormattedValue | None = None
    regular_market_open: GqlFormattedValue | None = None
    regular_market_previous_close: GqlFormattedValue | None = None
    regular_market_price: GqlFormattedValue | None = None
    regular_market_time: int | None = None
    regular_market_volume: GqlFormattedValue | None = None
    return_on_assets: GqlFormattedValue | None = None
    return_on_equity: GqlFormattedValue | None = None
    revenue_growth: GqlFormattedValue | None = None
    revenue_per_share: GqlFormattedValue | None = None
    sand_p52_week_change: GqlFormattedValue | None = None
    sec_filings: typing.Any | None = None
    sector: str | None = None
    sector_disp: str | None = None
    sector_key: str | None = None
    sector_trend: typing.Any | None = None
    shareholder_rights_risk: int | None = None
    shares_outstanding: GqlFormattedValue | None = None
    shares_percent_shares_out: GqlFormattedValue | None = None
    shares_short: GqlFormattedValue | None = None
    shares_short_prior_month: GqlFormattedValue | None = None
    short_name: str | None = None
    short_percent_of_float: GqlFormattedValue | None = None
    short_ratio: GqlFormattedValue | None = None
    state: str | None = None
    symbol: str | None = None
    target_high_price: GqlFormattedValue | None = None
    target_low_price: GqlFormattedValue | None = None
    target_mean_price: GqlFormattedValue | None = None
    target_median_price: GqlFormattedValue | None = None
    time_zone_full_name: str | None = None
    time_zone_short_name: str | None = None
    to_currency: str | None = None
    top_holdings: typing.Any | None = None
    total_assets: GqlFormattedValue | None = None
    total_debt: GqlFormattedValue | None = None
    total_revenue: GqlFormattedValue | None = None
    tradeable: bool | None = None
    trailing_annual_dividend_rate: GqlFormattedValue | None = None
    trailing_annual_dividend_yield: GqlFormattedValue | None = None
    trailing_eps: GqlFormattedValue | None = None
    trailing_pe: GqlFormattedValue | None = None
    two_hundred_day_average: GqlFormattedValue | None = None
    underlying_symbol: str | None = None
    upgrade_downgrade_history: typing.Any | None = None
    volume: GqlFormattedValue | None = None
    website: str | None = None
    week52_change: GqlFormattedValue | None = None
    yield_value: GqlFormattedValue | None = None
    zip: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "all_time_high": "allTimeHigh",
        "all_time_low": "allTimeLow",
        "ask_size": "askSize",
        "audit_risk": "auditRisk",
        "average_volume": "averageVolume",
        "balance_sheet_history": "balanceSheetHistory",
        "balance_sheet_history_quarterly": "balanceSheetHistoryQuarterly",
        "bid_size": "bidSize",
        "board_risk": "boardRisk",
        "book_value": "bookValue",
        "calendar_events": "calendarEvents",
        "cashflow_statement_history": "cashflowStatementHistory",
        "cashflow_statement_history_quarterly": "cashflowStatementHistoryQuarterly",
        "company_logo_url": "companyLogoUrl",
        "company_officers": "companyOfficers",
        "compensation_risk": "compensationRisk",
        "currency_symbol": "currencySymbol",
        "current_price": "currentPrice",
        "current_ratio": "currentRatio",
        "date_short_interest": "dateShortInterest",
        "day_high": "dayHigh",
        "day_low": "dayLow",
        "debt_to_equity": "debtToEquity",
        "dividend_rate": "dividendRate",
        "dividend_yield": "dividendYield",
        "earnings_growth": "earningsGrowth",
        "earnings_history": "earningsHistory",
        "earnings_quarterly_growth": "earningsQuarterlyGrowth",
        "earnings_trend": "earningsTrend",
        "ebitda_margins": "ebitdaMargins",
        "enterprise_to_ebitda": "enterpriseToEbitda",
        "enterprise_to_revenue": "enterpriseToRevenue",
        "enterprise_value": "enterpriseValue",
        "equity_performance": "equityPerformance",
        "ex_dividend_date": "exDividendDate",
        "exchange_data_delayed_by": "exchangeDataDelayedBy",
        "exchange_name": "exchangeName",
        "fifty_day_average": "fiftyDayAverage",
        "fifty_two_week_high": "fiftyTwoWeekHigh",
        "fifty_two_week_low": "fiftyTwoWeekLow",
        "financial_currency": "financialCurrency",
        "first_trade_date_epoch_utc": "firstTradeDateEpochUtc",
        "five_year_avg_dividend_yield": "fiveYearAvgDividendYield",
        "float_shares": "floatShares",
        "forward_eps": "forwardEps",
        "forward_pe": "forwardPe",
        "free_cashflow": "freeCashflow",
        "from_currency": "fromCurrency",
        "full_time_employees": "fullTimeEmployees",
        "fund_family": "fundFamily",
        "fund_ownership": "fundOwnership",
        "fund_performance": "fundPerformance",
        "fund_profile": "fundProfile",
        "gmt_off_set_milliseconds": "gmtOffSetMilliseconds",
        "gross_margins": "grossMargins",
        "gross_profits": "grossProfits",
        "held_percent_insiders": "heldPercentInsiders",
        "held_percent_institutions": "heldPercentInstitutions",
        "implied_shares_outstanding": "impliedSharesOutstanding",
        "income_statement_history": "incomeStatementHistory",
        "income_statement_history_quarterly": "incomeStatementHistoryQuarterly",
        "index_trend": "indexTrend",
        "industry_disp": "industryDisp",
        "industry_key": "industryKey",
        "industry_trend": "industryTrend",
        "insider_holders": "insiderHolders",
        "insider_transactions": "insiderTransactions",
        "institution_ownership": "institutionOwnership",
        "ir_website": "irWebsite",
        "last_dividend_date": "lastDividendDate",
        "last_dividend_value": "lastDividendValue",
        "last_fiscal_year_end": "lastFiscalYearEnd",
        "last_split_date": "lastSplitDate",
        "last_split_factor": "lastSplitFactor",
        "logo_url": "logoUrl",
        "long_business_summary": "longBusinessSummary",
        "long_name": "longName",
        "major_holders_breakdown": "majorHoldersBreakdown",
        "market_cap": "marketCap",
        "market_state": "marketState",
        "most_recent_quarter": "mostRecentQuarter",
        "nav_price": "navPrice",
        "net_income_to_common": "netIncomeToCommon",
        "net_share_purchase_activity": "netSharePurchaseActivity",
        "next_fiscal_year_end": "nextFiscalYearEnd",
        "number_of_analyst_opinions": "numberOfAnalystOpinions",
        "operating_cashflow": "operatingCashflow",
        "operating_margins": "operatingMargins",
        "overall_risk": "overallRisk",
        "payout_ratio": "payoutRatio",
        "post_market_change": "postMarketChange",
        "post_market_change_percent": "postMarketChangePercent",
        "post_market_price": "postMarketPrice",
        "post_market_time": "postMarketTime",
        "pre_market_change": "preMarketChange",
        "pre_market_change_percent": "preMarketChangePercent",
        "pre_market_price": "preMarketPrice",
        "pre_market_time": "preMarketTime",
        "previous_close": "previousClose",
        "price_hint": "priceHint",
        "price_to_book": "priceToBook",
        "profit_margins": "profitMargins",
        "quick_ratio": "quickRatio",
        "quote_type": "quoteType",
        "recommendation_key": "recommendationKey",
        "recommendation_mean": "recommendationMean",
        "recommendation_trend": "recommendationTrend",
        "regular_market_change": "regularMarketChange",
        "regular_market_change_percent": "regularMarketChangePercent",
        "regular_market_day_high": "regularMarketDayHigh",
        "regular_market_day_low": "regularMarketDayLow",
        "regular_market_open": "regularMarketOpen",
        "regular_market_previous_close": "regularMarketPreviousClose",
        "regular_market_price": "regularMarketPrice",
        "regular_market_time": "regularMarketTime",
        "regular_market_volume": "regularMarketVolume",
        "return_on_assets": "returnOnAssets",
        "return_on_equity": "returnOnEquity",
        "revenue_growth": "revenueGrowth",
        "revenue_per_share": "revenuePerShare",
        "sand_p52_week_change": "sandP52WeekChange",
        "sec_filings": "secFilings",
        "sector_disp": "sectorDisp",
        "sector_key": "sectorKey",
        "sector_trend": "sectorTrend",
        "shareholder_rights_risk": "shareholderRightsRisk",
        "shares_outstanding": "sharesOutstanding",
        "shares_percent_shares_out": "sharesPercentSharesOut",
        "shares_short": "sharesShort",
        "shares_short_prior_month": "sharesShortPriorMonth",
        "short_name": "shortName",
        "short_percent_of_float": "shortPercentOfFloat",
        "short_ratio": "shortRatio",
        "target_high_price": "targetHighPrice",
        "target_low_price": "targetLowPrice",
        "target_mean_price": "targetMeanPrice",
        "target_median_price": "targetMedianPrice",
        "time_zone_full_name": "timeZoneFullName",
        "time_zone_short_name": "timeZoneShortName",
        "to_currency": "toCurrency",
        "top_holdings": "topHoldings",
        "total_assets": "totalAssets",
        "total_debt": "totalDebt",
        "total_revenue": "totalRevenue",
        "trailing_annual_dividend_rate": "trailingAnnualDividendRate",
        "trailing_annual_dividend_yield": "trailingAnnualDividendYield",
        "trailing_eps": "trailingEps",
        "trailing_pe": "trailingPe",
        "two_hundred_day_average": "twoHundredDayAverage",
        "underlying_symbol": "underlyingSymbol",
        "upgrade_downgrade_history": "upgradeDowngradeHistory",
        "week52_change": "week52Change",
        "yield_value": "yieldValue",
    }


@dataclasses.dataclass(frozen=True)
class GqlQuoteTypeData:
    """Quote type metadata for a symbol (exchange, timezone, identifiers)."""

    exchange: str | None = None
    first_trade_date_epoch_utc: int | None = None
    gmt_off_set_milliseconds: int | None = None
    long_name: str | None = None
    max_age: int | None = None
    message_board_id: str | None = None
    quote_type: str | None = None
    short_name: str | None = None
    symbol: str | None = None
    time_zone_full_name: str | None = None
    time_zone_short_name: str | None = None
    underlying_symbol: str | None = None
    uuid: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "first_trade_date_epoch_utc": "firstTradeDateEpochUtc",
        "gmt_off_set_milliseconds": "gmtOffSetMilliseconds",
        "long_name": "longName",
        "max_age": "maxAge",
        "message_board_id": "messageBoardId",
        "quote_type": "quoteType",
        "short_name": "shortName",
        "time_zone_full_name": "timeZoneFullName",
        "time_zone_short_name": "timeZoneShortName",
        "underlying_symbol": "underlyingSymbol",
    }


@dataclasses.dataclass(frozen=True)
class GqlQuotesBatch:
    """Result of the batch `quotes` root field: successfully fetched quotes plus
any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    quotes: Page_GqlQuote


@dataclasses.dataclass(frozen=True)
class GqlRatingConsensus:
    """Mirrors `finance_query::RatingConsensus`."""

    buy: int | None = None
    consensus: str | None = None
    hold: int | None = None
    sell: int | None = None
    strong_buy: int | None = None
    strong_sell: int | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "strong_buy": "strongBuy",
        "strong_sell": "strongSell",
    }


@dataclasses.dataclass(frozen=True)
class GqlRecommendation:
    """Similar-stock recommendations for one symbol, mirroring
`finance_query::Recommendation`, which has no serde rename of its own
(plain snake_case JSON keys, e.g. `provider_id`) — `alias` keeps
deserialization accepting those keys while `rename_all` documents the
camelCase names GraphQL actually puts on the wire."""

    recommendations: list[GqlSimilarSymbol]
    symbol: str
    provider_id: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "provider_id": "providerId",
    }


@dataclasses.dataclass(frozen=True)
class GqlRecommendationsBatch:
    """Result of the batch `recommendationsBatch` root field: successfully
fetched recommendations plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    recommendations: Page_GqlRecommendation


@dataclasses.dataclass(frozen=True)
class GqlResearchReport:
    """A research report result from `search`."""

    author: str | None = None
    id: str | None = None
    provider: str | None = None
    report_date: int | None = None
    report_headline: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "report_date": "reportDate",
        "report_headline": "reportHeadline",
    }


@dataclasses.dataclass(frozen=True)
class GqlRiskFactor:
    """Mirrors `finance_query::RiskFactor`."""

    category: str | None = None
    filing_date: str | None = None
    text: str | None = None
    title: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "filing_date": "filingDate",
    }


@dataclasses.dataclass(frozen=True)
class GqlRiskSummary:
    """Risk/performance summary for a symbol."""

    cvar95: float
    cvar99: float
    kelly: float
    max_drawdown: float
    omega: float
    parametric_cvar95: float
    parametric_var95: float
    ulcer_index: float
    var95: float
    var99: float
    beta: float | None = None
    calmar: float | None = None
    information_ratio: float | None = None
    max_drawdown_recovery_periods: float | None = None
    sharpe: float | None = None
    sortino: float | None = None
    tracking_error: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "information_ratio": "informationRatio",
        "max_drawdown": "maxDrawdown",
        "max_drawdown_recovery_periods": "maxDrawdownRecoveryPeriods",
        "parametric_cvar95": "parametricCvar95",
        "parametric_var95": "parametricVar95",
        "tracking_error": "trackingError",
        "ulcer_index": "ulcerIndex",
    }


@dataclasses.dataclass(frozen=True)
class GqlScreenerQuote:
    """A single quote result from a predefined or custom screener."""

    exchange: str
    quote_type: str
    regular_market_change: GqlFormattedValue
    regular_market_change_percent: GqlFormattedValue
    regular_market_price: GqlFormattedValue
    short_name: str
    symbol: str
    ask: GqlFormattedValue | None = None
    ask_size: GqlFormattedValue | None = None
    average_analyst_rating: str | None = None
    average_daily_volume10_day: GqlFormattedValue | None = None
    average_daily_volume3_month: GqlFormattedValue | None = None
    bid: GqlFormattedValue | None = None
    bid_size: GqlFormattedValue | None = None
    book_value: GqlFormattedValue | None = None
    currency: str | None = None
    display_name: str | None = None
    dividend_date: GqlFormattedValue | None = None
    dividend_rate: GqlFormattedValue | None = None
    dividend_yield: GqlFormattedValue | None = None
    earnings_timestamp: GqlFormattedValue | None = None
    earnings_timestamp_end: GqlFormattedValue | None = None
    earnings_timestamp_start: GqlFormattedValue | None = None
    eps_current_year: GqlFormattedValue | None = None
    eps_forward: GqlFormattedValue | None = None
    eps_trailing_twelve_months: GqlFormattedValue | None = None
    fifty_day_average: GqlFormattedValue | None = None
    fifty_day_average_change: GqlFormattedValue | None = None
    fifty_day_average_change_percent: GqlFormattedValue | None = None
    fifty_two_week_change: GqlFormattedValue | None = None
    fifty_two_week_change_percent: GqlFormattedValue | None = None
    fifty_two_week_high: GqlFormattedValue | None = None
    fifty_two_week_low: GqlFormattedValue | None = None
    forward_pe: GqlFormattedValue | None = None
    long_name: str | None = None
    market_cap: GqlFormattedValue | None = None
    post_market_change: GqlFormattedValue | None = None
    post_market_change_percent: GqlFormattedValue | None = None
    post_market_price: GqlFormattedValue | None = None
    post_market_time: GqlFormattedValue | None = None
    pre_market_change: GqlFormattedValue | None = None
    pre_market_change_percent: GqlFormattedValue | None = None
    pre_market_price: GqlFormattedValue | None = None
    pre_market_time: GqlFormattedValue | None = None
    price_eps_current_year: GqlFormattedValue | None = None
    price_to_book: GqlFormattedValue | None = None
    regular_market_day_high: GqlFormattedValue | None = None
    regular_market_day_low: GqlFormattedValue | None = None
    regular_market_open: GqlFormattedValue | None = None
    regular_market_previous_close: GqlFormattedValue | None = None
    regular_market_time: GqlFormattedValue | None = None
    regular_market_volume: GqlFormattedValue | None = None
    shares_outstanding: GqlFormattedValue | None = None
    trailing_annual_dividend_rate: GqlFormattedValue | None = None
    trailing_annual_dividend_yield: GqlFormattedValue | None = None
    trailing_pe: GqlFormattedValue | None = None
    two_hundred_day_average: GqlFormattedValue | None = None
    two_hundred_day_average_change: GqlFormattedValue | None = None
    two_hundred_day_average_change_percent: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "ask_size": "askSize",
        "average_analyst_rating": "averageAnalystRating",
        "average_daily_volume10_day": "averageDailyVolume10Day",
        "average_daily_volume3_month": "averageDailyVolume3Month",
        "bid_size": "bidSize",
        "book_value": "bookValue",
        "display_name": "displayName",
        "dividend_date": "dividendDate",
        "dividend_rate": "dividendRate",
        "dividend_yield": "dividendYield",
        "earnings_timestamp": "earningsTimestamp",
        "earnings_timestamp_end": "earningsTimestampEnd",
        "earnings_timestamp_start": "earningsTimestampStart",
        "eps_current_year": "epsCurrentYear",
        "eps_forward": "epsForward",
        "eps_trailing_twelve_months": "epsTrailingTwelveMonths",
        "fifty_day_average": "fiftyDayAverage",
        "fifty_day_average_change": "fiftyDayAverageChange",
        "fifty_day_average_change_percent": "fiftyDayAverageChangePercent",
        "fifty_two_week_change": "fiftyTwoWeekChange",
        "fifty_two_week_change_percent": "fiftyTwoWeekChangePercent",
        "fifty_two_week_high": "fiftyTwoWeekHigh",
        "fifty_two_week_low": "fiftyTwoWeekLow",
        "forward_pe": "forwardPE",
        "long_name": "longName",
        "market_cap": "marketCap",
        "post_market_change": "postMarketChange",
        "post_market_change_percent": "postMarketChangePercent",
        "post_market_price": "postMarketPrice",
        "post_market_time": "postMarketTime",
        "pre_market_change": "preMarketChange",
        "pre_market_change_percent": "preMarketChangePercent",
        "pre_market_price": "preMarketPrice",
        "pre_market_time": "preMarketTime",
        "price_eps_current_year": "priceEpsCurrentYear",
        "price_to_book": "priceToBook",
        "quote_type": "quoteType",
        "regular_market_change": "regularMarketChange",
        "regular_market_change_percent": "regularMarketChangePercent",
        "regular_market_day_high": "regularMarketDayHigh",
        "regular_market_day_low": "regularMarketDayLow",
        "regular_market_open": "regularMarketOpen",
        "regular_market_previous_close": "regularMarketPreviousClose",
        "regular_market_price": "regularMarketPrice",
        "regular_market_time": "regularMarketTime",
        "regular_market_volume": "regularMarketVolume",
        "shares_outstanding": "sharesOutstanding",
        "short_name": "shortName",
        "trailing_annual_dividend_rate": "trailingAnnualDividendRate",
        "trailing_annual_dividend_yield": "trailingAnnualDividendYield",
        "trailing_pe": "trailingPE",
        "two_hundred_day_average": "twoHundredDayAverage",
        "two_hundred_day_average_change": "twoHundredDayAverageChange",
        "two_hundred_day_average_change_percent": "twoHundredDayAverageChangePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlScreenerResults:
    """Results from a predefined or custom screener."""

    quotes: list[GqlScreenerQuote]
    type: str
    description: str | None = None
    last_updated: int | None = None
    page_info: GqlPageInfo | None = None
    total: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "last_updated": "lastUpdated",
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class GqlSearchNews:
    """A news article result from `search`."""

    link: str | None = None
    provider_publish_time: int | None = None
    publisher: str | None = None
    related_tickers: list[str] | None = None
    thumbnail: typing.Any | None = None
    title: str | None = None
    type: str | None = None
    uuid: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "provider_publish_time": "providerPublishTime",
        "related_tickers": "relatedTickers",
    }


@dataclasses.dataclass(frozen=True)
class GqlSearchQuote:
    """A quote/symbol result from `search`."""

    symbol: str
    disp_sec_ind_flag: bool | None = None
    exch_disp: str | None = None
    exchange: str | None = None
    industry: str | None = None
    industry_disp: str | None = None
    is_yahoo_finance: bool | None = None
    logo_url: str | None = None
    long_name: str | None = None
    quote_type: str | None = None
    score: float | None = None
    sector: str | None = None
    sector_disp: str | None = None
    short_name: str | None = None
    type_disp: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "disp_sec_ind_flag": "dispSecIndFlag",
        "exch_disp": "exchDisp",
        "industry_disp": "industryDisp",
        "is_yahoo_finance": "isYahooFinance",
        "logo_url": "logoUrl",
        "long_name": "longName",
        "quote_type": "quoteType",
        "sector_disp": "sectorDisp",
        "short_name": "shortName",
        "type_disp": "typeDisp",
    }


@dataclasses.dataclass(frozen=True)
class GqlSearchResults:
    """Combined search results: quotes, news, and research reports."""

    news: list[GqlSearchNews]
    quotes: Page_GqlSearchQuote
    research_reports: list[GqlResearchReport]
    count: int | None = None
    total_time: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "research_reports": "researchReports",
        "total_time": "totalTime",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorCompany:
    symbol: str
    day_change_percent: GqlFormattedValue | None = None
    last_price: GqlFormattedValue | None = None
    market_cap: GqlFormattedValue | None = None
    market_weight: GqlFormattedValue | None = None
    name: str | None = None
    rating: str | None = None
    target_price: GqlFormattedValue | None = None
    ytd_return: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "last_price": "lastPrice",
        "market_cap": "marketCap",
        "market_weight": "marketWeight",
        "target_price": "targetPrice",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorData:
    industries: list[GqlSectorIndustry]
    key: str
    name: str
    research_reports: list[GqlSectorResearchReport]
    top_companies: list[GqlSectorCompany]
    top_etfs: list[GqlSectorETF]
    top_mutual_funds: list[GqlSectorMutualFund]
    benchmark: GqlSectorPerformance | None = None
    benchmark_name: str | None = None
    overview: GqlSectorOverview | None = None
    performance: GqlSectorPerformance | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "benchmark_name": "benchmarkName",
        "research_reports": "researchReports",
        "top_companies": "topCompanies",
        "top_etfs": "topEtfs",
        "top_mutual_funds": "topMutualFunds",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorETF:
    symbol: str
    expense_ratio: GqlFormattedValue | None = None
    last_price: GqlFormattedValue | None = None
    name: str | None = None
    net_assets: GqlFormattedValue | None = None
    ytd_return: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "expense_ratio": "expenseRatio",
        "last_price": "lastPrice",
        "net_assets": "netAssets",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorIndustry:
    name: str
    day_change_percent: GqlFormattedValue | None = None
    key: str | None = None
    market_weight: GqlFormattedValue | None = None
    symbol: str | None = None
    ytd_return: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "market_weight": "marketWeight",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorMutualFund:
    symbol: str
    expense_ratio: GqlFormattedValue | None = None
    last_price: GqlFormattedValue | None = None
    name: str | None = None
    net_assets: GqlFormattedValue | None = None
    ytd_return: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "expense_ratio": "expenseRatio",
        "last_price": "lastPrice",
        "net_assets": "netAssets",
        "ytd_return": "ytdReturn",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorOverview:
    companies_count: int | None = None
    description: str | None = None
    employee_count: GqlFormattedValue | None = None
    industries_count: int | None = None
    market_cap: GqlFormattedValue | None = None
    market_weight: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "companies_count": "companiesCount",
        "employee_count": "employeeCount",
        "industries_count": "industriesCount",
        "market_cap": "marketCap",
        "market_weight": "marketWeight",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorPerformance:
    day_change_percent: GqlFormattedValue | None = None
    five_year_change_percent: GqlFormattedValue | None = None
    one_year_change_percent: GqlFormattedValue | None = None
    three_year_change_percent: GqlFormattedValue | None = None
    ytd_change_percent: GqlFormattedValue | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "day_change_percent": "dayChangePercent",
        "five_year_change_percent": "fiveYearChangePercent",
        "one_year_change_percent": "oneYearChangePercent",
        "three_year_change_percent": "threeYearChangePercent",
        "ytd_change_percent": "ytdChangePercent",
    }


@dataclasses.dataclass(frozen=True)
class GqlSectorPerformanceHistory:
    """Sector performance for one date."""

    sectors: list[GqlSectorPerformance]
    date: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlSectorResearchReport:
    id: str
    headline: str | None = None
    investment_rating: str | None = None
    provider: str | None = None
    report_date: str | None = None
    report_title: str | None = None
    report_type: str | None = None
    target_price: float | None = None
    target_price_status: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "investment_rating": "investmentRating",
        "report_date": "reportDate",
        "report_title": "reportTitle",
        "report_type": "reportType",
        "target_price": "targetPrice",
        "target_price_status": "targetPriceStatus",
    }


@dataclasses.dataclass(frozen=True)
class GqlSentence:
    end: float
    start: float
    text: str
    words: list[GqlWord]


@dataclasses.dataclass(frozen=True)
class GqlSentiment:
    """Lexicon-based sentiment score for a news article's title."""

    confidence: float
    label: str
    score: float


@dataclasses.dataclass(frozen=True)
class GqlShortVolume:
    """One day of FINRA short-sale volume."""

    date: str | None = None
    short_exempt_volume: float | None = None
    short_volume: float | None = None
    total_volume: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "short_exempt_volume": "shortExemptVolume",
        "short_volume": "shortVolume",
        "total_volume": "totalVolume",
    }


@dataclasses.dataclass(frozen=True)
class GqlSimilarSymbol:
    """A single recommended/similar symbol with its similarity score."""

    score: float
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSpark:
    """Lightweight sparkline data for a single symbol (close prices only)."""

    closes: list[float]
    meta: GqlChartMeta
    symbol: str
    timestamps: list[int]
    interval: str | None = None
    range: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlSparkBatch:
    """Result of the batch `spark` root field: successfully fetched sparklines
plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    sparks: list[GqlSpark]


@dataclasses.dataclass(frozen=True)
class GqlSpeakerData:
    name: str
    company: str | None = None
    role: str | None = None


@dataclasses.dataclass(frozen=True)
class GqlSpeakerMapping:
    speaker: int
    speaker_data: GqlSpeakerData

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "speaker_data": "speakerData",
    }


@dataclasses.dataclass(frozen=True)
class GqlSplit:
    """A single stock split."""

    denominator: float
    numerator: float
    ratio: str
    timestamp: int


@dataclasses.dataclass(frozen=True)
class GqlSplitsBatch:
    """Result of the batch `splitsBatch` root field: successfully fetched split
histories plus any per-symbol fetch errors."""

    errors: list[GqlBatchError]
    splits: list[GqlSymbolSplits]


@dataclasses.dataclass(frozen=True)
class GqlStochasticData:
    """Mirrors `finance_query::indicators::summary::StochasticData`, whose `k`/`d`
fields serialize as `"%K"`/`"%D"` (a custom per-field rename, not plain
camelCase) — must match exactly for deserialization to find them."""

    d: float | None = None
    k: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlSuperTrendData:
    trend: str | None = None
    value: float | None = None


@dataclasses.dataclass(frozen=True)
class GqlSymbolCapitalGains:
    """Wrapper for batch capital gains: `{symbol, capitalGains}`."""

    capital_gains: list[GqlCapitalGain]
    symbol: str

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "capital_gains": "capitalGains",
    }


@dataclasses.dataclass(frozen=True)
class GqlSymbolChart:
    """Wraps a symbol name with its chart data, used by the batch `charts` root field."""

    chart: GqlChart
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSymbolDetails:
    """Reference detail for one symbol, provider-routed (Capability::DISCOVERY)."""

    symbol: str
    active: bool | None = None
    asset_type: str | None = None
    cik: str | None = None
    composite_figi: str | None = None
    delisted_utc: str | None = None
    description: str | None = None
    employees: int | None = None
    exchange: str | None = None
    homepage_url: str | None = None
    list_date: str | None = None
    market_cap: float | None = None
    name: str | None = None
    provider_id: str | None = None
    share_class_figi: str | None = None
    shares_outstanding: float | None = None
    sic_code: str | None = None
    sic_description: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_type": "assetType",
        "composite_figi": "compositeFigi",
        "delisted_utc": "delistedUtc",
        "homepage_url": "homepageUrl",
        "list_date": "listDate",
        "market_cap": "marketCap",
        "provider_id": "providerId",
        "share_class_figi": "shareClassFigi",
        "shares_outstanding": "sharesOutstanding",
        "sic_code": "sicCode",
        "sic_description": "sicDescription",
    }


@dataclasses.dataclass(frozen=True)
class GqlSymbolDividends:
    """Wrapper for batch dividends: `{symbol, dividends}`. `dividends` is a plain
payment list here (mirrors `BatchDividendsResponse.dividends:
HashMap<String, Vec<Dividend>>`) — batch dividends has no per-symbol
analytics, unlike the single-symbol `GqlDividends`."""

    dividends: list[GqlDividend]
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSymbolFinancials:
    """Wrapper for batch financials: `{symbol, statement}` — `statement` is every
line item in that symbol's statement, not a single one."""

    statement: list[GqlFinancialLineItem]
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSymbolIndicators:
    """Wraps a symbol name with its indicators, used by the batch root field."""

    indicators: GqlIndicatorsSummary
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSymbolMatch:
    """Mirrors `finance_query::crypto::SymbolMatch` — the provider-neutral
discovery shape, here populated from CoinGecko's coin universe."""

    symbol: str
    active: bool | None = None
    asset_type: str | None = None
    currency: str | None = None
    delisted_date: str | None = None
    exchange: str | None = None
    id: str | None = None
    image: str | None = None
    ipo_date: str | None = None
    market_cap_rank: int | None = None
    name: str | None = None
    thumbnail: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "asset_type": "assetType",
        "delisted_date": "delistedDate",
        "ipo_date": "ipoDate",
        "market_cap_rank": "marketCapRank",
    }


@dataclasses.dataclass(frozen=True)
class GqlSymbolOptions:
    """Wraps a symbol name with its options chain, used by the batch
`optionsBatch` root field."""

    options: GqlOptions
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlSymbolSplits:
    """Wrapper for batch splits: `{symbol, splits}`."""

    splits: list[GqlSplit]
    symbol: str


@dataclasses.dataclass(frozen=True)
class GqlTrade:
    """One completed round trip."""

    commission: float
    dividend_income: float
    entry_price: float
    entry_quantity: float
    entry_signal: GqlTradeSignal
    entry_timestamp: int
    exit_price: float
    exit_signal: GqlTradeSignal
    exit_timestamp: int
    financing_cost: float
    is_partial: bool
    pnl: float
    quantity: float
    return_pct: float
    scale_sequence: int
    side: str
    tags: list[str]
    transaction_tax: float
    unreinvested_dividends: float

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "dividend_income": "dividendIncome",
        "entry_price": "entryPrice",
        "entry_quantity": "entryQuantity",
        "entry_signal": "entrySignal",
        "entry_timestamp": "entryTimestamp",
        "exit_price": "exitPrice",
        "exit_signal": "exitSignal",
        "exit_timestamp": "exitTimestamp",
        "financing_cost": "financingCost",
        "is_partial": "isPartial",
        "return_pct": "returnPct",
        "scale_sequence": "scaleSequence",
        "transaction_tax": "transactionTax",
        "unreinvested_dividends": "unreinvestedDividends",
    }


@dataclasses.dataclass(frozen=True)
class GqlTradeSignal:
    """The signal that opened or closed a trade."""

    direction: str
    price: float
    strength: float
    timestamp: int
    reason: str | None = None
    tags: list[str] | None = None


@dataclasses.dataclass(frozen=True)
class GqlTranscript:
    transcript_content: GqlTranscriptContent
    transcript_metadata: GqlTranscriptMetadata

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "transcript_content": "transcriptContent",
        "transcript_metadata": "transcriptMetadata",
    }


@dataclasses.dataclass(frozen=True)
class GqlTranscriptContent:
    company_id: int
    event_id: int
    speaker_mapping: list[GqlSpeakerMapping]
    transcript: GqlTranscriptData | None = None
    version: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "company_id": "companyId",
        "event_id": "eventId",
        "speaker_mapping": "speakerMapping",
    }


@dataclasses.dataclass(frozen=True)
class GqlTranscriptData:
    number_of_speakers: int
    paragraphs: Page_GqlParagraph
    text: str

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "number_of_speakers": "numberOfSpeakers",
    }


@dataclasses.dataclass(frozen=True)
class GqlTranscriptMetadata:
    date: int
    event_id: int
    event_type: str
    fiscal_period: str
    fiscal_year: int
    is_latest: bool
    s3_url: str
    title: str
    transcript_id: int
    transcript_type: str
    updated: int

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "event_id": "eventId",
        "event_type": "eventType",
        "fiscal_period": "fiscalPeriod",
        "fiscal_year": "fiscalYear",
        "is_latest": "isLatest",
        "s3_url": "s3Url",
        "transcript_id": "transcriptId",
        "transcript_type": "transcriptType",
    }


@dataclasses.dataclass(frozen=True)
class GqlTranscriptWithMeta:
    event_id: str
    title: str
    transcript: GqlTranscript
    url: str
    quarter: str | None = None
    year: int | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "event_id": "eventId",
    }


@dataclasses.dataclass(frozen=True)
class GqlTreasuryAuction:
    """One US Treasury securities auction. Rows exist from announcement onwards,
so an auction that has not been held yet carries its terms with every
result field `null`. Bills report `highDiscntRate`/`highInvestmentRate`
and leave `highYield` unset; notes and bonds do the reverse."""

    auction_date: str
    cusip: str
    issue_date: str
    maturity_date: str
    record_date: str
    security_term: str
    security_type: str
    auction_format: str | None = None
    bid_to_cover_ratio: float | None = None
    comp_accepted: float | None = None
    direct_bidder_accepted: float | None = None
    high_discnt_rate: float | None = None
    high_investment_rate: float | None = None
    high_price: float | None = None
    high_yield: float | None = None
    indirect_bidder_accepted: float | None = None
    int_rate: float | None = None
    noncomp_accepted: float | None = None
    offering_amt: float | None = None
    primary_dealer_accepted: float | None = None
    reopening: bool | None = None
    soma_accepted: float | None = None
    total_accepted: float | None = None
    total_tendered: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "auction_date": "auctionDate",
        "auction_format": "auctionFormat",
        "bid_to_cover_ratio": "bidToCoverRatio",
        "comp_accepted": "compAccepted",
        "direct_bidder_accepted": "directBidderAccepted",
        "high_discnt_rate": "highDiscntRate",
        "high_investment_rate": "highInvestmentRate",
        "high_price": "highPrice",
        "high_yield": "highYield",
        "indirect_bidder_accepted": "indirectBidderAccepted",
        "int_rate": "intRate",
        "issue_date": "issueDate",
        "maturity_date": "maturityDate",
        "noncomp_accepted": "noncompAccepted",
        "offering_amt": "offeringAmt",
        "primary_dealer_accepted": "primaryDealerAccepted",
        "record_date": "recordDate",
        "security_term": "securityTerm",
        "security_type": "securityType",
        "soma_accepted": "somaAccepted",
        "total_accepted": "totalAccepted",
        "total_tendered": "totalTendered",
    }


@dataclasses.dataclass(frozen=True)
class GqlTreasuryYield:
    """One day of US Treasury yield curve rates. Maturities with no published
rate on a given date are `null`."""

    date: str
    y1: float | None = None
    y10: float | None = None
    y1_m: float | None = None
    y2: float | None = None
    y20: float | None = None
    y2_m: float | None = None
    y3: float | None = None
    y30: float | None = None
    y3_m: float | None = None
    y4_m: float | None = None
    y5: float | None = None
    y6_m: float | None = None
    y7: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "y1_m": "y1M",
        "y2_m": "y2M",
        "y3_m": "y3M",
        "y4_m": "y4M",
        "y6_m": "y6M",
    }


@dataclasses.dataclass(frozen=True)
class GqlTrendingCoin:
    """Mirrors `finance_query::crypto::TrendingCoin` — plain snake_case JSON keys,
same no-serde-rename rule as [`GqlCoinQuote`]."""

    id: str | None = None
    market_cap_rank: int | None = None
    name: str | None = None
    price_btc: float | None = None
    score: int | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "market_cap_rank": "marketCapRank",
        "price_btc": "priceBtc",
    }


@dataclasses.dataclass(frozen=True)
class GqlTrendingQuote:
    """A trending ticker."""

    regular_market_change_percent: GqlFormattedValue | None = None
    regular_market_price: GqlFormattedValue | None = None
    short_name: str | None = None
    symbol: str | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "regular_market_change_percent": "regularMarketChangePercent",
        "regular_market_price": "regularMarketPrice",
        "short_name": "shortName",
    }


@dataclasses.dataclass(frozen=True)
class GqlTvlPoint:
    """One point on a protocol's TVL history."""

    timestamp: int
    tvl: float


@dataclasses.dataclass(frozen=True)
class GqlUpcomingAuction:
    """A US Treasury auction scheduled but not yet held. `offeringAmt` stays
`null` until Treasury formally announces the auction's terms."""

    announcement_date: str
    auction_date: str
    cusip: str
    issue_date: str
    record_date: str
    security_term: str
    security_type: str
    offering_amt: float | None = None
    reopening: bool | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "announcement_date": "announcementDate",
        "auction_date": "auctionDate",
        "issue_date": "issueDate",
        "offering_amt": "offeringAmt",
        "record_date": "recordDate",
        "security_term": "securityTerm",
        "security_type": "securityType",
    }


@dataclasses.dataclass(frozen=True)
class GqlWord:
    confidence: float
    end: float
    punctuated_word: str
    start: float
    word: str

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "punctuated_word": "punctuatedWord",
    }


@dataclasses.dataclass(frozen=True)
class GqlZigZagPoint:
    """Mirrors `finance_query::indicators::ZigZagPoint`, which has no serde
rename of its own (plain snake_case keys)."""

    index: int | None = None
    is_high: bool | None = None
    price: float | None = None

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "is_high": "isHigh",
    }


@dataclasses.dataclass(frozen=True)
class HealthResponse:
    """Body of `GET /v2/health`."""

    notices: list[str]
    status: str
    timestamp: str
    version: str


@dataclasses.dataclass(frozen=True)
class Page_GqlCandle:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlCandle]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlCotObservation:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlCotObservation]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlDividend:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlDividend]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlEdgarFiling:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlEdgarFiling]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlEquityPoint:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlEquityPoint]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlFactDataPoint:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlFactDataPoint]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlMacroObservation:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlMacroObservation]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlOptionContract:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlOptionContract]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlParagraph:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlParagraph]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlQuote:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlQuote]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlRecommendation:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlRecommendation]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlSearchQuote:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlSearchQuote]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlSymbolChart:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlSymbolChart]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlSymbolDividends:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlSymbolDividends]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlSymbolIndicators:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlSymbolIndicators]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlSymbolOptions:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlSymbolOptions]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class Page_GqlTrade:
    edges: list[dict[str, typing.Any]]
    nodes: list[GqlTrade]
    page_info: dict[str, typing.Any]

    _WIRE: typing.ClassVar[dict[str, str]] = {
        "page_info": "pageInfo",
    }


@dataclasses.dataclass(frozen=True)
class PingResponse:
    """Body of `GET /v2/ping`."""

    message: str


AnalysisResponse = typing.Any

AnalysisType = typing.Literal["recommendations", "upgrades-downgrades", "earnings-estimate", "earnings-history"]

FilingSectionFormParam = typing.Literal["ten-k", "eight-k"]

Frequency = typing.Literal["annual", "quarterly"]

GqlEventKind = dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any]

GqlFormattedValue = int | float | str | GqlFormattedObject | typing.Any

GqlMarketCalendarDetail = dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any] | dict[str, typing.Any]

HolderType = typing.Literal["major", "institutional", "mutualfund", "insider-transactions", "insider-purchases", "insider-roster"]

HoldersResponse = typing.Any

Industry = typing.Literal["agricultural-inputs", "aluminum", "coal", "copper", "farm-products", "forest-products", "gold", "lumber-wood-production", "other-industrial-metals-mining", "other-precious-metals-mining", "silver", "steel", "thermal-coal", "uranium", "apparel-manufacturing", "apparel-retail", "auto-truck-dealerships", "auto-manufacturers", "auto-parts", "beverages-brewers", "beverages-non-alcoholic", "beverages-wineries-distilleries", "confectioners", "department-stores", "discount-stores", "electronic-gaming-multimedia", "food-distribution", "footwear-accessories", "furnishings-fixtures-appliances", "gambling", "grocery-stores", "home-improvement-retail", "household-personal-products", "internet-retail", "leisure", "lodging", "luxury-goods", "packaged-foods", "personal-services", "residential-construction", "resorts-casinos", "restaurants", "specialty-retail", "textile-manufacturing", "tobacco", "travel-services", "oil-gas-drilling", "oil-gas-ep", "oil-gas-equipment-services", "oil-gas-integrated", "oil-gas-midstream", "oil-gas-refining-marketing", "solar", "asset-management", "banks-diversified", "banks-regional", "capital-markets", "credit-services", "financial-data-stock-exchanges", "insurance-brokers", "insurance-diversified", "insurance-life", "insurance-property-casualty", "insurance-reinsurance", "insurance-specialty", "mortgage-finance", "shell-companies", "biotechnology", "diagnostics-research", "drug-manufacturers-general", "drug-manufacturers-specialty-generic", "health-information-services", "healthcare-plans", "medical-care-facilities", "medical-devices", "medical-distribution", "medical-instruments-supplies", "pharmaceutical-retailers", "aerospace-defense", "building-materials", "building-products-equipment", "business-equipment-supplies", "chemical-manufacturing", "chemicals", "conglomerates", "consulting-services", "electrical-equipment-parts", "engineering-construction", "farm-heavy-construction-machinery", "industrial-distribution", "infrastructure-operations", "integrated-freight-logistics", "manufacturing-diversified", "marine-ports-services", "marine-shipping", "metal-fabrication", "paper-paper-products", "pollution-treatment-controls", "railroads", "rental-leasing-services", "security-protection-services", "specialty-business-services", "specialty-chemicals", "specialty-industrial-machinery", "staffing-employment-services", "tools-accessories", "trucking", "waste-management", "real-estate-development", "real-estate-diversified", "real-estate-services", "reit-diversified", "reit-healthcare-facilities", "reit-hotel-motel", "reit-industrial", "reit-mortgage", "reit-office", "reit-residential", "reit-retail", "reit-specialty", "communication-equipment", "computer-hardware", "consumer-electronics", "data-analytics", "electronic-components", "electronics-computer-distribution", "hardware-software-distribution", "information-technology-services", "internet-content-information", "scientific-technical-instruments", "semiconductor-equipment-materials", "semiconductors", "software-application", "software-infrastructure", "broadcasting", "entertainment", "publishing", "telecom-services", "utilities-diversified", "utilities-independent-power-producers", "utilities-regulated-electric", "utilities-regulated-gas", "utilities-regulated-water", "utilities-renewable", "closed-end-fund-debt", "closed-end-fund-equity", "closed-end-fund-foreign", "exchange-traded-fund"]

Interval = typing.Literal["1m", "2m", "5m", "15m", "30m", "1h", "90m", "1d", "5d", "1wk", "1mo", "3mo"]

LookupType = typing.Literal["all", "equity", "mutualfund", "etf", "index", "future", "currency", "cryptocurrency"]

MarketCalendarKindParam = typing.Literal["earnings", "ipo", "dividend", "split", "economic", "market-holiday", "market-status"]

MetricsText = str

Quarter = typing.Literal["Q1", "Q2", "Q3", "Q4"]

QuoteType = typing.Literal["EQUITY", "MUTUALFUND"]

Region = typing.Literal["AR", "AU", "BR", "CA", "CN", "DK", "FI", "FR", "DE", "GR", "HK", "IN", "IL", "IT", "JP", "KR", "MY", "MX", "NZ", "NO", "PT", "QA", "RU", "SG", "ES", "SE", "TW", "TH", "TR", "GB", "US", "VN"]

Screener = typing.Literal["aggressive-small-caps", "day-gainers", "day-losers", "growth-technology-stocks", "most-actives", "most-shorted-stocks", "small-cap-gainers", "undervalued-growth-stocks", "undervalued-large-caps", "conservative-foreign-funds", "high-yield-bond", "portfolio-anchors", "solid-large-growth-funds", "solid-midcap-growth-funds", "top-mutual-funds"]

Sector = typing.Literal["technology", "financial-services", "consumer-cyclical", "communication-services", "healthcare", "industrials", "consumer-defensive", "energy", "basic-materials", "real-estate", "utilities"]

SortType = typing.Literal["ASC", "DESC"]

StatementType = typing.Literal["income", "balance", "cashflow"]

TimeRange = typing.Literal["1d", "5d", "1mo", "3mo", "6mo", "1y", "2y", "5y", "10y", "ytd", "max"]

ValueFormat = typing.Literal["raw", "pretty", "both"]

indices_Region = typing.Literal["americas", "europe", "asia-pacific", "middle-east-africa", "currencies"]