ccxt-base 4.5.78

CCXT – CryptoCurrency eXchange Trading Library (Rust) – untyped engine (runtime, Value, REST/prediction Cores, WS infra)
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
// PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
// https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code

// Generated from `ts/src/base/PredictionExchange.ts` — methods below the
// "METHODS BELOW THIS LINE ARE TRANSPILED" marker. Everything
// above the marker is hand-written (src/exchange.rs / src/prediction_exchange.rs).

#![allow(unused, non_snake_case, clippy::all)]

use crate::Value;
use crate::ExchangeError;
use crate::exchange::Exchange;
use crate::exchange::ExchangeRuntime;
use crate::exchange_generated::ExchangeBase;
use crate::prediction_exchange::PredictionRuntime;
use crate::prediction_exchange::PredictionExchange;
use crate::runtime::*;

pub trait PredictionBase: crate::exchange_generated::ExchangeBase {
    /// Borrow the PredictionExchange holding the prediction-tier fields.
    fn pred(&self) -> &crate::prediction_exchange::PredictionExchange;
    fn pred_mut(&mut self) -> &mut crate::prediction_exchange::PredictionExchange;


    fn describe(&self) -> Value {
        return self.deep_extend(self.super_describe(), &[Value::Map({
    let mut m = indexmap::IndexMap::new();
        m.insert("has".to_string(), Value::Map({
    let mut m = indexmap::IndexMap::new();
        m.insert("prediction".to_string(), Value::Bool(true));
        m.insert("approve".to_string(), Value::Bool(false));
        m.insert("redeem".to_string(), Value::Bool(false));
        m.insert("fetchEvent".to_string(), Value::Bool(false));
        m.insert("fetchEvents".to_string(), Value::Bool(false));
        m.insert("fetchOutcome".to_string(), Value::Bool(false));
        m.insert("fetchSettlements".to_string(), Value::Bool(false));
        m.insert("createOrder".to_string(), Value::Bool(false));
        m.insert("createOrders".to_string(), Value::Bool(false));
        m.insert("createLimitOrder".to_string(), Value::Bool(false));
        m.insert("createMarketOrder".to_string(), Value::Bool(false));
        m.insert("createMarketOrderWs".to_string(), Value::Bool(false));
        m.insert("createMarketBuyOrderWithCost".to_string(), Value::Bool(false));
        m.insert("cancelOrder".to_string(), Value::Bool(false));
        m.insert("cancelOrders".to_string(), Value::Bool(false));
        m.insert("cancelAllOrders".to_string(), Value::Bool(false));
        m.insert("editOrder".to_string(), Value::Bool(false));
        m.insert("fetchBalance".to_string(), Value::Bool(false));
        m.insert("fetchOrder".to_string(), Value::Bool(false));
        m.insert("fetchOrders".to_string(), Value::Bool(false));
        m.insert("fetchOrdersByIds".to_string(), Value::Bool(false));
        m.insert("fetchOrderTrades".to_string(), Value::Bool(false));
        m.insert("fetchOpenOrders".to_string(), Value::Bool(false));
        m.insert("fetchClosedOrders".to_string(), Value::Bool(false));
        m.insert("fetchCanceledOrders".to_string(), Value::Bool(false));
        m.insert("fetchMyTrades".to_string(), Value::Bool(false));
        m.insert("fetchPosition".to_string(), Value::Bool(false));
        m.insert("fetchPositions".to_string(), Value::Bool(false));
        m.insert("fetchAccounts".to_string(), Value::Bool(false));
        m.insert("fetchLedger".to_string(), Value::Bool(false));
        m.insert("fetchDeposits".to_string(), Value::Bool(false));
        m.insert("fetchWithdrawals".to_string(), Value::Bool(false));
        m.insert("fetchMarkets".to_string(), Value::Bool(false));
        m.insert("fetchCurrencies".to_string(), Value::Bool(false));
        m.insert("fetchTicker".to_string(), Value::Bool(false));
        m.insert("fetchTickers".to_string(), Value::Bool(false));
        m.insert("fetchOrderBook".to_string(), Value::Bool(false));
        m.insert("fetchL2OrderBook".to_string(), Value::Bool(false));
        m.insert("fetchOHLCV".to_string(), Value::Bool(false));
        m.insert("fetchTrades".to_string(), Value::Bool(false));
        m.insert("fetchStatus".to_string(), Value::Bool(false));
        m.insert("fetchTime".to_string(), Value::Bool(false));
        m.insert("fetchOpenInterest".to_string(), Value::Bool(false));
        m.insert("fetchTradingFee".to_string(), Value::Bool(false));
        m.insert("watchTicker".to_string(), Value::Bool(false));
        m.insert("watchTickers".to_string(), Value::Bool(false));
        m.insert("watchOrderBook".to_string(), Value::Bool(false));
        m.insert("watchTrades".to_string(), Value::Bool(false));
        m.insert("watchOrders".to_string(), Value::Bool(false));
        m.insert("watchMyTrades".to_string(), Value::Bool(false));
        m.insert("watchOHLCV".to_string(), Value::Bool(false));
        m.insert("watchPositions".to_string(), Value::Bool(false));
    m
}));
    m
})]);

    Value::Null
}

    fn is_prediction(&self) -> Value {
        return self.safe_bool_k(self.has.clone(), "prediction", &[Value::Bool(false)]);

    Value::Null
}

    fn parse_search_queries(&self, optional_args: &[Value]) -> Value {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // accepts either `query` (a single search string) or `queries` (a list of strings)
        let mut singleQuery: Value = self.safe_string_k(params.clone(), "query", &[]);
        if !is_equal(&singleQuery, &Value::Null) {
            return Value::List(vec![singleQuery.clone()]);
        }
        return self.safe_list_k(params.clone(), "queries", &[Value::List(vec![])]);

    Value::Null
}

    fn require_event_query(&self, optional_args: &[Value]) -> Value {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // fetchEvents must be scoped by at least one selector — an unfiltered call would page the
        // entire exchange. require one of query / queries / tags / eventId / slug, or one of the
        // venue-specific scope params an exchange declares in options['eventScopeParams'],
        // e.g. kalshi's category / series_ticker
        let mut query: Value = self.safe_string_k(params.clone(), "query", &[]);
        let mut queries: Value = self.safe_list_k(params.clone(), "queries", &[Value::List(vec![])]);
        let mut tags: Value = self.safe_list_k(params.clone(), "tags", &[Value::List(vec![])]);
        let mut eventId: Value = self.safe_string_k(params.clone(), "eventId", &[]);
        let mut slug: Value = self.safe_string_k(params.clone(), "slug", &[]);
        let mut queriesLength: Value = get_array_length(&queries);
        let mut tagsLength: Value = get_array_length(&tags);
        if is_true(&(!is_equal(&query, &Value::Null))) || is_true(&(is_greater_than(&queriesLength, &Value::Int(0)))) || is_true(&(is_greater_than(&tagsLength, &Value::Int(0)))) || is_true(&(!is_equal(&eventId, &Value::Null))) || is_true(&(!is_equal(&slug, &Value::Null))) {
            return Value::Null;
        }
        let mut extraScopeParams: Value = self.safe_list_k(self.options.clone(), "eventScopeParams", &[Value::List(vec![])]);
        let mut extraScopeParamsLength: Value = get_array_length(&extraScopeParams);
        let mut extraNames: Value = Value::Str("".to_string());
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_180: bool = true;
            while { if !__for_first_180 { i = add(&i, &Value::Int(1)); } __for_first_180 = false; is_less_than(&i, &extraScopeParamsLength) } {
            let mut scopeKey: Value = get_value(&extraScopeParams, &i);
            let mut scopeKey: Value = get_value(&extraScopeParams, &i);
            if is_true(&Value::Bool(in_op(&params, &scopeKey))) {
                return Value::Null;
            }
            extraNames = add(&add(&extraNames, &Value::Str(", ".to_string())), &scopeKey);
        }
        }
        panic!("{}", crate::exchange_errors::arguments_required(add(&add(&add(&self.id, &Value::Str(" fetchEvents() requires at least one of query, queries, tags, eventId, slug".to_string())), &extraNames), &Value::Str(" to scope the search".to_string()))));

    Value::Null
}

    fn apply_event_fetch_params(&mut self, mut events: Value, optional_args: &[Value]) -> Value {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        let mut queries = get_arg(optional_args, 1, Value::Null);
        // applies the unified fetchEvents options client-side (eventId/slug/status/searchIn/sort/limit)
        // so exchanges whose API can't filter natively still support them consistently.
        // every fetched event lands in the cache before filtering, so loadEvents()/event()
        // serve them later without another request
        self.set_events(events.clone());
        let mut result: Value = events.clone();
        let mut eventId: Value = self.safe_string_k(params.clone(), "eventId", &[]);
        let mut slug: Value = self.safe_string_k(params.clone(), "slug", &[]);
        if is_true(&(!is_equal(&eventId, &Value::Null))) || is_true(&(!is_equal(&slug, &Value::Null))) {
            let mut filtered: Value = Value::List(vec![]);
            {
                                let mut i: Value = Value::Int(0);
                let mut __for_first_181: bool = true;
                while { if !__for_first_181 { i = add(&i, &Value::Int(1)); } __for_first_181 = false; is_less_than(&i, &get_array_length(&result)) } {
                let mut event: Value = get_value(&result, &i);
                let mut event: Value = get_value(&result, &i);
                let mut idMatch: bool = is_true(&(!is_equal(&eventId, &Value::Null))) && is_true(&(is_equal(&self.safe_string_k(event.clone(), "id", &[]), &eventId)));
                let mut slugMatch: bool = is_true(&(!is_equal(&slug, &Value::Null))) && is_true(&(is_equal(&self.safe_string_k(event.clone(), "slug", &[]), &slug)));
                if is_true(&idMatch) || is_true(&slugMatch) {
                    append_to_array(&mut filtered, event.clone());
                }
            }
            }
            result = filtered.clone();
        }
        result = self.filter_events_by_status(result.clone(), &[self.safe_string_k(params.clone(), "status", &[])]);
        result = self.filter_events_by_tags(result.clone(), &[self.safe_list_k(params.clone(), "tags", &[])]);
        // own-line length read so the regex transpiler treats `queries` as an array (count())
        // and not a string (strlen()); guard undefined since the default is undefined
        let mut queriesLength: Value = Value::Int(0);
        if !is_equal(&queries, &Value::Null) {
            queriesLength = get_array_length(&queries);
        }
        if is_greater_than(&queriesLength, &Value::Int(0)) {
            result = self.filter_events_by_search_in(result.clone(), queries.clone(), &[self.safe_string_k(params.clone(), "searchIn", &[])]);
        }
        let mut sort: Value = self.safe_string_k(params.clone(), "sort", &[]);
        if !is_equal(&sort, &Value::Null) {
            let mut sortKey: Value = Value::Null;
            if is_equal(&sort, &Value::Str("volume".to_string())) {
                sortKey = Value::Str("volume".to_string());
            }  else if is_equal(&sort, &Value::Str("liquidity".to_string())) {
                sortKey = Value::Str("liquidity".to_string());
            }  else if is_equal(&sort, &Value::Str("newest".to_string())) {
                sortKey = Value::Str("created".to_string());
            }
            if !is_equal(&sortKey, &Value::Null) {
                {
                                        let mut i: Value = Value::Int(0);
                    let mut __for_first_182: bool = true;
                    while { if !__for_first_182 { i = add(&i, &Value::Int(1)); } __for_first_182 = false; is_less_than(&i, &get_array_length(&result)) } {
                    { let __be_tmp = self.safe_number(get_value(&result, &i), sortKey.clone(), &[Value::Int(0)]); add_element_to_object(get_value_mut(&mut result, &i), &sortKey, __be_tmp.clone()); };
                }
                }
                result = self.sort_by(result.clone(), sortKey.clone(), &[Value::Bool(true), Value::Int(0)]);
            }
        }
        let mut limit: Value = self.safe_integer_k(params.clone(), "limit", &[]);
        if !is_equal(&limit, &Value::Null) {
            // clamp to the result length: arraySlice(x, 0, limit) with limit > length panics in Go
            // via reflect Slice, and throws in C#, unlike JS/Python which return the whole array
            let mut resultLength: Value = get_array_length(&result);
            let mut sliceEnd: Value = limit.clone();
            if is_greater_than(&sliceEnd, &resultLength) {
                sliceEnd = resultLength.clone();
            }
            result = self.array_slice(result.clone(), Value::Int(0), &[sliceEnd.clone()]);
        }
        return result;

    Value::Null
}

    fn filter_events_by_status(&self, mut events: Value, optional_args: &[Value]) -> Value {
        let mut status = get_arg(optional_args, 0, Value::Null);
        // 'active' | 'inactive' | 'closed' | 'all' — 'inactive' and 'closed' are interchangeable
        if is_true(&(is_equal(&status, &Value::Null))) || is_true(&(is_equal(&status, &Value::Str("all".to_string())))) {
            return events;
        }
        let mut wantActive: Value = Value::Bool(is_equal(&status, &Value::Str("active".to_string())));
        let mut result: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_183: bool = true;
            while { if !__for_first_183 { i = add(&i, &Value::Int(1)); } __for_first_183 = false; is_less_than(&i, &get_array_length(&events)) } {
            let mut event: Value = get_value(&events, &i);
            let mut event: Value = get_value(&events, &i);
            let mut isActive: Value = self.safe_bool_k(event.clone(), "active", &[]);
            // keep events whose status is unknown (already filtered server-side, no `active` field)
            if is_true(&(is_equal(&isActive, &Value::Null))) || is_true(&(is_equal(&isActive, &wantActive))) {
                append_to_array(&mut result, event.clone());
            }
        }
        }
        return result;

    Value::Null
}

    fn filter_events_by_search_in(&self, mut events: Value, mut queries: Value, optional_args: &[Value]) -> Value {
        let mut searchIn = get_arg(optional_args, 0, Value::Null);
        // keep events whose title and/or description contains one of the queries (searchIn defaults to 'both')
        // own-line length read so the regex transpiler uses count() (array) not strlen() (string)
        let mut queriesLength: Value = Value::Int(0);
        if !is_equal(&queries, &Value::Null) {
            queriesLength = get_array_length(&queries);
        }
        if is_true(&(is_equal(&searchIn, &Value::Null))) || is_true(&(is_equal(&queries, &Value::Null))) || is_true(&(is_equal(&queriesLength, &Value::Int(0)))) {
            return events;
        }
        let mut checkTitle: bool = is_true(&(is_equal(&searchIn, &Value::Str("title".to_string())))) || is_true(&(is_equal(&searchIn, &Value::Str("both".to_string()))));
        let mut checkDescription: bool = is_true(&(is_equal(&searchIn, &Value::Str("description".to_string())))) || is_true(&(is_equal(&searchIn, &Value::Str("both".to_string()))));
        let mut result: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_185: bool = true;
            while { if !__for_first_185 { i = add(&i, &Value::Int(1)); } __for_first_185 = false; is_less_than(&i, &get_array_length(&events)) } {
            let mut event: Value = get_value(&events, &i);
            let mut event: Value = get_value(&events, &i);
            let mut title: Value = self.safe_string_lower(event.clone(), Value::Str("title".to_string()), &[Value::Str("".to_string())]);
            let mut description: Value = self.safe_string_lower(event.clone(), Value::Str("description".to_string()), &[Value::Str("".to_string())]);
            let mut matched: bool = false;
            {
                                let mut qi: Value = Value::Int(0);
                let mut __for_first_184: bool = true;
                while { if !__for_first_184 { qi = add(&qi, &Value::Int(1)); } __for_first_184 = false; is_less_than(&qi, &get_array_length(&queries)) } {
                let mut q: Value = to_lower(&get_value(&queries, &qi));
                if is_equal(&title, &Value::Null) {
                    panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" filterEventsBySearchIn() missing title".to_string()))));
                }
                if is_true(&checkTitle) && is_true(&(is_greater_than_or_equal(&get_index_of(&title, &q), &Value::Int(0)))) {
                    matched = true;
                    break;
                }
                if is_equal(&description, &Value::Null) {
                    panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" filterEventsBySearchIn() missing description".to_string()))));
                }
                if is_true(&checkDescription) && is_true(&(is_greater_than_or_equal(&get_index_of(&description, &q), &Value::Int(0)))) {
                    matched = true;
                    break;
                }
            }
            }
            if is_true(&matched) {
                append_to_array(&mut result, event.clone());
            }
        }
        }
        return result;

    Value::Null
}

    fn normalize_tag_key(&self, mut tag: Value) -> Value {
        // reduce a tag to lowercase alphanumeric words joined by single spaces ("Fed Rates" /
        // "fed-rates" / "FED_RATES" all become "fed rates") so label, slug and handle spellings
        // of the same tag compare equal — venues surface tags in different forms and callers
        // pass any of them. keeping the word boundary avoids cross-word false positives that
        // plain concatenation would create ("us open" vs "household")
        let mut lower: Value = to_lower(&tag);
        let mut allowed: Value = Value::Str("abcdefghijklmnopqrstuvwxyz0123456789".to_string());
        let mut chars: Value = self.string_to_chars_array(lower.clone());
        let mut s: Value = Value::Str("".to_string());
        let mut pendingSep: bool = false;
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_186: bool = true;
            while { if !__for_first_186 { i = add(&i, &Value::Int(1)); } __for_first_186 = false; is_less_than(&i, &get_array_length(&chars)) } {
            let mut ch: Value = get_value(&chars, &i);
            let mut ch: Value = get_value(&chars, &i);
            if is_greater_than_or_equal(&get_index_of(&allowed, &ch), &Value::Int(0)) {
                if is_true(&pendingSep) && is_true(&(!is_equal(&s, &Value::Str("".to_string())))) {
                    s = add(&s, &Value::Str(" ".to_string()));
                }
                s = add(&s, &ch);
                pendingSep = false;
            }  else {
                pendingSep = true;
            }
        }
        }
        return s;

    Value::Null
}

    fn filter_events_by_tags(&self, mut events: Value, optional_args: &[Value]) -> Value {
        let mut tags = get_arg(optional_args, 0, Value::Null);
        // keep events carrying one of the requested tags; tolerant to string tags and to
        // object tags ({ slug, title, ... }) since venues differ. no-op when no tags requested
        if is_true(&(is_equal(&tags, &Value::Null))) || is_true(&(is_equal(&get_array_length(&tags), &Value::Int(0)))) {
            return events;
        }
        let mut wanted: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_187: bool = true;
            while { if !__for_first_187 { i = add(&i, &Value::Int(1)); } __for_first_187 = false; is_less_than(&i, &get_array_length(&tags)) } {
            let mut wantedKey: Value = self.normalize_tag_key(get_value(&tags, &i));
            if !is_equal(&wantedKey, &Value::Str("".to_string())) {
                // an empty normalized key would substring-match every tag
                append_to_array(&mut wanted, wantedKey.clone());
            }
        }
        }
        let mut result: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_190: bool = true;
            while { if !__for_first_190 { i = add(&i, &Value::Int(1)); } __for_first_190 = false; is_less_than(&i, &get_array_length(&events)) } {
            let mut event: Value = get_value(&events, &i);
            let mut event: Value = get_value(&events, &i);
            let mut eventTags: Value = self.safe_list_k(event.clone(), "tags", &[Value::List(vec![])]);
            let mut matched: bool = false;
            {
                                let mut ti: Value = Value::Int(0);
                let mut __for_first_189: bool = true;
                while { if !__for_first_189 { ti = add(&ti, &Value::Int(1)); } __for_first_189 = false; is_less_than(&ti, &get_array_length(&eventTags)) } {
                let mut tag: Value = get_value(&eventTags, &ti);
                let mut tag: Value = get_value(&eventTags, &ti);
                let mut tagLabel: Value = Value::Null;
                if is_string(&tag) {
                    tagLabel = tag.clone();
                }  else {
                    tagLabel = self.safe_string2(tag.clone(), Value::Str("slug".to_string()), Value::Str("title".to_string()), &[]);
                }
                if !is_equal(&tagLabel, &Value::Null) {
                    let mut tagKey: Value = self.normalize_tag_key(tagLabel.clone());
                    {
                                                let mut wi: Value = Value::Int(0);
                        let mut __for_first_188: bool = true;
                        while { if !__for_first_188 { wi = add(&wi, &Value::Int(1)); } __for_first_188 = false; is_less_than(&wi, &get_array_length(&wanted)) } {
                        if is_greater_than_or_equal(&get_index_of(&tagKey, &get_value(&wanted, &wi)), &Value::Int(0)) {
                            matched = true;
                            break;
                        }
                    }
                    }
                }
                if is_true(&matched) {
                    break;
                }
            }
            }
            if is_true(&matched) {
                append_to_array(&mut result, event.clone());
            }
        }
        }
        return result;

    Value::Null
}

    fn fetch_events(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_events", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchEvents() is not supported yet".to_string()))));

    Value::Null
} }

    fn fetch_event(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_event", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(id.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchEvent() is not supported yet".to_string()))));

    Value::Null
} }

    fn set_events(&mut self, mut events: Value) -> Value {
        // merge (not reset) so successive scoped fetchEvents calls accumulate into the cache.
        // index by the unified `event` handle too (that's the identifier every outcome's `event`
        // field carries), so getEvent (handle) resolves without each exchange hand-writing it
        if is_equal(&self.pred().events, &Value::Null) {
            self.pred_mut().events = Value::Map({
                let mut m = indexmap::IndexMap::new();
                m
            });
        }
        if is_equal(&self.pred().events_by_slug, &Value::Null) {
            self.pred_mut().events_by_slug = Value::Map({
                let mut m = indexmap::IndexMap::new();
                m
            });
        }
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_191: bool = true;
            while { if !__for_first_191 { i = add(&i, &Value::Int(1)); } __for_first_191 = false; is_less_than(&i, &get_array_length(&events)) } {
            let mut event: Value = get_value(&events, &i);
            let mut event: Value = get_value(&events, &i);
            let mut id: Value = self.safe_string_k(event.clone(), "id", &[]);
            let mut slug: Value = self.safe_string_k(event.clone(), "slug", &[]);
            let mut handle: Value = self.safe_string_k(event.clone(), "event", &[]);
            if !is_equal(&id, &Value::Null) {
                add_element_to_object(&mut self.pred_mut().events, &id, event.clone());
            }
            if !is_equal(&handle, &Value::Null) {
                add_element_to_object(&mut self.pred_mut().events, &handle, event.clone());
            }
            if !is_equal(&slug, &Value::Null) {
                add_element_to_object(&mut self.pred_mut().events_by_slug, &slug, event.clone());
            }
        }
        }
        return self.pred().events.clone();

    Value::Null
}

    fn events_list(&self) -> Value {
        // the cached events as a list; empty on a cold instance (this.events is keyed by both
        // id and handle, so de-duplicate by identity before returning)
        if is_equal(&self.pred().events, &Value::Null) {
            return Value::List(vec![]);
        }
        let mut result: Value = Value::List(vec![]);
        let mut seen: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
            m
        });
        let mut keys: Value = object_keys(&self.pred().events);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_192: bool = true;
            while { if !__for_first_192 { i = add(&i, &Value::Int(1)); } __for_first_192 = false; is_less_than(&i, &get_array_length(&keys)) } {
            let mut event: Value = get_value(&self.pred().events, &get_value(&keys, &i));
            let mut identity: Value = self.safe_string2(event.clone(), Value::Str("id".to_string()), Value::Str("event".to_string()), &[get_value(&keys, &i)]);
            if !is_true(&(Value::Bool(in_op(&seen, &identity)))) {
                add_element_to_object(&mut seen, &identity, Value::Bool(true));
                append_to_array(&mut result, event.clone());
            }
        }
        }
        return result;

    Value::Null
}

    fn load_events_helper(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut reload = get_arg(optional_args, 0, Value::Bool(false));
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // note: the cache-hit shortcut ignores params, so events fetched under one scope are
        // returned for a later differently-scoped call. events are scoped (unlike global
        // markets), so prefer fetchEvents (params) directly when you need a specific scope
        if !is_true(&reload) && is_true(&(!is_equal(&self.pred().events, &Value::Null) && !is_equal(&self.pred().events, &Value::Null))) {
            return self.pred().events.clone();
        }
        let mut events: Value = self.fetch_events(&[params.clone()]).await;
        return self.set_events(events.clone());

    Value::Null
} }

    fn load_events(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut reload = get_arg(optional_args, 0, Value::Bool(false));
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        return self.load_events_helper(&[reload.clone(), params.clone()]).await;

    Value::Null
} }

    fn get_event(&self, mut eventIdOrSlug: Value) -> Value {
        // cache-only event resolver (the event analogue of this.outcome) - the cache fills
        // through fetchEvents; this never fetches
        if is_true(&(!is_equal(&self.pred().events, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().events, &eventIdOrSlug)))) {
            return get_value(&self.pred().events, &eventIdOrSlug);
        }
        if is_true(&(!is_equal(&self.pred().events_by_slug, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().events_by_slug, &eventIdOrSlug)))) {
            return get_value(&self.pred().events_by_slug, &eventIdOrSlug);
        }
        panic!("{}", crate::exchange_errors::bad_symbol(add(&add(&add(&self.id, &Value::Str(" has no cached event ".to_string())), &eventIdOrSlug), &Value::Str(" - call fetchEvents ({ 'query': ... }) first".to_string()))));

    Value::Null
}

    fn outcome(&self, mut outcomeSymbol: Value) -> Value {
        if is_equal(&outcomeSymbol, &Value::Null) {
            panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" outcome() requires an outcomeSymbol argument".to_string()))));
        }
        if is_true(&(is_equal(&self.pred().outcomes, &Value::Null))) || is_true(&self.is_empty(self.pred().outcomes.clone())) {
            panic!("{}", crate::exchange_errors::exchange_error(add(&self.id, &Value::Str(" outcomes not loaded - call loadOutcomes () or an outcome-addressed method first".to_string()))));
        }
        if is_true(&Value::Bool(in_op(&self.pred().outcomes, &outcomeSymbol))) {
            return get_value(&self.pred().outcomes, &outcomeSymbol);
        }
        if is_true(&(!is_equal(&self.pred().outcomes_by_id, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().outcomes_by_id, &outcomeSymbol)))) {
            return get_value(&self.pred().outcomes_by_id, &outcomeSymbol);
        }
        panic!("{}", crate::exchange_errors::bad_symbol(add(&add(&add(&self.id, &Value::Str(" does not have outcome ".to_string())), &outcomeSymbol), &Value::Str(" - pass a known outcome handle or outcomeId, or call fetchEvents ()/loadOutcomes () first".to_string()))));

    Value::Null
}

    fn has_outcome(&self, mut outcomeIdOrSymbol: Value) -> Value {
        // sync cache-only membership probe — never throws and never fetches. this is the predicate
        // behind loadOutcome's fast path and loadOutcomes' miss filter; safeOutcome (stub on miss)
        // and outcome (throws on miss) are the accessors
        if is_equal(&outcomeIdOrSymbol, &Value::Null) {
            return Value::Bool(false);
        }
        if is_true(&(!is_equal(&self.pred().outcomes, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().outcomes, &outcomeIdOrSymbol)))) {
            return Value::Bool(true);
        }
        if is_true(&(!is_equal(&self.pred().outcomes_by_id, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().outcomes_by_id, &outcomeIdOrSymbol)))) {
            return Value::Bool(true);
        }
        return Value::Bool(false);

    Value::Null
}

    fn safe_outcome(&self, mut outcomeIdOrSymbol: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        if !is_equal(&outcomeIdOrSymbol, &Value::Null) {
            if is_true(&(!is_equal(&self.pred().outcomes, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().outcomes, &outcomeIdOrSymbol)))) {
                return get_value(&self.pred().outcomes, &outcomeIdOrSymbol);
            }
            if is_true(&(!is_equal(&self.pred().outcomes_by_id, &Value::Null))) && is_true(&(Value::Bool(in_op(&self.pred().outcomes_by_id, &outcomeIdOrSymbol)))) {
                return get_value(&self.pred().outcomes_by_id, &outcomeIdOrSymbol);
            }
        }
        if !is_equal(&outcomeObj, &Value::Null) {
            return outcomeObj;
        }
        return Value::Map({
    let mut m = indexmap::IndexMap::new();
        m.insert("outcome".to_string(), outcomeIdOrSymbol.clone());
        m.insert("outcomeId".to_string(), outcomeIdOrSymbol.clone());
        m.insert("market".to_string(), Value::Null);
        m.insert("label".to_string(), Value::Null);
        m.insert("event".to_string(), Value::Null);
        m.insert("info".to_string(), Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
    m
});

    Value::Null
}

    fn safe_outcome_symbol(&self, mut outcomeIdOrSymbol: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        outcomeObj = self.safe_outcome(outcomeIdOrSymbol.clone(), &[outcomeObj.clone()]);
        return get_value(&outcomeObj, &Value::Str("outcome".to_string()));

    Value::Null
}

    fn shorten_slug(&self, mut slug: Value) -> Value {
        let mut replacements: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("federal-reserve".to_string(), Value::Str("fed".to_string()));
                m.insert("interest-rates".to_string(), Value::Str("rates".to_string()));
                m.insert("interest-rate".to_string(), Value::Str("rate".to_string()));
                m.insert("basis-points".to_string(), Value::Str("bps".to_string()));
                m.insert("basis-point".to_string(), Value::Str("bp".to_string()));
                m.insert("executive-order".to_string(), Value::Str("eo".to_string()));
                m.insert("united-states".to_string(), Value::Str("us".to_string()));
                m.insert("united-kingdom".to_string(), Value::Str("uk".to_string()));
                m.insert("european-union".to_string(), Value::Str("eu".to_string()));
                m.insert("artificial-intelligence".to_string(), Value::Str("ai".to_string()));
                m.insert("republican-party".to_string(), Value::Str("gop".to_string()));
                m.insert("democratic-party".to_string(), Value::Str("dems".to_string()));
                m.insert("stock-market".to_string(), Value::Str("market".to_string()));
                m.insert("price-target".to_string(), Value::Str("pt".to_string()));
                m.insert("market-cap".to_string(), Value::Str("mcap".to_string()));
                m.insert("increase".to_string(), Value::Str("hike".to_string()));
                m.insert("decrease".to_string(), Value::Str("cut".to_string()));
                m.insert("higher".to_string(), Value::Str("up".to_string()));
                m.insert("lower".to_string(), Value::Str("down".to_string()));
                m.insert("greater".to_string(), Value::Str("gt".to_string()));
                m.insert("less".to_string(), Value::Str("lt".to_string()));
                m.insert("million".to_string(), Value::Str("M".to_string()));
                m.insert("billion".to_string(), Value::Str("B".to_string()));
                m.insert("trillion".to_string(), Value::Str("T".to_string()));
                m.insert("percent".to_string(), Value::Str("pct".to_string()));
            m
        });
        let mut stopWords: Value = Value::List(vec![Value::Str("will".to_string()), Value::Str("the".to_string()), Value::Str("a".to_string()), Value::Str("an".to_string()), Value::Str("after".to_string()), Value::Str("before".to_string()), Value::Str("in".to_string()), Value::Str("at".to_string()), Value::Str("by".to_string()), Value::Str("of".to_string()), Value::Str("there".to_string()), Value::Str("be".to_string()), Value::Str("to".to_string()), Value::Str("or".to_string()), Value::Str("and".to_string()), Value::Str("for".to_string()), Value::Str("on".to_string()), Value::Str("its".to_string()), Value::Str("that".to_string()), Value::Str("this".to_string()), Value::Str("from".to_string()), Value::Str("with".to_string()), Value::Str("as".to_string()), Value::Str("is".to_string()), Value::Str("are".to_string()), Value::Str("was".to_string()), Value::Str("were".to_string()), Value::Str("?".to_string()), Value::Str("how".to_string()), Value::Str("many".to_string()), Value::Str("who".to_string()), Value::Str("what".to_string()), Value::Str("when".to_string()), Value::Str("where".to_string()), Value::Str("which".to_string()), Value::Str("much".to_string())]);
        let mut lower: Value = ternary(is_true(&(is_equal(&slug, &Value::Null))), Value::Str("".to_string()), to_lower(&slug));
        let mut allowed: Value = Value::Str("abcdefghijklmnopqrstuvwxyz0123456789".to_string());
        let mut chars: Value = self.string_to_chars_array(lower.clone());
        let mut s: Value = Value::Str("".to_string());
        let mut lastDash: bool = true; // start true to drop leading separators
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_193: bool = true;
            while { if !__for_first_193 { i = add(&i, &Value::Int(1)); } __for_first_193 = false; is_less_than(&i, &get_array_length(&chars)) } {
            let mut ch: Value = get_value(&chars, &i);
            let mut ch: Value = get_value(&chars, &i);
            if is_greater_than_or_equal(&get_index_of(&allowed, &ch), &Value::Int(0)) {
                s = add(&s, &ch);
                lastDash = false;
            }  else if !is_true(&lastDash) {
                s = add(&s, &Value::Str("-".to_string()));
                lastDash = true;
            }
        }
        }
        let mut replacementKeys: Value = object_keys(&replacements);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_194: bool = true;
            while { if !__for_first_194 { i = add(&i, &Value::Int(1)); } __for_first_194 = false; is_less_than(&i, &get_array_length(&replacementKeys)) } {
            let mut replacementKey: Value = get_value(&replacementKeys, &i);
            let mut replacementKey: Value = get_value(&replacementKeys, &i);
            let mut replacementValue: Value = self.safe_string(replacements.clone(), replacementKey.clone(), &[]);
            if !is_equal(&replacementValue, &Value::Null) {
                s = replace_all_str(&s, &replacementKey, &replacementValue);
            }
        }
        }
        let mut rawParts: Value = split(&s, &Value::Str("-".to_string()));
        let mut parts: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_195: bool = true;
            while { if !__for_first_195 { i = add(&i, &Value::Int(1)); } __for_first_195 = false; is_less_than(&i, &get_array_length(&rawParts)) } {
            let mut w: Value = get_value(&rawParts, &i);
            let mut w: Value = get_value(&rawParts, &i);
            if is_greater_than(&get_array_length(&w), &Value::Int(0)) && !is_true(&self.in_array(w.clone(), stopWords.clone())) {
                append_to_array(&mut parts, w.clone());
            }
        }
        }
        let mut joined: Value = join(&parts, &Value::Str("_".to_string()));
        return to_upper(&joined);

    Value::Null
}

    fn slug_to_market_symbol(&self, mut eventSlug: Value, mut marketSlug: Value) -> Value {
        // eventSlug is nullable (Str): markets without a parent event (e.g. myriad's 1:1 markets)
        // pass undefined — the body already collapses an absent event to just the market part.
        // a strict `string` param would make PHP/typed transpilers throw on null before the body runs.
        // qualify the market handle with its event so two events that share a market label
        // — e.g. kalshi's KXFEDDECISION-28JAN and -27OCT both list "Cut 25bps" — do NOT collapse
        // to the same handle — a collision silently overwrites markets in this.markets and would
        // resolve an outcome to the wrong event (wrong-market trade). skip the prefix when the
        // event slug is absent or identical to the market slug (e.g. myriad's 1:1 markets), so
        // already-unique handles stay clean.
        let mut marketPart: Value = self.shorten_slug(marketSlug.clone());
        let mut eventPart: Value = self.shorten_slug(eventSlug.clone());
        if is_true(&(is_equal(&eventPart, &Value::Null))) || is_true(&(is_equal(&eventPart, &Value::Str("".to_string())))) || is_true(&(is_equal(&eventPart, &marketPart))) {
            return marketPart;
        }
        return add(&add(&eventPart, &Value::Str("_".to_string())), &marketPart);

    Value::Null
}

    fn slug_to_outcome_symbol(&self, mut eventSlug: Value, mut marketSlug: Value, mut outcome: Value) -> Value {
        // build on slugToMarketSymbol so the outcome handle stays consistent with the market symbol
        // — both event-qualified or both not — otherwise a qualified market + unqualified outcome mismatch.
        // the label gets a light slug treatment (uppercase alphanumerics joined by '_', no stop-word
        // removal so labels like "UP OR DOWN" survive intact) — venue labels with spaces or
        // currency symbols ("JD Vance", a dollar-sign price) yield clean handles (JD_VANCE, 120)
        // instead of leaking raw text into the outcome handle
        if is_equal(&outcome, &Value::Null) {
            outcome = Value::Str("".to_string());
        }
        let mut upper: Value = to_upper(&outcome);
        let mut allowed: Value = Value::Str("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".to_string());
        let mut chars: Value = self.string_to_chars_array(upper.clone());
        let mut label: Value = Value::Str("".to_string());
        let mut pendingSep: bool = false;
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_196: bool = true;
            while { if !__for_first_196 { i = add(&i, &Value::Int(1)); } __for_first_196 = false; is_less_than(&i, &get_array_length(&chars)) } {
            let mut ch: Value = get_value(&chars, &i);
            let mut ch: Value = get_value(&chars, &i);
            if is_greater_than_or_equal(&get_index_of(&allowed, &ch), &Value::Int(0)) {
                if is_true(&pendingSep) && is_true(&(!is_equal(&label, &Value::Str("".to_string())))) {
                    label = add(&label, &Value::Str("_".to_string()));
                }
                label = add(&label, &ch);
                pendingSep = false;
            }  else {
                pendingSep = true;
            }
        }
        }
        if is_equal(&label, &Value::Str("".to_string())) {
            // a label with no alphanumerics at all (unrealistic, but keep the :LABEL contract)
            label = upper.clone();
        }
        return add(&add(&self.slug_to_market_symbol(eventSlug.clone(), marketSlug.clone()), &Value::Str(":".to_string())), &label);

    Value::Null
}

    fn set_markets(&mut self, mut markets: Value, optional_args: &[Value]) -> Value {
        let mut currencies = get_arg(optional_args, 0, Value::Null);
        // prediction market rows carry only the unified `market` handle — `symbol` is
        // deprecated there. the base indexer keys this.markets/this.symbols by 'symbol',
        // so alias the handle onto a shallow copy per row; the caller's rows stay symbol-free
        let mut marketsList: Value = self.to_array(markets.clone());
        let mut aliased: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_197: bool = true;
            while { if !__for_first_197 { i = add(&i, &Value::Int(1)); } __for_first_197 = false; is_less_than(&i, &get_array_length(&marketsList)) } {
            let mut row: Value = get_value(&marketsList, &i);
            let mut row: Value = get_value(&marketsList, &i);
            let mut copy: Value = self.extend(Value::Map({
                let mut m = indexmap::IndexMap::new();
                m
            }), &[row.clone()]);
            add_element_to_object(&mut copy, &Value::Str("symbol".to_string()), self.safe_string2(row.clone(), Value::Str("market".to_string()), Value::Str("symbol".to_string()), &[]));
            append_to_array(&mut aliased, copy.clone());
        }
        }
        let mut stored: Value = self.super_set_markets(aliased.clone(), currencies.clone());
        // strip the alias back off the stored rows — venues assemble user-visible event
        // structures from this.markets (hyperliquid groups its outcome markets that way),
        // so a leftover 'symbol' key would leak the deprecated field back to the caller
        let mut marketKeys: Value = object_keys(&stored);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_198: bool = true;
            while { if !__for_first_198 { i = add(&i, &Value::Int(1)); } __for_first_198 = false; is_less_than(&i, &get_array_length(&marketKeys)) } {
            let mut key: Value = get_value(&marketKeys, &i);
            let mut key: Value = get_value(&marketKeys, &i);
            { let __be_tmp = self.omit(get_value(&stored, &key), Value::Str("symbol".to_string()), &[]); add_element_to_object(&mut stored, &key, __be_tmp.clone()); };
        }
        }
        self.populate_outcomes();
        return stored;

    Value::Null
}

    fn index_market_outcomes(&mut self, mut market: Value) {
        // index one market's outcome tokens into this.outcomes / this.outcomes_by_id,
        // normalizing each to the canonical identity keys (outcome / outcomeId / market) so
        // consumers and the safe* helpers stay uniform even when an exchange's parseMarket
        // still emits the legacy symbol / id / marketSymbol keys. used both by populateOutcomes
        // for a full rebuild and by on-demand single-market fetches (kalshi fetchOutcome), so a
        // cache miss doesn't force a full O(markets x outcomes) rebuild per new outcome
        if is_equal(&self.pred().outcomes, &Value::Null) {
            self.pred_mut().outcomes = Value::Map({
                let mut m = indexmap::IndexMap::new();
                m
            });
        }
        if is_equal(&self.pred().outcomes_by_id, &Value::Null) {
            self.pred_mut().outcomes_by_id = Value::Map({
                let mut m = indexmap::IndexMap::new();
                m
            });
        }
        let mut outcomesList: Value = self.safe_list_k(market.clone(), "outcomes", &[Value::List(vec![])]);
        {
                        let mut j: Value = Value::Int(0);
            let mut __for_first_199: bool = true;
            while { if !__for_first_199 { j = add(&j, &Value::Int(1)); } __for_first_199 = false; is_less_than(&j, &get_array_length(&outcomesList)) } {
            let mut oc: Value = get_value(&outcomesList, &j);
            let mut oc: Value = get_value(&outcomesList, &j);
            let mut ocSymbol: Value = self.safe_string2(oc.clone(), Value::Str("outcome".to_string()), Value::Str("symbol".to_string()), &[]);
            let mut ocId: Value = self.safe_string2(oc.clone(), Value::Str("outcomeId".to_string()), Value::Str("id".to_string()), &[]);
            // assign unconditionally — safeString2 keeps the canonical key when present
            // and falls back to the legacy one, so this never clobbers and avoids a
            // missing-key access that throws in Python/PHP, unlike TS undefined
            add_element_to_object(&mut oc, &Value::Str("outcomeId".to_string()), ocId.clone());
            { let __be_tmp = self.safe_string2(oc.clone(), Value::Str("market".to_string()), Value::Str("marketSymbol".to_string()), &[]); add_element_to_object(&mut oc, &Value::Str("market".to_string()), __be_tmp.clone()); };
            if !is_equal(&ocSymbol, &Value::Null) {
                // shortenSlug is lossy, so two different markets can produce the same handle.
                // on a real collision of same handle but different outcomeId, disambiguate the
                // second one deterministically instead of silently overwriting the first —
                // trading the wrong market would otherwise be indistinguishable
                let mut existing: Value = self.safe_value(self.pred().outcomes.clone(), ocSymbol.clone(), &[]);
                if !is_equal(&existing, &Value::Null) {
                    let mut existingId: Value = self.safe_string_k(existing.clone(), "outcomeId", &[]);
                    if is_true(&(!is_equal(&existingId, &Value::Null))) && is_true(&(!is_equal(&ocId, &Value::Null))) && is_true(&(!is_equal(&existingId, &ocId))) {
                        let mut idLen: Value = get_array_length(&ocId);
                        let mut suffix: Value = ocId.clone();
                        if is_greater_than(&idLen, &Value::Int(6)) {
                            suffix = slice(&ocId, &subtract(&idLen, &Value::Int(6)), &Value::Null);
                        }
                        ocSymbol = add(&add(&ocSymbol, &Value::Str("_".to_string())), &to_upper(&suffix));
                    }
                }
                add_element_to_object(&mut oc, &Value::Str("outcome".to_string()), ocSymbol.clone());
                add_element_to_object(&mut self.pred_mut().outcomes, &ocSymbol, oc.clone());
            }  else {
                add_element_to_object(&mut oc, &Value::Str("outcome".to_string()), ocSymbol.clone());
            }
            if !is_equal(&ocId, &Value::Null) {
                add_element_to_object(&mut self.pred_mut().outcomes_by_id, &ocId, oc.clone());
            }
        }
        }
}

    fn populate_outcomes(&mut self) {
        // rebuild the whole outcome lookup cache from this.markets (each market carries its
        // outcome tokens under the outcomes key) so cached market data works offline. no-op on
        // a cold instance where markets are not loaded yet (avoids a null-access crash on the
        // eventId/slug-only fetchEvents path)
        self.pred_mut().outcomes = Value::Map({
            let mut m = indexmap::IndexMap::new();
            m
        });
        self.pred_mut().outcomes_by_id = Value::Map({
            let mut m = indexmap::IndexMap::new();
            m
        });
        if is_equal(&self.markets, &Value::Null) {
            return;
        }
        let mut marketKeys: Value = object_keys(&self.markets);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_200: bool = true;
            while { if !__for_first_200 { i = add(&i, &Value::Int(1)); } __for_first_200 = false; is_less_than(&i, &get_array_length(&marketKeys)) } {
            self.index_market_outcomes(get_value(&self.markets, &get_value(&marketKeys, &i)));
        }
        }
}

    fn index_event_outcomes(&mut self, mut event: Value) {
        // register a single event's markets into this.markets and rebuild the outcome cache so the
        // handles fetchEvent() returns resolve immediately in outcome-addressed methods (fetchTicker,
        // createOrder, ...). without this, on a cold instance or a loadAllOutcomes:false venue
        // such as kalshi, the returned handles are unusable — fetchTicker(ev.markets[0].outcomes[0].outcome)
        // BadSymbols because the outcome was never cached
        if is_equal(&self.markets, &Value::Null) {
            { let __t = self.create_safe_dictionary(&[]); self.markets = __t; }
        }
        let mut markets: Value = self.safe_list_k(event.clone(), "markets", &[Value::List(vec![])]);
        let mut marketsLength: Value = get_array_length(&markets);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_201: bool = true;
            while { if !__for_first_201 { i = add(&i, &Value::Int(1)); } __for_first_201 = false; is_less_than(&i, &marketsLength) } {
            let mut m: Value = get_value(&markets, &i);
            let mut m: Value = get_value(&markets, &i);
            let mut marketHandle: Value = self.safe_string2(m.clone(), Value::Str("market".to_string()), Value::Str("symbol".to_string()), &[]);
            if !is_equal(&marketHandle, &Value::Null) {
                add_element_to_object(&mut self.markets, &marketHandle, m.clone());
            }
        }
        }
        self.populate_outcomes();
}

    fn load_outcomes<'ccxt_rec>(&'ccxt_rec mut self, optional_args: &'ccxt_rec [Value]) -> ::std::pin::Pin<Box<dyn ::std::future::Future<Output = Value> + Send + 'ccxt_rec>> { Box::pin(async move {
        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut reload = get_arg(optional_args, 1, Value::Bool(false));
        let mut params = get_arg(optional_args, 2, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // outcome-addressed methods call this first, mirroring loadMarkets(). two modes:
        // - an `outcomes` list (scoped): sync-filter the cache and resolve ONLY the misses through
        //   fetchOutcomes — venues with a batch by-id endpoint (kalshi, polymarket) override it to
        //   collapse all misses into one request; a warm cache returns with zero per-outcome awaits
        // - no `outcomes` (bulk): load the capped markets listing once and index every outcome —
        //   idempotent unless reload; only worth paying on venues whose whole universe is one
        //   cheap request (hyperliquid), or when the user explicitly wants the top-N set
        // loadMarkets()/populateOutcomes() rebuild the lookup caches explicitly (the setMarkets
        // override is not dispatched by the base loadMarkets under the Go/C#/Java transpilers)
        if !is_equal(&outcomes, &Value::Null) {
            let mut missing: Value = Value::List(vec![]);
            {
                                let mut i: Value = Value::Int(0);
                let mut __for_first_202: bool = true;
                while { if !__for_first_202 { i = add(&i, &Value::Int(1)); } __for_first_202 = false; is_less_than(&i, &get_array_length(&outcomes)) } {
                if is_true(&reload) || !is_true(&self.has_outcome(get_value(&outcomes, &i))) {
                    append_to_array(&mut missing, get_value(&outcomes, &i));
                }
            }
            }
            let mut missingLength: Value = get_array_length(&missing);
            let mut wasWarm: bool = is_true(&(!is_equal(&self.pred().outcomes, &Value::Null))) && !is_true(&self.is_empty(self.pred().outcomes.clone()));
            let mut loadAll: Value = self.safe_bool_k(self.options.clone(), "loadAllOutcomes", &[Value::Bool(false)]);
            if is_true(&(is_greater_than(&missingLength, &Value::Int(0)))) && is_true(&(is_equal(&loadAll, &Value::Bool(true)))) && !is_true(&wasWarm) && !is_true(&reload) {
                // same trade-off as loadOutcome: on venues where the whole universe is one cheap
                // request (hyperliquid), a cold miss bulk-warms once instead of fetching per outcome
                self.load_outcomes(&[]).await;
                let mut stillMissing: Value = Value::List(vec![]);
                {
                                        let mut i: Value = Value::Int(0);
                    let mut __for_first_203: bool = true;
                    while { if !__for_first_203 { i = add(&i, &Value::Int(1)); } __for_first_203 = false; is_less_than(&i, &missingLength) } {
                    if !is_true(&self.has_outcome(get_value(&missing, &i))) {
                        append_to_array(&mut stillMissing, get_value(&missing, &i));
                    }
                }
                }
                missing = stillMissing.clone();
                missingLength = get_array_length(&missing);
            }
            if is_greater_than(&missingLength, &Value::Int(0)) {
                self.fetch_outcomes(missing.clone()).await;
            }
            return self.pred().outcomes.clone();
        }
        if !is_true(&reload) && is_true(&(!is_equal(&self.pred().outcomes, &Value::Null))) && !is_true(&self.is_empty(self.pred().outcomes.clone())) {
            return self.pred().outcomes.clone();
        }
        self.load_markets(&[reload.clone(), params.clone()]).await;
        self.populate_outcomes();
        return self.pred().outcomes.clone();

    Value::Null
}) }

/*
 * @ignore
 * @method
 * @name PredictionExchange#fetchOutcomes
 * @description resolves several uncached outcomes. the base has no batch by-id endpoint, so it fetches them one by one through fetchOutcome (which throws BadSymbol for an unresolvable one); venues with a batch endpoint (kalshi, polymarket) override this to collapse the list into one request
 * @param {string[]} outcomeSymbols the uncached outcome handles or ids to resolve
 * @returns {object} the outcome cache
 */
    fn fetch_outcomes(&mut self, mut outcomeSymbols: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_outcomes", vec![outcomeSymbols.clone()]).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_204: bool = true;
            while { if !__for_first_204 { i = add(&i, &Value::Int(1)); } __for_first_204 = false; is_less_than(&i, &get_array_length(&outcomeSymbols)) } {
            self.fetch_outcome(get_value(&outcomeSymbols, &i)).await;
        }
        }
        return self.pred().outcomes.clone();

    Value::Null
} }

    fn load_outcome(&mut self, mut outcomeSymbol: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut reload = get_arg(optional_args, 0, Value::Bool(false));
        // resolve a single outcome — the per-outcome analogue of loadMarkets()+market(). a cache hit
        // returns at once (pass reload=true to skip the cache and refetch the outcome's metadata).
        // on a miss, fetchOutcome resolves just the requested outcome on demand — a by-id fetch on
        // venues with such an endpoint (kalshi, polymarket) or the venue's scoped search otherwise.
        // options.loadAllOutcomes (default false) opts back into the legacy bulk warm-up: the first
        // miss loads the whole (capped) listing once so later lookups are 0-network hits — only
        // sane on venues whose full universe is one cheap request (hyperliquid)
        if is_equal(&outcomeSymbol, &Value::Null) {
            panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" loadOutcome() requires an outcomeSymbol argument".to_string()))));
        }
        if !is_true(&reload) {
            if is_true(&self.has_outcome(outcomeSymbol.clone())) {
                return self.safe_outcome(outcomeSymbol.clone(), &[]);
            }
            let mut wasWarm: bool = is_true(&(!is_equal(&self.pred().outcomes, &Value::Null))) && !is_true(&self.is_empty(self.pred().outcomes.clone()));
            // if markets are already loaded (offline-injected, or loaded by loadMarkets/fetchEvents)
            // but the outcome cache is cold, index them for free before hitting the network — this
            // makes cold-cache resolution consistent across languages regardless of loadAllOutcomes
            if !is_true(&wasWarm) && is_true(&(!is_equal(&self.markets, &Value::Null))) && !is_true(&self.is_empty(self.markets.clone())) {
                self.populate_outcomes();
                if is_true(&self.has_outcome(outcomeSymbol.clone())) {
                    return self.safe_outcome(outcomeSymbol.clone(), &[]);
                }
            }
            let mut loadAll: Value = self.safe_bool_k(self.options.clone(), "loadAllOutcomes", &[Value::Bool(false)]);
            if is_true(&(is_equal(&loadAll, &Value::Bool(true)))) && !is_true(&wasWarm) {
                // a miss on a cold cache: bulk-load once so later lookups are 0-network hits.
                // a miss on an already-warm cache is authoritative — the outcome genuinely isn't
                // listed, so fall through to fetchOutcome (a real BadSymbol) rather than refetching
                // the whole listing (which would mask typos and clobber offline-injected markets)
                self.load_outcomes(&[]).await;
                if is_true(&self.has_outcome(outcomeSymbol.clone())) {
                    return self.safe_outcome(outcomeSymbol.clone(), &[]);
                }
            }
        }
        return self.fetch_outcome(outcomeSymbol.clone()).await;

    Value::Null
} }

    fn outcome_search_query(&self, mut outcomeSymbol: Value) -> Value {
        // derive a human search query from a unified outcome handle (EVENT_MARKET:LABEL) so a
        // cache miss can be resolved through the venue's scoped search instead of a bulk listing
        // download. returns undefined for id-like inputs (numeric token ids, 0x hashes) that
        // carry no searchable words
        let mut marketPart: Value = outcomeSymbol.clone();
        let mut colonIndex: Value = get_index_of(&outcomeSymbol, &Value::Str(":".to_string()));
        if is_greater_than_or_equal(&colonIndex, &Value::Int(0)) {
            marketPart = slice(&outcomeSymbol, &Value::Int(0), &colonIndex);
        }
        if is_equal(&get_index_of(&marketPart, &Value::Str("0x".to_string())), &Value::Int(0)) {
            return Value::Null;
        }
        // handles join words with '_' (slug-derived) or legacy '-' separated inputs (normalized below)
        let mut normalized: Value = replace_all_str(&to_lower(&marketPart), &Value::Str("-".to_string()), &Value::Str("_".to_string()));
        let mut rawWords: Value = split(&normalized, &Value::Str("_".to_string()));
        let mut words: Value = Value::List(vec![]);
        let mut hasLetters: bool = false;
        let mut letters: Value = Value::Str("abcdefghijklmnopqrstuvwxyz".to_string());
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_206: bool = true;
            while { if !__for_first_206 { i = add(&i, &Value::Int(1)); } __for_first_206 = false; is_less_than(&i, &get_array_length(&rawWords)) } {
            let mut word: Value = get_value(&rawWords, &i);
            let mut word: Value = get_value(&rawWords, &i);
            // inline .length so the php transpiler emits strlen() — the standalone
            // `const n = str.length;` statement form wrongly becomes count() (array)
            if is_equal(&get_array_length(&word), &Value::Int(0)) {
                continue;
            }
            let mut wordHasLetters: bool = false;
            let mut chars: Value = self.string_to_chars_array(word.clone());
            {
                                let mut ci: Value = Value::Int(0);
                let mut __for_first_205: bool = true;
                while { if !__for_first_205 { ci = add(&ci, &Value::Int(1)); } __for_first_205 = false; is_less_than(&ci, &get_array_length(&chars)) } {
                if is_greater_than_or_equal(&get_index_of(&letters, &get_value(&chars, &ci)), &Value::Int(0)) {
                    wordHasLetters = true;
                    break;
                }
            }
            }
            // the query is the handle's letter-bearing words only. standalone numeric
            // tokens (slug timestamps, strikes, years) are venue artifacts that title searches don't
            // reliably index — and since the result is re-checked against the EXACT handle,
            // a broader query only adds recall, never a wrong match
            if !is_true(&wordHasLetters) {
                continue;
            }
            append_to_array(&mut words, word.clone());
            hasLetters = true;
        }
        }
        let mut wordsLength: Value = get_array_length(&words);
        if is_true(&(is_equal(&wordsLength, &Value::Int(0)))) || !is_true(&hasLetters) {
            return Value::Null;
        }
        return join(&words, &Value::Str(" ".to_string()));

    Value::Null
}

    fn fetch_outcome(&mut self, mut outcomeSymbol: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_outcome", vec![outcomeSymbol.clone()]).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        // fetch just one outcome on demand — never through a bulk listing download. the base has
        // no generic by-id endpoint, so it derives a search query from the handle and resolves it
        // through the venue's own scoped fetchEvents (which caches everything it finds), then
        // re-checks the cache. venues with a real by-id fetch (kalshi by ticker, polymarket by
        // token id) override this with a cheaper single fetch and fall back to super on a miss.
        let mut searchQuery: Value = self.outcome_search_query(outcomeSymbol.clone());
        if is_true(&(!is_equal(&searchQuery, &Value::Null))) && is_true(&self.safe_bool_k(self.has.clone(), "fetchEvents", &[Value::Bool(false)])) {
            let mut searchLimit: Value = self.safe_integer_k(self.options.clone(), "fetchOutcomeSearchLimit", &[Value::Int(10)]);
            let _try_result = futures::FutureExt::catch_unwind(std::panic::AssertUnwindSafe(async {
                self.fetch_events(&[Value::Map({
    let mut m = indexmap::IndexMap::new();
        m.insert("query".to_string(), searchQuery.clone());
        m.insert("limit".to_string(), searchLimit.clone());
    m
})]).await;
             #[allow(unreachable_code)] { Value::Null }})).await;
if let Err(_try_err) = _try_result { let e: Value = panic_to_value(_try_err);
                // a query with zero matches surfaces as BadSymbol on some venues — treat it as a
                // plain miss (the guidance-rich throw below); let real transport errors propagate
                if !is_true(&(is_instance(&e, &Value::Str("BadSymbol".to_string())))) {
                    panic!("{}", e);
                }
            }
            if is_true(&self.has_outcome(outcomeSymbol.clone())) {
                return self.safe_outcome(outcomeSymbol.clone(), &[]);
            }
        }
        panic!("{}", crate::exchange_errors::bad_symbol(add(&add(&add(&self.id, &Value::Str(" could not resolve outcome ".to_string())), &outcomeSymbol), &Value::Str(" — call fetchEvents ({ 'query': ... }) first, or pass a known outcomeId".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchTicker
 * @description fetches a price ticker for a single prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure)
 */
    fn fetch_ticker(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_ticker", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTicker() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchTickers
 * @description fetches price tickers for multiple prediction outcomes at once
 * @param {string[]} [outcomes] unified outcome handles or outcome ids
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a dictionary of prediction [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure) indexed by outcome
 */
    fn fetch_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_tickers", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTickers() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOrderBook
 * @description fetches the order book for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {int} [limit] the maximum number of order book entries to return
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order book structure](https://docs.ccxt.com/#/?id=order-book-structure)
 */
    fn fetch_order_book(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_order_book", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut limit = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderBook() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOHLCV
 * @description fetches historical candlestick data for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {string} timeframe the length of time each candle represents
 * @param {int} [since] timestamp in ms of the earliest candle to fetch
 * @param {int} [limit] the maximum number of candles to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {int[][]} a list of candles ordered as timestamp, open, high, low, close, volume
 */
    fn fetch_ohlcv(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_ohlcv", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut timeframe = get_arg(optional_args, 0, Value::Str("1m".to_string()));
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        return self.super_fetch_ohlcv(outcome.clone(), timeframe.clone(), since.clone(), limit.clone(), params.clone()).await;

    Value::Null
} }

/*
 * @method
 * @name fetchTrades
 * @description get the list of most recent trades for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest trade to fetch
 * @param {int} [limit] the maximum number of trades to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=public-trades)
 */
    fn fetch_trades(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_trades", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut since = get_arg(optional_args, 0, Value::Null);
        let mut limit = get_arg(optional_args, 1, Value::Null);
        let mut params = get_arg(optional_args, 2, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTrades() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name createOrder
 * @description create a trade order on a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {string} type 'market' or 'limit'
 * @param {string} side 'buy' or 'sell'
 * @param {float} amount how many shares of the outcome to trade
 * @param {float} [price] the price at which the order is to be filled, in cost per share
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order structure](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn create_order(&mut self, mut outcome: Value, mut type_var: Value, mut side: Value, mut amount: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("create_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.push(type_var.clone()); __args.push(side.clone()); __args.push(amount.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut price = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrder() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name cancelOrder
 * @description cancels an open order
 * @param {string} id order id
 * @param {string} [outcome] unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order structure](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn cancel_order(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("cancel_order", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(id.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrder() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchTicker
 * @description watches a price ticker for a single prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [ticker structure](https://docs.ccxt.com/#/?id=ticker-structure)
 */
    fn watch_ticker(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTicker() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchOrderBook
 * @description watches the order book for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {int} [limit] the maximum number of order book entries to return
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order book structure](https://docs.ccxt.com/#/?id=order-book-structure)
 */
    fn watch_order_book(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut limit = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrderBook() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchTrades
 * @description watches the most recent trades for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest trade to fetch
 * @param {int} [limit] the maximum number of trades to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=public-trades)
 */
    fn watch_trades(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut since = get_arg(optional_args, 0, Value::Null);
        let mut limit = get_arg(optional_args, 1, Value::Null);
        let mut params = get_arg(optional_args, 2, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTrades() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOrders
 * @description fetches information on multiple orders made by the user
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest order to fetch
 * @param {int} [limit] the maximum number of orders to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn fetch_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOpenOrders
 * @description fetches information on the user's open orders
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest order to fetch
 * @param {int} [limit] the maximum number of orders to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn fetch_open_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_open_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchClosedOrders
 * @description fetches information on multiple closed orders made by the user
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest order to fetch
 * @param {int} [limit] the maximum number of orders to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn fetch_closed_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_closed_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchClosedOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOrderTrades
 * @description fetch all the trades made from a single order
 * @param {string} id order id
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest trade to fetch
 * @param {int} [limit] the maximum number of trades to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
 */
    fn fetch_order_trades(&mut self, mut id: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOrderTrades() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchMyTrades
 * @description fetch all trades made by the user
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest trade to fetch
 * @param {int} [limit] the maximum number of trades to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
 */
    fn fetch_my_trades(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_my_trades", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchMyTrades() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchPosition
 * @description fetch the open position held on a single prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [position structure](https://docs.ccxt.com/#/?id=position-structure)
 */
    fn fetch_position(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_position", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPosition() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchPositions
 * @description fetches the user's open positions
 * @param {string[]} [outcomes] unified outcome handles to filter by
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [position structures](https://docs.ccxt.com/#/?id=position-structure)
 */
    fn fetch_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_positions", { let mut __args: Vec<crate::Value> = Vec::new(); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchPositions() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchTradingFee
 * @description fetch the trading fee for a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [fee structure](https://docs.ccxt.com/#/?id=fee-structure)
 */
    fn fetch_trading_fee(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_trading_fee", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchTradingFee() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchOpenInterest
 * @description fetch the open interest of a prediction outcome
 * @param {string} outcome unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} an [open interest structure](https://docs.ccxt.com/#/?id=open-interest-structure)
 */
    fn fetch_open_interest(&mut self, mut outcome: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("fetch_open_interest", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(outcome.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchOpenInterest() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name createOrders
 * @description create a list of trade orders
 * @param {object[]} orders a list of PredictionOrderRequest objects, each carrying an `outcome` handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn create_orders(&mut self, mut orders: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("create_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(orders.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name cancelOrders
 * @description cancel multiple orders
 * @param {string[]} ids order ids
 * @param {string} [outcome] unified outcome handle
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn cancel_orders(&mut self, mut ids: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        // async-virtual: try the derived exchange first
        if let Some(__v) = self.dispatch_to_derived("cancel_orders", { let mut __args: Vec<crate::Value> = Vec::new(); __args.push(ids.clone()); __args.extend_from_slice(optional_args); __args }).await {
            if !matches!(__v, crate::Value::Null) { return __v; }
        }

        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" cancelOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name createMarketBuyOrderWithCost
 * @description create a market buy order on a prediction outcome by providing the cost
 * @param {string} outcome unified outcome handle
 * @param {float} cost how much you want to spend, in cost terms
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order structure](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn create_market_buy_order_with_cost(&mut self, mut outcome: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // safeBool, not this.options['...'] — a raw missing-key access throws KeyError in Python/PHP
        // when the option is undeclared (it is for every prediction exchange)
        if is_true(&self.safe_bool_k(self.options.clone(), "createMarketBuyOrderRequiresPrice", &[Value::Bool(false)])) || is_true(&self.safe_bool_k(self.has.clone(), "createMarketBuyOrderWithCost", &[Value::Bool(false)])) {
            return <Self as crate::prediction_exchange_generated::PredictionBase>::create_order(self, outcome.clone(), Value::Str("market".to_string()), Value::Str("buy".to_string()), cost.clone(), &[Value::Int(1), params.clone()]).await;
        }
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketBuyOrderWithCost() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name createMarketSellOrderWithCost
 * @description create a market sell order on a prediction outcome by providing the cost
 * @param {string} outcome unified outcome handle
 * @param {float} cost how much you want to receive, in cost terms
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a prediction [order structure](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn create_market_sell_order_with_cost(&mut self, mut outcome: Value, mut cost: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        if is_true(&self.safe_bool_k(self.options.clone(), "createMarketSellOrderRequiresPrice", &[Value::Bool(false)])) || is_true(&self.safe_bool_k(self.has.clone(), "createMarketSellOrderWithCost", &[Value::Bool(false)])) {
            return <Self as crate::prediction_exchange_generated::PredictionBase>::create_order(self, outcome.clone(), Value::Str("market".to_string()), Value::Str("sell".to_string()), cost.clone(), &[Value::Int(1), params.clone()]).await;
        }
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" createMarketSellOrderWithCost() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchTickers
 * @description watches price tickers for multiple prediction outcomes
 * @param {string[]} [outcomes] unified outcome handles to watch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object} a dictionary of prediction [ticker structures](https://docs.ccxt.com/#/?id=ticker-structure)
 */
    fn watch_tickers(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut params = get_arg(optional_args, 1, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchTickers() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchOrders
 * @description watches information on multiple orders made by the user
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest order to watch
 * @param {int} [limit] the maximum number of orders to watch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn watch_orders(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchOrders() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchMyTrades
 * @description watches all trades made by the user
 * @param {string} [outcome] unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest trade to watch
 * @param {int} [limit] the maximum number of trades to watch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=trade-structure)
 */
    fn watch_my_trades(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchMyTrades() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name watchPositions
 * @description watches the open positions held by the user
 * @param {string[]} [outcomes] unified outcome handles to watch
 * @param {int} [since] timestamp in ms of the earliest position to watch
 * @param {int} [limit] the maximum number of positions to watch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction [position structures](https://docs.ccxt.com/#/?id=position-structure)
 */
    fn watch_positions(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" watchPositions() is not supported yet".to_string()))));

    Value::Null
} }

/*
 * @method
 * @name fetchSettlements
 * @description fetches the user's settled (resolved) positions — the "close the loop" record after
 * markets resolve, with the collateral paid out and the realized pnl
 * @param {string} [outcome] filter to a single unified outcome handle
 * @param {int} [since] timestamp in ms of the earliest settlement to fetch
 * @param {int} [limit] the maximum number of settlements to fetch
 * @param {object} [params] extra exchange-specific parameters
 * @returns {object[]} a list of prediction settlement structures
 */
    fn fetch_settlements(&mut self, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" fetchSettlements() is not supported yet".to_string()))));

    Value::Null
} }

    fn safe_prediction_order(&self, mut outcomeOrder: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        // build the prediction order directly (do NOT delegate to the crypto safeOrder, which injects
        // ~a dozen derivatives fields — stopPrice/triggerPrice/reduceOnly noise — the prediction type
        // never declares, and whose parseTrades post-filters embedded fills by `symbol`, dropping every
        // outcome-addressed row). prediction is always linear with a contract size of 1.
        let mut amount: Value = self.omit_zero(self.safe_string_k(outcomeOrder.clone(), "amount", &[]));
        let mut filled: Value = self.safe_string_k(outcomeOrder.clone(), "filled", &[]);
        let mut remaining: Value = self.safe_string_k(outcomeOrder.clone(), "remaining", &[]);
        let mut cost: Value = self.safe_string_k(outcomeOrder.clone(), "cost", &[]);
        let mut average: Value = self.omit_zero(self.safe_string_k(outcomeOrder.clone(), "average", &[]));
        let mut price: Value = self.omit_zero(self.safe_string_k(outcomeOrder.clone(), "price", &[]));
        let mut side: Value = self.safe_string_k(outcomeOrder.clone(), "side", &[]);
        let mut status: Value = self.safe_string_k(outcomeOrder.clone(), "status", &[]);
        let mut lastTradeTimestamp: Value = self.safe_integer_k(outcomeOrder.clone(), "lastTradeTimestamp", &[]);
        // parse embedded fills with the OUTCOME-aware parser (parseTrades would drop them on the symbol filter)
        let mut rawTrades: Value = self.safe_list_k(outcomeOrder.clone(), "trades", &[Value::List(vec![])]);
        let mut trades: Value = self.parse_prediction_trades(rawTrades.clone(), &[outcomeObj.clone()]);
        let mut tradesLength: Value = get_array_length(&trades);
        let mut feeList: Value = Value::List(vec![]);
        if is_greater_than(&tradesLength, &Value::Int(0)) {
            if is_equal(&filled, &Value::Null) {
                filled = Value::Str("0".to_string());
            }
            if is_equal(&cost, &Value::Null) {
                cost = Value::Str("0".to_string());
            }
            {
                                let mut i: Value = Value::Int(0);
                let mut __for_first_207: bool = true;
                while { if !__for_first_207 { i = add(&i, &Value::Int(1)); } __for_first_207 = false; is_less_than(&i, &tradesLength) } {
                let mut trade: Value = get_value(&trades, &i);
                let mut trade: Value = get_value(&trades, &i);
                let mut tradeAmount: Value = self.safe_string_k(trade.clone(), "amount", &[]);
                if !is_equal(&tradeAmount, &Value::Null) {
                    filled = crate::precise::Precise::stringAdd(&filled, &tradeAmount);
                }
                let mut tradeCost: Value = self.safe_string_k(trade.clone(), "cost", &[]);
                if !is_equal(&tradeCost, &Value::Null) {
                    cost = crate::precise::Precise::stringAdd(&cost, &tradeCost);
                }
                if is_equal(&side, &Value::Null) {
                    side = self.safe_string_k(trade.clone(), "side", &[]);
                }
                let mut tradeTimestamp: Value = self.safe_integer_k(trade.clone(), "timestamp", &[]);
                if !is_equal(&tradeTimestamp, &Value::Null) {
                    if is_equal(&lastTradeTimestamp, &Value::Null) {
                        lastTradeTimestamp = tradeTimestamp.clone();
                    }  else if is_greater_than(&tradeTimestamp, &lastTradeTimestamp) {
                        lastTradeTimestamp = tradeTimestamp.clone();
                    }
                }
                let mut tradeFee: Value = self.safe_dict_k(trade.clone(), "fee", &[]);
                if !is_equal(&tradeFee, &Value::Null) {
                    append_to_array(&mut feeList, tradeFee.clone());
                }
            }
            }
        }
        // fill any totals the venue left undefined (linear, contract size 1)
        if is_true(&(is_equal(&filled, &Value::Null))) && is_true(&(!is_equal(&amount, &Value::Null))) && is_true(&(!is_equal(&remaining, &Value::Null))) {
            filled = crate::precise::Precise::stringSub(&amount, &remaining);
        }
        if is_true(&(is_equal(&remaining, &Value::Null))) && is_true(&(!is_equal(&amount, &Value::Null))) && is_true(&(!is_equal(&filled, &Value::Null))) {
            remaining = crate::precise::Precise::stringSub(&amount, &filled);
        }
        if is_true(&(is_equal(&amount, &Value::Null))) && is_true(&(!is_equal(&filled, &Value::Null))) && is_true(&(!is_equal(&remaining, &Value::Null))) {
            amount = crate::precise::Precise::stringAdd(&filled, &remaining);
        }
        if is_true(&(is_equal(&average, &Value::Null))) && is_true(&(!is_equal(&filled, &Value::Null))) && is_true(&(!is_equal(&cost, &Value::Null))) && is_true(&crate::precise::Precise::stringGt(&filled, &Value::Str("0".to_string()))) {
            average = crate::precise::Precise::stringDiv(&cost, &filled);
        }
        if is_true(&(is_equal(&cost, &Value::Null))) && is_true(&(!is_equal(&filled, &Value::Null))) {
            let mut multiplyPrice: Value = ternary(is_true(&(!is_equal(&average, &Value::Null))), average.clone(), price.clone());
            if !is_equal(&multiplyPrice, &Value::Null) {
                cost = crate::precise::Precise::stringMul(&filled, &multiplyPrice);
            }
        }
        let mut fee: Value = self.safe_dict_k(outcomeOrder.clone(), "fee", &[]);
        // own-line length reads so the regex transpiler emits count() (array), not strlen()
        let mut feeListLength: Value = get_array_length(&feeList);
        if is_true(&(is_equal(&fee, &Value::Null))) && is_true(&(is_greater_than(&feeListLength, &Value::Int(0)))) {
            let mut reduced: Value = self.reduce_fees_by_currency(feeList.clone());
            let mut reducedLength: Value = get_array_length(&reduced);
            if is_greater_than(&reducedLength, &Value::Int(0)) {
                fee = get_value(&reduced, &Value::Int(0));
            }
        }
        // derive timeInForce/postOnly the same way the crypto safeOrder does (prediction has no
        // trigger orders, so the isTriggerOrSLTp guard collapses): a market order defaults to IOC
        let mut orderType: Value = self.safe_string_k(outcomeOrder.clone(), "type", &[]);
        let mut timeInForce: Value = self.safe_string_k(outcomeOrder.clone(), "timeInForce", &[]);
        let mut postOnly: Value = self.safe_bool_k(outcomeOrder.clone(), "postOnly", &[]);
        if is_equal(&timeInForce, &Value::Null) {
            if is_equal(&orderType, &Value::Str("market".to_string())) {
                timeInForce = Value::Str("IOC".to_string());
            }
            if is_equal(&postOnly, &Value::Bool(true)) {
                timeInForce = Value::Str("PO".to_string());
            }
        }  else if is_equal(&postOnly, &Value::Null) {
            postOnly = Value::Bool(is_equal(&timeInForce, &Value::Str("PO".to_string())));
        }
        let mut timestamp: Value = self.safe_integer_k(outcomeOrder.clone(), "timestamp", &[]);
        let mut datetime: Value = self.safe_string_k(outcomeOrder.clone(), "datetime", &[]);
        if is_equal(&datetime, &Value::Null) {
            datetime = self.iso8601(timestamp.clone());
        }
        let mut result: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("id".to_string(), self.safe_string_k(outcomeOrder.clone(), "id", &[]));
                m.insert("clientOrderId".to_string(), self.safe_string_k(outcomeOrder.clone(), "clientOrderId", &[]));
                m.insert("timestamp".to_string(), timestamp.clone());
                m.insert("datetime".to_string(), datetime.clone());
                m.insert("lastTradeTimestamp".to_string(), lastTradeTimestamp.clone());
                m.insert("lastUpdateTimestamp".to_string(), self.safe_integer_k(outcomeOrder.clone(), "lastUpdateTimestamp", &[]));
                m.insert("status".to_string(), status.clone());
                m.insert("type".to_string(), orderType.clone());
                m.insert("timeInForce".to_string(), timeInForce.clone());
                m.insert("side".to_string(), side.clone());
                m.insert("price".to_string(), self.parse_number(price.clone(), &[]));
                m.insert("average".to_string(), self.parse_number(average.clone(), &[]));
                m.insert("amount".to_string(), self.parse_number(amount.clone(), &[]));
                m.insert("filled".to_string(), self.parse_number(filled.clone(), &[]));
                m.insert("remaining".to_string(), self.parse_number(remaining.clone(), &[]));
                m.insert("cost".to_string(), self.parse_number(cost.clone(), &[]));
                m.insert("fee".to_string(), fee.clone());
                m.insert("reduceOnly".to_string(), self.safe_bool_k(outcomeOrder.clone(), "reduceOnly", &[]));
                m.insert("postOnly".to_string(), postOnly.clone());
                m.insert("trades".to_string(), trades.clone());
                m.insert("outcome".to_string(), self.safe_string_k(outcomeOrder.clone(), "outcome", &[]));
                m.insert("outcomeId".to_string(), self.safe_string_k(outcomeOrder.clone(), "outcomeId", &[]));
                m.insert("label".to_string(), self.safe_string_k(outcomeOrder.clone(), "label", &[]));
                m.insert("market".to_string(), self.safe_string_k(outcomeOrder.clone(), "market", &[]));
                m.insert("event".to_string(), self.safe_string_k(outcomeOrder.clone(), "event", &[]));
                m.insert("info".to_string(), self.safe_value_k(outcomeOrder.clone(), "info", &[outcomeOrder.clone()]));
            m
        });
        return result;

    Value::Null
}

    fn safe_prediction_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        // build the prediction trade directly (no crypto safeTrade, which leaks fields the type omits)
        let mut price: Value = self.safe_string_k(trade.clone(), "price", &[]);
        let mut amount: Value = self.safe_string_k(trade.clone(), "amount", &[]);
        let mut cost: Value = self.safe_string_k(trade.clone(), "cost", &[]);
        if is_true(&(is_equal(&cost, &Value::Null))) && is_true(&(!is_equal(&price, &Value::Null))) && is_true(&(!is_equal(&amount, &Value::Null))) {
            cost = crate::precise::Precise::stringMul(&price, &amount);
        }
        let mut timestamp: Value = self.safe_integer_k(trade.clone(), "timestamp", &[]);
        let mut datetime: Value = self.safe_string_k(trade.clone(), "datetime", &[]);
        if is_equal(&datetime, &Value::Null) {
            datetime = self.iso8601(timestamp.clone());
        }
        let mut result: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("id".to_string(), self.safe_string_k(trade.clone(), "id", &[]));
                m.insert("order".to_string(), self.safe_string_k(trade.clone(), "order", &[]));
                m.insert("timestamp".to_string(), timestamp.clone());
                m.insert("datetime".to_string(), datetime.clone());
                m.insert("type".to_string(), self.safe_string_k(trade.clone(), "type", &[]));
                m.insert("side".to_string(), self.safe_string_k(trade.clone(), "side", &[]));
                m.insert("takerOrMaker".to_string(), self.safe_string_k(trade.clone(), "takerOrMaker", &[]));
                m.insert("price".to_string(), self.parse_number(price.clone(), &[]));
                m.insert("amount".to_string(), self.parse_number(amount.clone(), &[]));
                m.insert("cost".to_string(), self.parse_number(cost.clone(), &[]));
                m.insert("fee".to_string(), self.safe_dict_k(trade.clone(), "fee", &[]));
                m.insert("realizedPnl".to_string(), self.safe_number_k(trade.clone(), "realizedPnl", &[]));
                m.insert("outcome".to_string(), self.safe_string_k(trade.clone(), "outcome", &[]));
                m.insert("outcomeId".to_string(), self.safe_string_k(trade.clone(), "outcomeId", &[]));
                m.insert("label".to_string(), self.safe_string_k(trade.clone(), "label", &[]));
                m.insert("market".to_string(), self.safe_string_k(trade.clone(), "market", &[]));
                m.insert("info".to_string(), self.safe_value_k(trade.clone(), "info", &[trade.clone()]));
            m
        });
        return result;

    Value::Null
}

    fn safe_prediction_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        // build the prediction ticker directly (no crypto safeTicker, which injects vwap/previousClose/
        // indexPrice/markPrice the type omits). derive change/percentage/average only from open+close —
        // prediction venues report those directly, so the crypto back-derivation from percentage is moot.
        let mut open: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "open", &[]));
        let mut close: Value = self.omit_zero(self.safe_string2(ticker.clone(), Value::Str("close".to_string()), Value::Str("last".to_string()), &[]));
        let mut last: Value = self.omit_zero(self.safe_string2(ticker.clone(), Value::Str("last".to_string()), Value::Str("close".to_string()), &[]));
        let mut change: Value = self.safe_string_k(ticker.clone(), "change", &[]);
        let mut percentage: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "percentage", &[]));
        let mut average: Value = self.omit_zero(self.safe_string_k(ticker.clone(), "average", &[]));
        if is_true(&(is_equal(&change, &Value::Null))) && is_true(&(!is_equal(&open, &Value::Null))) && is_true(&(!is_equal(&close, &Value::Null))) {
            change = crate::precise::Precise::stringSub(&close, &open);
        }
        if is_true(&(is_equal(&percentage, &Value::Null))) && is_true(&(!is_equal(&change, &Value::Null))) && is_true(&(!is_equal(&open, &Value::Null))) && is_true(&crate::precise::Precise::stringGt(&open, &Value::Str("0".to_string()))) {
            percentage = crate::precise::Precise::stringMul(&crate::precise::Precise::stringDiv(&change, &open), &Value::Str("100".to_string()));
        }
        if is_true(&(is_equal(&average, &Value::Null))) && is_true(&(!is_equal(&open, &Value::Null))) && is_true(&(!is_equal(&close, &Value::Null))) {
            average = crate::precise::Precise::stringDiv(&crate::precise::Precise::stringAdd(&open, &close), &Value::Str("2".to_string()));
        }
        let mut timestamp: Value = self.safe_integer_k(ticker.clone(), "timestamp", &[]);
        let mut datetime: Value = self.safe_string_k(ticker.clone(), "datetime", &[]);
        if is_equal(&datetime, &Value::Null) {
            datetime = self.iso8601(timestamp.clone());
        }
        let mut result: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("timestamp".to_string(), timestamp.clone());
                m.insert("datetime".to_string(), datetime.clone());
                m.insert("high".to_string(), self.safe_number_k(ticker.clone(), "high", &[]));
                m.insert("low".to_string(), self.safe_number_k(ticker.clone(), "low", &[]));
                m.insert("bid".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "bid", &[])), &[]));
                m.insert("bidVolume".to_string(), self.safe_number_k(ticker.clone(), "bidVolume", &[]));
                m.insert("ask".to_string(), self.parse_number(self.omit_zero(self.safe_string_k(ticker.clone(), "ask", &[])), &[]));
                m.insert("askVolume".to_string(), self.safe_number_k(ticker.clone(), "askVolume", &[]));
                m.insert("open".to_string(), self.parse_number(open.clone(), &[]));
                m.insert("close".to_string(), self.parse_number(close.clone(), &[]));
                m.insert("last".to_string(), self.parse_number(last.clone(), &[]));
                m.insert("change".to_string(), self.parse_number(change.clone(), &[]));
                m.insert("percentage".to_string(), self.parse_number(percentage.clone(), &[]));
                m.insert("average".to_string(), self.parse_number(average.clone(), &[]));
                m.insert("baseVolume".to_string(), self.safe_number_k(ticker.clone(), "baseVolume", &[]));
                m.insert("quoteVolume".to_string(), self.safe_number_k(ticker.clone(), "quoteVolume", &[]));
                m.insert("openInterest".to_string(), self.safe_number_k(ticker.clone(), "openInterest", &[]));
                m.insert("outcome".to_string(), self.safe_string_k(ticker.clone(), "outcome", &[]));
                m.insert("outcomeId".to_string(), self.safe_string_k(ticker.clone(), "outcomeId", &[]));
                m.insert("label".to_string(), self.safe_string_k(ticker.clone(), "label", &[]));
                m.insert("market".to_string(), self.safe_string_k(ticker.clone(), "market", &[]));
                m.insert("event".to_string(), self.safe_string_k(ticker.clone(), "event", &[]));
                m.insert("info".to_string(), self.safe_value_k(ticker.clone(), "info", &[ticker.clone()]));
            m
        });
        return result;

    Value::Null
}

    fn safe_prediction_position(&self, mut position: Value) -> Value {
        // build the prediction position directly (no crypto safePosition, which carries the whole
        // leverage/marginMode/liquidation block the prediction type omits)
        let mut timestamp: Value = self.safe_integer_k(position.clone(), "timestamp", &[]);
        let mut datetime: Value = self.safe_string_k(position.clone(), "datetime", &[]);
        if is_equal(&datetime, &Value::Null) {
            datetime = self.iso8601(timestamp.clone());
        }
        let mut result: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("id".to_string(), self.safe_string_k(position.clone(), "id", &[]));
                m.insert("timestamp".to_string(), timestamp.clone());
                m.insert("datetime".to_string(), datetime.clone());
                m.insert("contracts".to_string(), self.safe_number_k(position.clone(), "contracts", &[]));
                m.insert("contractSize".to_string(), self.safe_number_k(position.clone(), "contractSize", &[]));
                m.insert("side".to_string(), self.safe_string_k(position.clone(), "side", &[]));
                m.insert("notional".to_string(), self.safe_number_k(position.clone(), "notional", &[]));
                m.insert("unrealizedPnl".to_string(), self.safe_number_k(position.clone(), "unrealizedPnl", &[]));
                m.insert("realizedPnl".to_string(), self.safe_number_k(position.clone(), "realizedPnl", &[]));
                m.insert("collateral".to_string(), self.safe_number_k(position.clone(), "collateral", &[]));
                m.insert("entryPrice".to_string(), self.safe_number_k(position.clone(), "entryPrice", &[]));
                m.insert("markPrice".to_string(), self.safe_number_k(position.clone(), "markPrice", &[]));
                m.insert("lastPrice".to_string(), self.safe_number_k(position.clone(), "lastPrice", &[]));
                m.insert("percentage".to_string(), self.safe_number_k(position.clone(), "percentage", &[]));
                m.insert("resolved".to_string(), self.safe_bool_k(position.clone(), "resolved", &[]));
                m.insert("won".to_string(), self.safe_bool_k(position.clone(), "won", &[]));
                m.insert("settleFraction".to_string(), self.safe_number_k(position.clone(), "settleFraction", &[]));
                m.insert("payout".to_string(), self.safe_number_k(position.clone(), "payout", &[]));
                m.insert("outcome".to_string(), self.safe_string_k(position.clone(), "outcome", &[]));
                m.insert("outcomeId".to_string(), self.safe_string_k(position.clone(), "outcomeId", &[]));
                m.insert("label".to_string(), self.safe_string_k(position.clone(), "label", &[]));
                m.insert("market".to_string(), self.safe_string_k(position.clone(), "market", &[]));
                m.insert("event".to_string(), self.safe_string_k(position.clone(), "event", &[]));
                m.insert("info".to_string(), self.safe_value_k(position.clone(), "info", &[position.clone()]));
            m
        });
        return result;

    Value::Null
}

    fn safe_prediction_order_book(&self, mut orderbook: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        // normalize a parsed order book to the prediction shape: replace the unified
        // `symbol` with the `outcome` handle and attach the outcome identity fields
        // outcomeId and market - so books match the PredictionOrderBook structure.
        let mut fallback: Value = self.safe_string2(orderbook.clone(), Value::Str("outcome".to_string()), Value::Str("symbol".to_string()), &[]);
        add_element_to_object(&mut orderbook, &Value::Str("outcome".to_string()), ternary(is_true(&(is_equal(&outcomeObj, &Value::Null))), fallback.clone(), self.safe_string_k(outcomeObj.clone(), "outcome", &[fallback.clone()])));
        { let __be_tmp = ternary(is_true(&(is_equal(&outcomeObj, &Value::Null))), self.safe_string_k(orderbook.clone(), "outcomeId", &[]), self.safe_string_k(outcomeObj.clone(), "outcomeId", &[])); add_element_to_object(&mut orderbook, &Value::Str("outcomeId".to_string()), __be_tmp.clone()); };
        { let __be_tmp = ternary(is_true(&(is_equal(&outcomeObj, &Value::Null))), self.safe_string_k(orderbook.clone(), "market", &[]), self.safe_string_k(outcomeObj.clone(), "market", &[])); add_element_to_object(&mut orderbook, &Value::Str("market".to_string()), __be_tmp.clone()); };
        return self.omit(orderbook.clone(), Value::Str("symbol".to_string()), &[]);

    Value::Null
}

    fn parse_prediction_ticker(&self, mut ticker: Value, optional_args: &[Value]) -> Value {
        let mut market = get_arg(optional_args, 0, Value::Null);
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePredictionTicker() is not supported yet".to_string()))));

    Value::Null
}

    fn parse_prediction_order(&self, mut order: Value, optional_args: &[Value]) -> Value {
        // virtual-dispatch (static: DerivedExchange::parse_prediction_order(self, ...))
        { let __v = crate::exchange::DerivedExchange::parse_prediction_order(self, order.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }

        let mut market = get_arg(optional_args, 0, Value::Null);
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePredictionOrder() is not supported yet".to_string()))));

    Value::Null
}

    fn parse_prediction_trade(&self, mut trade: Value, optional_args: &[Value]) -> Value {
        // virtual-dispatch (static: DerivedExchange::parse_prediction_trade(self, ...))
        { let __v = crate::exchange::DerivedExchange::parse_prediction_trade(self, trade.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }

        let mut market = get_arg(optional_args, 0, Value::Null);
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePredictionTrade() is not supported yet".to_string()))));

    Value::Null
}

    fn parse_prediction_position(&self, mut position: Value, optional_args: &[Value]) -> Value {
        // virtual-dispatch (static: DerivedExchange::parse_prediction_position(self, ...))
        { let __v = crate::exchange::DerivedExchange::parse_prediction_position(self, position.clone(), crate::runtime::get_arg(optional_args, 0, crate::Value::Null)); if !matches!(__v, crate::Value::Null) { return __v; } }

        let mut market = get_arg(optional_args, 0, Value::Null);
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePredictionPosition() is not supported yet".to_string()))));

    Value::Null
}

    fn parse_prediction_open_interest(&self, mut interest: Value, optional_args: &[Value]) -> Value {
        let mut market = get_arg(optional_args, 0, Value::Null);
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" parsePredictionOpenInterest() is not supported yet".to_string()))));

    Value::Null
}

/*
 * @ignore
 * @method
 * @name PredictionExchange#parsePredictionTrades
 * @description parses a list of raw trades with the exchange's parsePredictionTrade, sorts them and filters by the outcome handle — the prediction analogue of the base parseTrades
 * @param {object[]} trades the raw trades
 * @param {object} [outcomeObj] the resolved outcome object the trades belong to
 * @param {int} [since] timestamp in ms of the earliest trade to return
 * @param {int} [limit] the maximum number of trades to return
 * @param {object} [params] extra fields to merge into every parsed trade
 * @returns {object[]} a list of prediction [trade structures](https://docs.ccxt.com/#/?id=public-trades)
 */
    fn parse_prediction_trades(&self, mut trades: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // prediction-market analogue of the base parseTrades: the base aggregator post-filters
        // by the market's `symbol` key, but prediction structures carry an `outcome` handle
        // instead — and an outcome object rebuilt from cached markets may still hold a legacy
        // `symbol` key, which would silently drop every parsed row
        let mut rows: Value = self.to_array(trades.clone());
        let mut results: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_208: bool = true;
            while { if !__for_first_208 { i = add(&i, &Value::Int(1)); } __for_first_208 = false; is_less_than(&i, &get_array_length(&rows)) } {
            let mut parsed: Value = <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_trade(self, get_value(&rows, &i), &[outcomeObj.clone()]);
            let mut trade: Value = self.extend(parsed.clone(), &[params.clone()]);
            append_to_array(&mut results, trade.clone());
        }
        }
        results = self.sort_by2(results.clone(), Value::Str("timestamp".to_string()), Value::Str("id".to_string()), &[]);
        let mut outcomeHandle: Value = self.safe_string_k(outcomeObj.clone(), "outcome", &[]);
        return self.filter_by_outcome_since_limit(results.clone(), &[outcomeHandle.clone(), since.clone(), limit.clone()]);

    Value::Null
}

/*
 * @ignore
 * @method
 * @name PredictionExchange#parsePredictionOrders
 * @description parses a list of raw orders with the exchange's parsePredictionOrder, sorts them and filters by the outcome handle — the prediction analogue of the base parseOrders
 * @param {object[]} orders the raw orders
 * @param {object} [outcomeObj] the resolved outcome object the orders belong to
 * @param {int} [since] timestamp in ms of the earliest order to return
 * @param {int} [limit] the maximum number of orders to return
 * @param {object} [params] extra fields to merge into every parsed order
 * @returns {object[]} a list of prediction [order structures](https://docs.ccxt.com/#/?id=order-structure)
 */
    fn parse_prediction_orders(&self, mut orders: Value, optional_args: &[Value]) -> Value {
        let mut outcomeObj = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut params = get_arg(optional_args, 3, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // prediction-market analogue of the base parseOrders — see parsePredictionTrades
        let mut rows: Value = self.to_array(orders.clone());
        let mut results: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_209: bool = true;
            while { if !__for_first_209 { i = add(&i, &Value::Int(1)); } __for_first_209 = false; is_less_than(&i, &get_array_length(&rows)) } {
            let mut parsed: Value = <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_order(self, get_value(&rows, &i), &[outcomeObj.clone()]);
            let mut order: Value = self.extend(parsed.clone(), &[params.clone()]);
            append_to_array(&mut results, order.clone());
        }
        }
        results = self.sort_by(results.clone(), Value::Str("timestamp".to_string()), &[]);
        let mut outcomeHandle: Value = self.safe_string_k(outcomeObj.clone(), "outcome", &[]);
        return self.filter_by_outcome_since_limit(results.clone(), &[outcomeHandle.clone(), since.clone(), limit.clone()]);

    Value::Null
}

/*
 * @ignore
 * @method
 * @name PredictionExchange#parsePredictionPositions
 * @description parses a list of raw positions with the exchange's parsePredictionPosition — the prediction analogue of the base parsePositions
 * @param {object[]} positions the raw positions
 * @param {object} [params] extra fields to merge into every parsed position
 * @returns {object[]} a list of prediction [position structures](https://docs.ccxt.com/#/?id=position-structure)
 */
    fn parse_prediction_positions(&self, mut positions: Value, optional_args: &[Value]) -> Value {
        let mut params = get_arg(optional_args, 0, Value::Map({
    let mut m = indexmap::IndexMap::new();
    m
}));
        // prediction-market analogue of the base parsePositions, which resolves its `symbols`
        // argument through marketSymbols() and would throw BadSymbol on outcome handles.
        // venue-specific outcome filtering stays in the exchange (position identity differs
        // per venue: kalshi positions are market-level, polymarket ones are per token)
        let mut rows: Value = self.to_array(positions.clone());
        let mut results: Value = Value::List(vec![]);
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_210: bool = true;
            while { if !__for_first_210 { i = add(&i, &Value::Int(1)); } __for_first_210 = false; is_less_than(&i, &get_array_length(&rows)) } {
            let mut parsed: Value = <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_position(self, get_value(&rows, &i), &[]);
            let mut position: Value = self.extend(parsed.clone(), &[params.clone()]);
            append_to_array(&mut results, position.clone());
        }
        }
        return results;

    Value::Null
}

    fn filter_by_outcome_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
        let mut outcome = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut tail = get_arg(optional_args, 3, Value::Bool(false));
        return self.filter_by_value_since_limit(array.clone(), Value::Str("outcome".to_string()), &[outcome.clone(), since.clone(), limit.clone(), Value::Str("timestamp".to_string()), tail.clone()]);

    Value::Null
}

    fn filter_by_outcomes_since_limit(&self, mut array: Value, optional_args: &[Value]) -> Value {
        let mut outcomes = get_arg(optional_args, 0, Value::Null);
        let mut since = get_arg(optional_args, 1, Value::Null);
        let mut limit = get_arg(optional_args, 2, Value::Null);
        let mut tail = get_arg(optional_args, 3, Value::Bool(false));
        let mut result: Value = self.filter_by_array(array.clone(), Value::Str("outcome".to_string()), &[outcomes.clone(), Value::Bool(false)]);
        return self.filter_by_since_limit(result.clone(), &[since.clone(), limit.clone(), Value::Str("timestamp".to_string()), tail.clone()]);

    Value::Null
}

    fn amount_to_prediction_precision(&self, mut outcome: Value, mut amount: Value) -> Value {
        let mut outcomeObj: Value = self.outcome(outcome.clone());
        let mut marketSymbol: Value = self.safe_string_k(outcomeObj.clone(), "market", &[]);
        return self.amount_to_precision(marketSymbol.clone(), amount.clone());

    Value::Null
}

    fn price_to_prediction_precision(&self, mut outcome: Value, mut price: Value) -> Value {
        let mut outcomeObj: Value = self.outcome(outcome.clone());
        let mut marketSymbol: Value = self.safe_string_k(outcomeObj.clone(), "market", &[]);
        return self.price_to_precision(marketSymbol.clone(), price.clone());

    Value::Null
}

    fn cost_to_prediction_precision(&self, mut outcome: Value, mut cost: Value) -> Value {
        let mut outcomeObj: Value = self.outcome(outcome.clone());
        let mut marketSymbol: Value = self.safe_string_k(outcomeObj.clone(), "market", &[]);
        return self.cost_to_precision(marketSymbol.clone(), cost.clone());

    Value::Null
}

// ------------------------------------------------------------------------
// shared EVM helpers — RLP encoding + a minimal JSON-RPC client + raw-tx
// broadcast, used by the on-chain (EOA) trading paths of EVM prediction
// venues (limitless, myriad). signEvmTransaction stays per-exchange because
// it needs the noble crypto imports (keccak/ecdsa/secp256k1) which the
// per-language prediction base skeletons don't carry; this base
// sendEvmTransaction dispatches to the exchange's signEvmTransaction override
    fn pad_hex_to_even(&self, mut hex: Value) -> Value {
        if is_equal(&hex, &Value::Null) {
            return Value::Str("".to_string());
        }
        // prepend a nibble so the hex has an even number of characters (whole bytes)
        let mut hexLength: Value = get_array_length(&hex);
        if !is_equal(&(mod_val(&hexLength, &Value::Int(2))), &Value::Int(0)) {
            return add(&Value::Str("0".to_string()), &hex);
        }
        return hex;

    Value::Null
}

    fn pad_hex_address(&self, mut address: Value) -> Value {
        if is_equal(&address, &Value::Null) {
            return Value::Str("".to_string());
        }
        // left-pads a 20-byte address to a 32-byte ABI word (24 leading zero bytes)
        let mut stripped: Value = self.remove0x_prefix(address.clone());
        return add(&Value::Str("000000000000000000000000".to_string()), &stripped);

    Value::Null
}

    fn rlp_encode_bytes(&self, mut hex: Value) -> Value {
        if is_equal(&hex, &Value::Null) {
            return Value::Str("".to_string());
        }
        // RLP-encodes a single byte string (hex without 0x) per the Ethereum RLP spec
        let mut byteLength: Value = self.parse_to_int(divide(&get_array_length(&hex), &Value::Int(2)));
        if is_equal(&byteLength, &Value::Int(0)) {
            return Value::Str("80".to_string());
        }
        if is_true(&(is_equal(&byteLength, &Value::Int(1)))) && is_true(&(is_less_than(&hex, &Value::Str("80".to_string())))) {
            return hex;
        }
        if is_less_than(&byteLength, &Value::Int(56)) {
            return add(&self.int_to_base16(add(&Value::Int(128), &byteLength), &[]), &hex);
        }
        let mut lengthHex: Value = self.int_to_base16(byteLength.clone(), &[]);
        lengthHex = self.pad_hex_to_even(lengthHex.clone());
        let mut lengthOfLength: Value = self.parse_to_int(divide(&get_array_length(&lengthHex), &Value::Int(2)));
        return add(&add(&self.int_to_base16(add(&Value::Int(183), &lengthOfLength), &[]), &lengthHex), &hex);

    Value::Null
}

    fn rlp_encode_list(&self, mut items: Value) -> Value {
        let mut concatenated: Value = Value::Str("".to_string());
        {
                        let mut i: Value = Value::Int(0);
            let mut __for_first_211: bool = true;
            while { if !__for_first_211 { i = add(&i, &Value::Int(1)); } __for_first_211 = false; is_less_than(&i, &get_array_length(&items)) } {
            concatenated = add(&concatenated, &get_value(&items, &i));
        }
        }
        let mut byteLength: Value = self.parse_to_int(divide(&get_array_length(&concatenated), &Value::Int(2)));
        if is_less_than(&byteLength, &Value::Int(56)) {
            return add(&self.int_to_base16(add(&Value::Int(192), &byteLength), &[]), &concatenated);
        }
        let mut lengthHex: Value = self.int_to_base16(byteLength.clone(), &[]);
        lengthHex = self.pad_hex_to_even(lengthHex.clone());
        let mut lengthOfLength: Value = self.parse_to_int(divide(&get_array_length(&lengthHex), &Value::Int(2)));
        return add(&add(&self.int_to_base16(add(&Value::Int(247), &lengthOfLength), &[]), &lengthHex), &concatenated);

    Value::Null
}

    fn int_to_rlp_hex(&self, mut value: Value) -> Value {
        if is_equal(&value, &Value::Null) {
            panic!("{}", crate::exchange_errors::arguments_required(add(&self.id, &Value::Str(" intToRlpHex() requires a value argument".to_string()))));
        }
        // an integer as its minimal big-endian byte hex; 0 is the empty byte string
        if is_equal(&value, &Value::Int(0)) {
            return Value::Str("".to_string());
        }
        let mut hex: Value = self.int_to_base16(value.clone(), &[]);
        hex = self.pad_hex_to_even(hex.clone());
        return hex;

    Value::Null
}

    fn hex_to_rlp_bytes(&self, mut hexValue: Value) -> Value {
        // a hex value (e.g. an RPC result) as minimal big-endian byte hex; leading zero bytes
        // are stripped and 0 becomes the empty byte string (RLP integer encoding)
        if is_equal(&hexValue, &Value::Null) {
            return Value::Str("".to_string());
        }
        let mut h: Value = self.remove0x_prefix(hexValue.clone());
        let mut start: Value = Value::Int(0);
        let mut total: Value = get_array_length(&h);
        while is_true(&(is_less_than(&start, &total))) && is_true(&(is_equal(&slice(&h, &start, &add(&start, &Value::Int(1))), &Value::Str("0".to_string())))) {
            start = add(&start, &Value::Int(1));
        }
        h = slice(&h, &start, &Value::Null);
        if is_equal(&h, &Value::Str("".to_string())) {
            return Value::Str("".to_string());
        }
        h = self.pad_hex_to_even(h.clone());
        return h;

    Value::Null
}

// eslint-disable-next-line no-unused-vars
    fn sign_evm_transaction(&self, mut tx: Value, mut privateKey: Value) -> Value {
        panic!("{}", crate::exchange_errors::not_supported(add(&self.id, &Value::Str(" signEvmTransaction() must be overridden by the exchange".to_string()))));

    Value::Null
}

    fn eth_rpc(&mut self, mut rpcUrl: Value, mut method: Value, mut rpcParams: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut payload: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("jsonrpc".to_string(), Value::Str("2.0".to_string()));
                m.insert("id".to_string(), Value::Int(1));
                m.insert("method".to_string(), method.clone());
                m.insert("params".to_string(), rpcParams.clone());
            m
        });
        let mut headers: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("Content-Type".to_string(), Value::Str("application/json".to_string()));
            m
        });
        let __ws_arg_0 = self.json(payload.clone());
        let mut response: Value = self.fetch(rpcUrl.clone(), &[Value::Str("POST".to_string()), headers.clone(), __ws_arg_0]).await;
        let mut rpcError: Value = self.safe_value_k(response.clone(), "error", &[]);
        if !is_equal(&rpcError, &Value::Null) {
            panic!("{}", crate::exchange_errors::exchange_error(add(&add(&add(&add(&self.id, &Value::Str(" rpc ".to_string())), &method), &Value::Str(" error: ".to_string())), &self.json(rpcError.clone()))));
        }
        return self.safe_value_k(response.clone(), "result", &[]);

    Value::Null
} }

    fn send_evm_transaction(&mut self, mut rpcUrl: Value, mut chainId: Value, mut fromAddress: Value, mut to: Value, mut value: Value, mut data: Value, mut gasLimit: Value) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut nonce: Value = self.eth_rpc(rpcUrl.clone(), Value::Str("eth_getTransactionCount".to_string()), Value::List(vec![fromAddress.clone(), Value::Str("pending".to_string())])).await;
        let mut gasPrice: Value = self.eth_rpc(rpcUrl.clone(), Value::Str("eth_gasPrice".to_string()), Value::List(vec![])).await;
        let mut tx: Value = Value::Map({
            let mut m = indexmap::IndexMap::new();
                m.insert("chainId".to_string(), chainId.clone());
                m.insert("nonce".to_string(), nonce.clone());
                m.insert("maxPriorityFeePerGas".to_string(), gasPrice.clone());
                m.insert("maxFeePerGas".to_string(), gasPrice.clone());
                m.insert("gasLimit".to_string(), gasLimit.clone());
                m.insert("to".to_string(), to.clone());
                m.insert("value".to_string(), value.clone());
                m.insert("data".to_string(), data.clone());
            m
        });
        let mut signed: Value = self.sign_evm_transaction(tx.clone(), self.privateKey.clone());
        return self.eth_rpc(rpcUrl.clone(), Value::Str("eth_sendRawTransaction".to_string()), Value::List(vec![signed.clone()])).await;

    Value::Null
} }

    fn wait_for_transaction_receipt(&mut self, mut rpcUrl: Value, mut txHash: Value, optional_args: &[Value]) -> impl ::std::future::Future<Output = Value> + Send { async move {
        let mut timeout = get_arg(optional_args, 0, Value::Int(60000));
        let mut start: Value = self.milliseconds();
        while is_less_than(&(subtract(&self.milliseconds(), &start)), &timeout) {
            let mut receipt: Value = self.eth_rpc(rpcUrl.clone(), Value::Str("eth_getTransactionReceipt".to_string()), Value::List(vec![txHash.clone()])).await;
            if is_true(&(!is_equal(&receipt, &Value::Null))) && is_true(&(!is_equal(&receipt, &Value::Null))) {
                return receipt;
            }
            self.sleep(Value::Int(2000)).await;
        }
        panic!("{}", crate::exchange_errors::exchange_error(add(&add(&add(&self.id, &Value::Str(" transaction ".to_string())), &txHash), &Value::Str(" not mined within timeout".to_string()))));

    Value::Null
} }
    /// Prediction-base fall-through for a prediction Core's `call_dynamic`.
    fn call_dynamic_prediction_base<'a>(&'a mut self, method: &'a str, args: Vec<crate::Value>)
        -> std::pin::Pin<Box<dyn std::future::Future<Output = crate::Value> + Send + 'a>>
    {
        Box::pin(async move {
            match method {
            "amount_to_prediction_precision" => <Self as crate::prediction_exchange_generated::PredictionBase>::amount_to_prediction_precision(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
            "apply_event_fetch_params" => <Self as crate::prediction_exchange_generated::PredictionBase>::apply_event_fetch_params(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "cancel_order" => <Self as crate::prediction_exchange_generated::PredictionBase>::cancel_order(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "cancel_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::cancel_orders(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "cost_to_prediction_precision" => <Self as crate::prediction_exchange_generated::PredictionBase>::cost_to_prediction_precision(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
            "create_market_buy_order_with_cost" => <Self as crate::prediction_exchange_generated::PredictionBase>::create_market_buy_order_with_cost(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
            "create_market_sell_order_with_cost" => <Self as crate::prediction_exchange_generated::PredictionBase>::create_market_sell_order_with_cost(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
            "create_order" => <Self as crate::prediction_exchange_generated::PredictionBase>::create_order(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), &args.get(4..).unwrap_or(&[]).to_vec()[..]).await,
            "create_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::create_orders(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "eth_rpc" => <Self as crate::prediction_exchange_generated::PredictionBase>::eth_rpc(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)).await,
            "events_list" => <Self as crate::prediction_exchange_generated::PredictionBase>::events_list(self),
            "fetch_closed_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_closed_orders(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_event" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_event(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_events" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_events(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_my_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_my_trades(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_ohlcv" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_ohlcv(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_open_interest" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_open_interest(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_open_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_open_orders(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_order_book" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_order_book(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_order_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_order_trades(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_orders(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_outcome" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_outcome(self, args.get(0).cloned().unwrap_or(crate::Value::Null)).await,
            "fetch_outcomes" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_outcomes(self, args.get(0).cloned().unwrap_or(crate::Value::Null)).await,
            "fetch_position" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_position(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_positions" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_positions(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_settlements" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_settlements(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_ticker" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_ticker(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_tickers" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_tickers(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_trades(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "fetch_trading_fee" => <Self as crate::prediction_exchange_generated::PredictionBase>::fetch_trading_fee(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "filter_by_outcome_since_limit" => <Self as crate::prediction_exchange_generated::PredictionBase>::filter_by_outcome_since_limit(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "filter_by_outcomes_since_limit" => <Self as crate::prediction_exchange_generated::PredictionBase>::filter_by_outcomes_since_limit(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "filter_events_by_search_in" => <Self as crate::prediction_exchange_generated::PredictionBase>::filter_events_by_search_in(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]),
            "filter_events_by_status" => <Self as crate::prediction_exchange_generated::PredictionBase>::filter_events_by_status(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "filter_events_by_tags" => <Self as crate::prediction_exchange_generated::PredictionBase>::filter_events_by_tags(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "get_event" => <Self as crate::prediction_exchange_generated::PredictionBase>::get_event(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "has_outcome" => <Self as crate::prediction_exchange_generated::PredictionBase>::has_outcome(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "hex_to_rlp_bytes" => <Self as crate::prediction_exchange_generated::PredictionBase>::hex_to_rlp_bytes(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "int_to_rlp_hex" => <Self as crate::prediction_exchange_generated::PredictionBase>::int_to_rlp_hex(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "is_prediction" => <Self as crate::prediction_exchange_generated::PredictionBase>::is_prediction(self),
            "load_events" => <Self as crate::prediction_exchange_generated::PredictionBase>::load_events(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "load_events_helper" => <Self as crate::prediction_exchange_generated::PredictionBase>::load_events_helper(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "load_outcome" => <Self as crate::prediction_exchange_generated::PredictionBase>::load_outcome(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "normalize_tag_key" => <Self as crate::prediction_exchange_generated::PredictionBase>::normalize_tag_key(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "outcome" => <Self as crate::prediction_exchange_generated::PredictionBase>::outcome(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "outcome_search_query" => <Self as crate::prediction_exchange_generated::PredictionBase>::outcome_search_query(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "pad_hex_address" => <Self as crate::prediction_exchange_generated::PredictionBase>::pad_hex_address(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "pad_hex_to_even" => <Self as crate::prediction_exchange_generated::PredictionBase>::pad_hex_to_even(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "parse_prediction_open_interest" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_open_interest(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_order" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_order(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_orders(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_position" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_position(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_positions" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_positions(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_ticker" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_ticker(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_trade" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_trade(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_prediction_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_prediction_trades(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "parse_search_queries" => <Self as crate::prediction_exchange_generated::PredictionBase>::parse_search_queries(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]),
            "price_to_prediction_precision" => <Self as crate::prediction_exchange_generated::PredictionBase>::price_to_prediction_precision(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
            "require_event_query" => <Self as crate::prediction_exchange_generated::PredictionBase>::require_event_query(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]),
            "rlp_encode_bytes" => <Self as crate::prediction_exchange_generated::PredictionBase>::rlp_encode_bytes(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "rlp_encode_list" => <Self as crate::prediction_exchange_generated::PredictionBase>::rlp_encode_list(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "safe_outcome" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_outcome(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "safe_outcome_symbol" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_outcome_symbol(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "safe_prediction_order" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_prediction_order(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "safe_prediction_order_book" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_prediction_order_book(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "safe_prediction_position" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_prediction_position(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "safe_prediction_ticker" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_prediction_ticker(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "safe_prediction_trade" => <Self as crate::prediction_exchange_generated::PredictionBase>::safe_prediction_trade(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "send_evm_transaction" => <Self as crate::prediction_exchange_generated::PredictionBase>::send_evm_transaction(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null), args.get(3).cloned().unwrap_or(crate::Value::Null), args.get(4).cloned().unwrap_or(crate::Value::Null), args.get(5).cloned().unwrap_or(crate::Value::Null), args.get(6).cloned().unwrap_or(crate::Value::Null)).await,
            "set_events" => <Self as crate::prediction_exchange_generated::PredictionBase>::set_events(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "set_markets" => <Self as crate::prediction_exchange_generated::PredictionBase>::set_markets(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]),
            "shorten_slug" => <Self as crate::prediction_exchange_generated::PredictionBase>::shorten_slug(self, args.get(0).cloned().unwrap_or(crate::Value::Null)),
            "sign_evm_transaction" => <Self as crate::prediction_exchange_generated::PredictionBase>::sign_evm_transaction(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
            "slug_to_market_symbol" => <Self as crate::prediction_exchange_generated::PredictionBase>::slug_to_market_symbol(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null)),
            "slug_to_outcome_symbol" => <Self as crate::prediction_exchange_generated::PredictionBase>::slug_to_outcome_symbol(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), args.get(2).cloned().unwrap_or(crate::Value::Null)),
            "wait_for_transaction_receipt" => <Self as crate::prediction_exchange_generated::PredictionBase>::wait_for_transaction_receipt(self, args.get(0).cloned().unwrap_or(crate::Value::Null), args.get(1).cloned().unwrap_or(crate::Value::Null), &args.get(2..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_my_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_my_trades(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_order_book" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_order_book(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_orders" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_orders(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_positions" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_positions(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_ticker" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_ticker(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_tickers" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_tickers(self, &args.get(0..).unwrap_or(&[]).to_vec()[..]).await,
            "watch_trades" => <Self as crate::prediction_exchange_generated::PredictionBase>::watch_trades(self, args.get(0).cloned().unwrap_or(crate::Value::Null), &args.get(1..).unwrap_or(&[]).to_vec()[..]).await,
                _ => self.call_dynamic_base(method, args).await,
            }
        })
    }
}