File size: 46,017 Bytes
e2b8c08
 
 
 
7180829
e2b8c08
 
 
 
 
 
 
 
 
 
 
 
7180829
e2b8c08
 
 
 
 
 
7180829
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e2b8c08
 
ed33e36
e2b8c08
 
 
 
 
 
 
ed33e36
e2b8c08
 
 
ed33e36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e2b8c08
ed33e36
e2b8c08
 
 
 
 
 
 
ed33e36
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e2b8c08
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "import matplotlib.pyplot as plt\n",
    "import seaborn as sns\n",
    "import json\n",
    "sns.set_style(\"darkgrid\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "tools = pd.read_parquet('../data/tools.parquet')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2024-12-10 07:50:55+0000', tz='UTC')"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(tools.request_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Timestamp('2024-10-13 00:00:30+0000', tz='UTC')"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(tools.request_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 358454 entries, 0 to 358453\n",
      "Data columns (total 23 columns):\n",
      " #   Column                   Non-Null Count   Dtype  \n",
      "---  ------                   --------------   -----  \n",
      " 0   request_id               358454 non-null  object \n",
      " 1   request_block            358454 non-null  object \n",
      " 2   prompt_request           358454 non-null  object \n",
      " 3   tool                     358454 non-null  object \n",
      " 4   nonce                    358454 non-null  object \n",
      " 5   trader_address           358454 non-null  object \n",
      " 6   deliver_block            358454 non-null  object \n",
      " 7   error                    358454 non-null  int64  \n",
      " 8   error_message            3772 non-null    object \n",
      " 9   prompt_response          357509 non-null  object \n",
      " 10  mech_address             357601 non-null  object \n",
      " 11  p_yes                    354682 non-null  float64\n",
      " 12  p_no                     354682 non-null  float64\n",
      " 13  confidence               354682 non-null  float64\n",
      " 14  info_utility             354682 non-null  float64\n",
      " 15  vote                     261707 non-null  object \n",
      " 16  win_probability          354682 non-null  float64\n",
      " 17  market_creator           358454 non-null  object \n",
      " 18  title                    358454 non-null  object \n",
      " 19  currentAnswer            287126 non-null  object \n",
      " 20  request_time             358454 non-null  object \n",
      " 21  request_month_year       358454 non-null  object \n",
      " 22  request_month_year_week  358454 non-null  object \n",
      "dtypes: float64(5), int64(1), object(17)\n",
      "memory usage: 62.9+ MB\n"
     ]
    }
   ],
   "source": [
    "tools.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['request_id', 'request_block', 'prompt_request', 'tool', 'nonce',\n",
       "       'trader_address', 'deliver_block', 'error', 'error_message',\n",
       "       'prompt_response', 'mech_address', 'p_yes', 'p_no', 'confidence',\n",
       "       'info_utility', 'vote', 'win_probability', 'market_creator', 'title',\n",
       "       'currentAnswer', 'request_time', 'request_month_year',\n",
       "       'request_month_year_week'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools.columns"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tools.iloc[0].request_time)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "dict"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pickle\n",
    "t_map = pickle.load(open(\"../data/t_map.pkl\", \"rb\"))\n",
    "type(t_map)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "475329"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(t_map)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "29624577\n"
     ]
    }
   ],
   "source": [
    "for item in t_map:\n",
    "    print(item)\n",
    "    break"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2023-07-12 11:58:40'"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "min(t_map.values())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2023-08-24 16:04:50'"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "t_map[29624577]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'2024-09-04 07:32:15'"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "max(t_map.values())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "request_id         1155886186807766696223563218518399229072982679...\n",
       "request_block                                               35356121\n",
       "prompt_request     Please take over the role of a Data Scientist ...\n",
       "tool                                   prediction-request-rag-claude\n",
       "nonce                           2c4c8c5c-afcf-4e28-a09a-aa2bae3f5444\n",
       "trader_address            0x22335c348afa4eae4cc6d2158c1ac259aaaecdfe\n",
       "deliver_block                                               35356134\n",
       "error                                                              0\n",
       "error_message                                                   None\n",
       "prompt_response    \\nYou will be evaluating the likelihood of an ...\n",
       "mech_address              0x5e1d1eb61e1164d5a50b28c575da73a29595dff7\n",
       "p_yes                                                            0.6\n",
       "p_no                                                             0.4\n",
       "confidence                                                       0.7\n",
       "info_utility                                                     0.7\n",
       "vote                                                             Yes\n",
       "win_probability                                                  0.6\n",
       "title              Will there be an increase in the wasp populati...\n",
       "currentAnswer                                                    Yes\n",
       "Name: 0, dtype: object"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools.iloc[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "vote\n",
       "Yes    55881\n",
       "No     51741\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools.vote.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 132150 entries, 0 to 132149\n",
      "Data columns (total 22 columns):\n",
      " #   Column                   Non-Null Count   Dtype  \n",
      "---  ------                   --------------   -----  \n",
      " 0   request_id               132150 non-null  object \n",
      " 1   request_block            132150 non-null  int64  \n",
      " 2   prompt_request           132150 non-null  object \n",
      " 3   tool                     132150 non-null  object \n",
      " 4   nonce                    132150 non-null  object \n",
      " 5   trader_address           132150 non-null  object \n",
      " 6   deliver_block            132150 non-null  int64  \n",
      " 7   error                    132149 non-null  float64\n",
      " 8   error_message            9702 non-null    object \n",
      " 9   prompt_response          132060 non-null  object \n",
      " 10  mech_address             132150 non-null  object \n",
      " 11  p_yes                    122447 non-null  float64\n",
      " 12  p_no                     122447 non-null  float64\n",
      " 13  confidence               122447 non-null  float64\n",
      " 14  info_utility             122447 non-null  float64\n",
      " 15  vote                     102396 non-null  object \n",
      " 16  win_probability          122447 non-null  float64\n",
      " 17  title                    124256 non-null  object \n",
      " 18  currentAnswer            85763 non-null   object \n",
      " 19  request_time             132150 non-null  object \n",
      " 20  request_month_year       132150 non-null  object \n",
      " 21  request_month_year_week  132150 non-null  object \n",
      "dtypes: float64(6), int64(2), object(14)\n",
      "memory usage: 22.2+ MB\n"
     ]
    }
   ],
   "source": [
    "tools.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "fpmms = pd.read_parquet('../data/fpmms.parquet')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>currentAnswer</th>\n",
       "      <th>id</th>\n",
       "      <th>title</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>No</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>No</td>\n",
       "      <td>0x0020d13c89140b47e10db54cbd53852b90bc1391</td>\n",
       "      <td>Will the Francis Scott Key Bridge in Baltimore...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>No</td>\n",
       "      <td>0x003ae5e007cc38b3f86b0ed7c82f938a1285ac07</td>\n",
       "      <td>Will FC Saarbrucken reach the final of the Ger...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Yes</td>\n",
       "      <td>0x004c8d4c619dc6b9caa940f5ea7ef699ae85359c</td>\n",
       "      <td>Will the pro-life activists convicted for 'con...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Yes</td>\n",
       "      <td>0x005e3f7a90585acbec807425a750fbba1d0c2b5c</td>\n",
       "      <td>Will Apple announce the release of a new M4 ch...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  currentAnswer                                          id  \\\n",
       "0            No  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5   \n",
       "1            No  0x0020d13c89140b47e10db54cbd53852b90bc1391   \n",
       "2            No  0x003ae5e007cc38b3f86b0ed7c82f938a1285ac07   \n",
       "3           Yes  0x004c8d4c619dc6b9caa940f5ea7ef699ae85359c   \n",
       "4           Yes  0x005e3f7a90585acbec807425a750fbba1d0c2b5c   \n",
       "\n",
       "                                               title  \n",
       "0  Will the first floating offshore wind research...  \n",
       "1  Will the Francis Scott Key Bridge in Baltimore...  \n",
       "2  Will FC Saarbrucken reach the final of the Ger...  \n",
       "3  Will the pro-life activists convicted for 'con...  \n",
       "4  Will Apple announce the release of a new M4 ch...  "
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "fpmms.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4251"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(fpmms)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 18035 entries, 0 to 18034\n",
      "Data columns (total 20 columns):\n",
      " #   Column                  Non-Null Count  Dtype              \n",
      "---  ------                  --------------  -----              \n",
      " 0   trader_address          18035 non-null  object             \n",
      " 1   market_creator          18035 non-null  object             \n",
      " 2   trade_id                18035 non-null  object             \n",
      " 3   creation_timestamp      18035 non-null  datetime64[ns, UTC]\n",
      " 4   title                   18035 non-null  object             \n",
      " 5   market_status           18035 non-null  object             \n",
      " 6   collateral_amount       18035 non-null  float64            \n",
      " 7   outcome_index           18035 non-null  object             \n",
      " 8   trade_fee_amount        18035 non-null  float64            \n",
      " 9   outcomes_tokens_traded  18035 non-null  float64            \n",
      " 10  current_answer          18035 non-null  int64              \n",
      " 11  is_invalid              18035 non-null  bool               \n",
      " 12  winning_trade           18035 non-null  bool               \n",
      " 13  earnings                18035 non-null  float64            \n",
      " 14  redeemed                18035 non-null  bool               \n",
      " 15  redeemed_amount         18035 non-null  float64            \n",
      " 16  num_mech_calls          18035 non-null  int64              \n",
      " 17  mech_fee_amount         18035 non-null  float64            \n",
      " 18  net_earnings            18035 non-null  float64            \n",
      " 19  roi                     18035 non-null  float64            \n",
      "dtypes: bool(3), datetime64[ns, UTC](1), float64(8), int64(2), object(6)\n",
      "memory usage: 2.4+ MB\n"
     ]
    }
   ],
   "source": [
    "prof = pd.read_parquet('../data/all_trades_profitability.parquet')\n",
    "prof.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "market_creator\n",
       "quickstart    16775\n",
       "pearl          1260\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "prof.market_creator.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "trades = pd.read_parquet(\"../data/fpmmTrades.parquet\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>request_id</th>\n",
       "      <th>request_block</th>\n",
       "      <th>prompt_request</th>\n",
       "      <th>tool</th>\n",
       "      <th>nonce</th>\n",
       "      <th>trader_address</th>\n",
       "      <th>deliver_block</th>\n",
       "      <th>error</th>\n",
       "      <th>error_message</th>\n",
       "      <th>prompt_response</th>\n",
       "      <th>mech_address</th>\n",
       "      <th>p_yes</th>\n",
       "      <th>p_no</th>\n",
       "      <th>confidence</th>\n",
       "      <th>info_utility</th>\n",
       "      <th>vote</th>\n",
       "      <th>win_probability</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [request_id, request_block, prompt_request, tool, nonce, trader_address, deliver_block, error, error_message, prompt_response, mech_address, p_yes, p_no, confidence, info_utility, vote, win_probability]\n",
       "Index: []"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>collateralAmount</th>\n",
       "      <th>collateralAmountUSD</th>\n",
       "      <th>collateralToken</th>\n",
       "      <th>creationTimestamp</th>\n",
       "      <th>trader_address</th>\n",
       "      <th>feeAmount</th>\n",
       "      <th>id</th>\n",
       "      <th>oldOutcomeTokenMarginalPrice</th>\n",
       "      <th>outcomeIndex</th>\n",
       "      <th>outcomeTokenMarginalPrice</th>\n",
       "      <th>...</th>\n",
       "      <th>market_creator</th>\n",
       "      <th>fpmm.answerFinalizedTimestamp</th>\n",
       "      <th>fpmm.arbitrationOccurred</th>\n",
       "      <th>fpmm.currentAnswer</th>\n",
       "      <th>fpmm.id</th>\n",
       "      <th>fpmm.isPendingArbitration</th>\n",
       "      <th>fpmm.openingTimestamp</th>\n",
       "      <th>fpmm.outcomes</th>\n",
       "      <th>fpmm.title</th>\n",
       "      <th>fpmm.condition.id</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>450426474650738688</td>\n",
       "      <td>0.4504269694034145716308073094168006</td>\n",
       "      <td>0xe91d153e0b41518a2ce8dd3d7944fa863463a97d</td>\n",
       "      <td>1724553455</td>\n",
       "      <td>0x022b36c50b85b8ae7addfb8a35d76c59d5814834</td>\n",
       "      <td>9008529493014773</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x02...</td>\n",
       "      <td>0.592785210609610270634125335572129</td>\n",
       "      <td>1</td>\n",
       "      <td>0.6171295391012242250994586583534301</td>\n",
       "      <td>...</td>\n",
       "      <td>quickstart</td>\n",
       "      <td>1725071760</td>\n",
       "      <td>False</td>\n",
       "      <td>0x00000000000000000000000000000000000000000000...</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>False</td>\n",
       "      <td>1724976000</td>\n",
       "      <td>[Yes, No]</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "      <td>0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>610163214546941400</td>\n",
       "      <td>0.6101636232215150135654007337015298</td>\n",
       "      <td>0xe91d153e0b41518a2ce8dd3d7944fa863463a97d</td>\n",
       "      <td>1724811940</td>\n",
       "      <td>0x034c4ad84f7ac6638bf19300d5bbe7d9b981e736</td>\n",
       "      <td>12203264290938828</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x03...</td>\n",
       "      <td>0.842992636523755061934822129394812</td>\n",
       "      <td>1</td>\n",
       "      <td>0.8523396372892128845826889719620915</td>\n",
       "      <td>...</td>\n",
       "      <td>quickstart</td>\n",
       "      <td>1725071760</td>\n",
       "      <td>False</td>\n",
       "      <td>0x00000000000000000000000000000000000000000000...</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>False</td>\n",
       "      <td>1724976000</td>\n",
       "      <td>[Yes, No]</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "      <td>0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>789065092332460672</td>\n",
       "      <td>0.7890644120527324071908793822796086</td>\n",
       "      <td>0xe91d153e0b41518a2ce8dd3d7944fa863463a97d</td>\n",
       "      <td>1724815755</td>\n",
       "      <td>0x09e9d42a029e8b0c2df3871709a762117a681d92</td>\n",
       "      <td>15781301846649213</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x09...</td>\n",
       "      <td>0.7983775743712442891104598770339028</td>\n",
       "      <td>1</td>\n",
       "      <td>0.8152123711444691659642000374025623</td>\n",
       "      <td>...</td>\n",
       "      <td>quickstart</td>\n",
       "      <td>1725071760</td>\n",
       "      <td>False</td>\n",
       "      <td>0x00000000000000000000000000000000000000000000...</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>False</td>\n",
       "      <td>1724976000</td>\n",
       "      <td>[Yes, No]</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "      <td>0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>1000000000000000000</td>\n",
       "      <td>1.000000605383660329048491794939126</td>\n",
       "      <td>0xe91d153e0b41518a2ce8dd3d7944fa863463a97d</td>\n",
       "      <td>1724546620</td>\n",
       "      <td>0x09e9d42a029e8b0c2df3871709a762117a681d92</td>\n",
       "      <td>20000000000000000</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x09...</td>\n",
       "      <td>0.5110745907733438805447072252622708</td>\n",
       "      <td>1</td>\n",
       "      <td>0.5746805204222762335911904727318937</td>\n",
       "      <td>...</td>\n",
       "      <td>quickstart</td>\n",
       "      <td>1725071760</td>\n",
       "      <td>False</td>\n",
       "      <td>0x00000000000000000000000000000000000000000000...</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>False</td>\n",
       "      <td>1724976000</td>\n",
       "      <td>[Yes, No]</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "      <td>0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>100000000000000000</td>\n",
       "      <td>0.1000004271262862419547394646567906</td>\n",
       "      <td>0xe91d153e0b41518a2ce8dd3d7944fa863463a97d</td>\n",
       "      <td>1724771260</td>\n",
       "      <td>0x0d049dcaece0ecb6fc81a460da7bcc2a4785d6e5</td>\n",
       "      <td>2000000000000000</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x0d...</td>\n",
       "      <td>0.2713968218662319388988681987389408</td>\n",
       "      <td>0</td>\n",
       "      <td>0.2804586217805511523845593360379658</td>\n",
       "      <td>...</td>\n",
       "      <td>quickstart</td>\n",
       "      <td>1725071760</td>\n",
       "      <td>False</td>\n",
       "      <td>0x00000000000000000000000000000000000000000000...</td>\n",
       "      <td>0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5</td>\n",
       "      <td>False</td>\n",
       "      <td>1724976000</td>\n",
       "      <td>[Yes, No]</td>\n",
       "      <td>Will the first floating offshore wind research...</td>\n",
       "      <td>0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      collateralAmount                   collateralAmountUSD  \\\n",
       "0   450426474650738688  0.4504269694034145716308073094168006   \n",
       "1   610163214546941400  0.6101636232215150135654007337015298   \n",
       "2   789065092332460672  0.7890644120527324071908793822796086   \n",
       "3  1000000000000000000   1.000000605383660329048491794939126   \n",
       "4   100000000000000000  0.1000004271262862419547394646567906   \n",
       "\n",
       "                              collateralToken creationTimestamp  \\\n",
       "0  0xe91d153e0b41518a2ce8dd3d7944fa863463a97d        1724553455   \n",
       "1  0xe91d153e0b41518a2ce8dd3d7944fa863463a97d        1724811940   \n",
       "2  0xe91d153e0b41518a2ce8dd3d7944fa863463a97d        1724815755   \n",
       "3  0xe91d153e0b41518a2ce8dd3d7944fa863463a97d        1724546620   \n",
       "4  0xe91d153e0b41518a2ce8dd3d7944fa863463a97d        1724771260   \n",
       "\n",
       "                               trader_address          feeAmount  \\\n",
       "0  0x022b36c50b85b8ae7addfb8a35d76c59d5814834   9008529493014773   \n",
       "1  0x034c4ad84f7ac6638bf19300d5bbe7d9b981e736  12203264290938828   \n",
       "2  0x09e9d42a029e8b0c2df3871709a762117a681d92  15781301846649213   \n",
       "3  0x09e9d42a029e8b0c2df3871709a762117a681d92  20000000000000000   \n",
       "4  0x0d049dcaece0ecb6fc81a460da7bcc2a4785d6e5   2000000000000000   \n",
       "\n",
       "                                                  id  \\\n",
       "0  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x02...   \n",
       "1  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x03...   \n",
       "2  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x09...   \n",
       "3  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x09...   \n",
       "4  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f50x0d...   \n",
       "\n",
       "           oldOutcomeTokenMarginalPrice outcomeIndex  \\\n",
       "0   0.592785210609610270634125335572129            1   \n",
       "1   0.842992636523755061934822129394812            1   \n",
       "2  0.7983775743712442891104598770339028            1   \n",
       "3  0.5110745907733438805447072252622708            1   \n",
       "4  0.2713968218662319388988681987389408            0   \n",
       "\n",
       "              outcomeTokenMarginalPrice  ... market_creator  \\\n",
       "0  0.6171295391012242250994586583534301  ...     quickstart   \n",
       "1  0.8523396372892128845826889719620915  ...     quickstart   \n",
       "2  0.8152123711444691659642000374025623  ...     quickstart   \n",
       "3  0.5746805204222762335911904727318937  ...     quickstart   \n",
       "4  0.2804586217805511523845593360379658  ...     quickstart   \n",
       "\n",
       "  fpmm.answerFinalizedTimestamp fpmm.arbitrationOccurred  \\\n",
       "0                    1725071760                    False   \n",
       "1                    1725071760                    False   \n",
       "2                    1725071760                    False   \n",
       "3                    1725071760                    False   \n",
       "4                    1725071760                    False   \n",
       "\n",
       "                                  fpmm.currentAnswer  \\\n",
       "0  0x00000000000000000000000000000000000000000000...   \n",
       "1  0x00000000000000000000000000000000000000000000...   \n",
       "2  0x00000000000000000000000000000000000000000000...   \n",
       "3  0x00000000000000000000000000000000000000000000...   \n",
       "4  0x00000000000000000000000000000000000000000000...   \n",
       "\n",
       "                                      fpmm.id fpmm.isPendingArbitration  \\\n",
       "0  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5                     False   \n",
       "1  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5                     False   \n",
       "2  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5                     False   \n",
       "3  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5                     False   \n",
       "4  0x0017cd58d6a7ee1451388c7d5b1051b4c0a041f5                     False   \n",
       "\n",
       "   fpmm.openingTimestamp fpmm.outcomes  \\\n",
       "0             1724976000     [Yes, No]   \n",
       "1             1724976000     [Yes, No]   \n",
       "2             1724976000     [Yes, No]   \n",
       "3             1724976000     [Yes, No]   \n",
       "4             1724976000     [Yes, No]   \n",
       "\n",
       "                                          fpmm.title  \\\n",
       "0  Will the first floating offshore wind research...   \n",
       "1  Will the first floating offshore wind research...   \n",
       "2  Will the first floating offshore wind research...   \n",
       "3  Will the first floating offshore wind research...   \n",
       "4  Will the first floating offshore wind research...   \n",
       "\n",
       "                                   fpmm.condition.id  \n",
       "0  0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...  \n",
       "1  0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...  \n",
       "2  0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...  \n",
       "3  0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...  \n",
       "4  0x0e940f12f30e928e4879c52d065d9da739a3d3f020d1...  \n",
       "\n",
       "[5 rows x 24 columns]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trades.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 23455 entries, 0 to 23454\n",
      "Data columns (total 24 columns):\n",
      " #   Column                         Non-Null Count  Dtype \n",
      "---  ------                         --------------  ----- \n",
      " 0   collateralAmount               23455 non-null  object\n",
      " 1   collateralAmountUSD            23455 non-null  object\n",
      " 2   collateralToken                23455 non-null  object\n",
      " 3   creationTimestamp              23455 non-null  object\n",
      " 4   trader_address                 23455 non-null  object\n",
      " 5   feeAmount                      23455 non-null  object\n",
      " 6   id                             23455 non-null  object\n",
      " 7   oldOutcomeTokenMarginalPrice   23455 non-null  object\n",
      " 8   outcomeIndex                   23455 non-null  object\n",
      " 9   outcomeTokenMarginalPrice      23455 non-null  object\n",
      " 10  outcomeTokensTraded            23455 non-null  object\n",
      " 11  title                          23455 non-null  object\n",
      " 12  transactionHash                23455 non-null  object\n",
      " 13  type                           23455 non-null  object\n",
      " 14  market_creator                 23455 non-null  object\n",
      " 15  fpmm.answerFinalizedTimestamp  21489 non-null  object\n",
      " 16  fpmm.arbitrationOccurred       23455 non-null  bool  \n",
      " 17  fpmm.currentAnswer             21489 non-null  object\n",
      " 18  fpmm.id                        23455 non-null  object\n",
      " 19  fpmm.isPendingArbitration      23455 non-null  bool  \n",
      " 20  fpmm.openingTimestamp          23455 non-null  object\n",
      " 21  fpmm.outcomes                  23455 non-null  object\n",
      " 22  fpmm.title                     23455 non-null  object\n",
      " 23  fpmm.condition.id              23455 non-null  object\n",
      "dtypes: bool(2), object(22)\n",
      "memory usage: 4.0+ MB\n"
     ]
    }
   ],
   "source": [
    "trades.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "market_creator\n",
       "quickstart    21852\n",
       "pearl          1603\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "trades.market_creator.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [],
   "source": [
    "fpmms_trades = pd.read_parquet('../data/fpmmTrades.parquet')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Adding market creator info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ERROR getting the market creator of 0xae7b042059b179dcac3169657fac111d7925f8dd\n",
      "ERROR getting the market creator of 0x347e4ef0ff34cf39d1c7e08bc07c68c41a4836d6\n",
      "ERROR getting the market creator of 0x8e03d3a7a3dfd930f73577ba4204deadf12b33f3\n",
      "ERROR getting the market creator of 0x2a0b461417fa0ae8bbeb28ed265fbe3944772435\n",
      "ERROR getting the market creator of 0x8069ea45a18910fa493a6a736438971b0e59ec9b\n",
      "ERROR getting the market creator of 0xdf91eac2a8573646c7e8e95c740877fe3d38f11f\n",
      "ERROR getting the market creator of 0x87f0fcfe810502555f8d1439793155cbfa2eb583\n",
      "ERROR getting the market creator of 0x7bcf0f480e52da1597d7437d5b4a4644b1e7ec23\n",
      "ERROR getting the market creator of 0xcfef6a50bd9439d1e1a15fcfe99068a57e533d95\n",
      "ERROR getting the market creator of 0xaeb8c31302361d42ec806faf406ef0c30b6eba5f\n",
      "ERROR getting the market creator of 0x9db7e7a0c82a229a7f3bb15046ff0c3a778b7291\n",
      "ERROR getting the market creator of 0x85c31bbeaab5468d97900e69d87a459aba997fa5\n",
      "ERROR getting the market creator of 0x36660fec571bb4d5849a433f9ec64622416f1dbb\n",
      "ERROR getting the market creator of 0x5ebe6dcb1ac4470bb71c89cf1e6b9abc48b637ba\n",
      "ERROR getting the market creator of 0xa0acfecc55465870c9baa7c954a0e81165fb112c\n",
      "ERROR getting the market creator of 0xd6d6951a8fa033f91a2227d75fb1eebc139e2e57\n",
      "ERROR getting the market creator of 0x651d04044b780e68f3f952796fb7c06fb0928ad2\n",
      "ERROR getting the market creator of 0xe271378e094db9d64e34c6c14a7492bcccd11dfb\n",
      "ERROR getting the market creator of 0x37c241945001f6c26c886c8d551cc2e6cf34c214\n",
      "ERROR getting the market creator of 0x20b9e32b17360310c633e5676f28430bd723f4bd\n",
      "ERROR getting the market creator of 0x06d873e7465a6680f5487905d7b5daf7f2c6e299\n",
      "ERROR getting the market creator of 0xd28b5e2f2ce950705354cd2ceaf4eab9d23db52b\n",
      "ERROR getting the market creator of 0x4d70e1ac779094e9790c8b74954d15729371e6bc\n",
      "ERROR getting the market creator of 0x81489c0eab196fb88704f08ef34b8a9ed7137c91\n",
      "ERROR getting the market creator of 0x223c99787f25179d51a9934a426b6d1b252bb4bd\n",
      "ERROR getting the market creator of 0xd61b2c4f70645c830bd5af76426d6b22af63c152\n",
      "ERROR getting the market creator of 0xe66e931f7b065361f56e41d61f599adab3b167c2\n",
      "ERROR getting the market creator of 0x5ccf21332df9af6195a5b1ba78d15562db915a35\n",
      "ERROR getting the market creator of 0xf8e68d9f66d2534df36c23db6770467da1c1ff1b\n",
      "ERROR getting the market creator of 0x2b9274ddf2213d8a6b2930a5b82801165df55017\n",
      "ERROR getting the market creator of 0xf9349c5ea0b5559abd8dfa6cdd4e4d5d913e1e61\n",
      "ERROR getting the market creator of 0xad8aa6f927bb6a38af8121418f1b64d4ed8be99c\n",
      "ERROR getting the market creator of 0x3dcc00904249d796a89943de15c85ac11afc5d66\n",
      "ERROR getting the market creator of 0x10ece1553b5017414388fe78f64720814d7f8799\n",
      "ERROR getting the market creator of 0x0930bcc328a695419d596dae380dec7fb43cd715\n",
      "ERROR getting the market creator of 0x956d8bbc930372482a361dec7e4707b15d8b02f4\n",
      "ERROR getting the market creator of 0x14da1cc12b382142ac3e2422162f122a0a31ec45\n",
      "ERROR getting the market creator of 0x28dd86a2c82ce02970eff7f4ea9ebde97750adc8\n",
      "ERROR getting the market creator of 0xb997d5e2fddf39b8a197715c7b200df612d74360\n",
      "ERROR getting the market creator of 0x2064ceecb78a382f4988d41f881abef89b6e785c\n",
      "ERROR getting the market creator of 0xe715cc8f264ab48f75bb1b5c11d7dbaf949d73c5\n",
      "ERROR getting the market creator of 0x5fc7213135962250147030c5dd30b84a80f2ad1e\n",
      "ERROR getting the market creator of 0x10ccffdc8e801ab4fda98371723cda4e30e6d672\n",
      "ERROR getting the market creator of 0x6e5d93fdcc14db02a58ace636c2dcff8db36039d\n",
      "ERROR getting the market creator of 0xf792f6a308525b72b5d47f12798668c140f5968e\n",
      "ERROR getting the market creator of 0x00897abcbbefe4f558956b7a9d1b7819677e4d90\n",
      "ERROR getting the market creator of 0x29448445959cc5045c03b7f316fa3332cc2b37b7\n",
      "ERROR getting the market creator of 0xdb8c2038cd17645216125f323048dcd4c9845826\n",
      "ERROR getting the market creator of 0x32969cce1791f13dc5d500b9e701ffb931baae03\n",
      "ERROR getting the market creator of 0x84aeb93d348c6da1ea4b0016c207aefc26edaa44\n",
      "ERROR getting the market creator of 0xdda87f7ec43aab7080e9ac23ae1550e5bc89d6cc\n",
      "ERROR getting the market creator of 0xafd80421ce35298d3698ca0f4008477a169c9ea2\n",
      "ERROR getting the market creator of 0xffc47cb1ecd41daae58e39fd4193d6fe9a6f5d2e\n",
      "ERROR getting the market creator of 0x351d430d229740f986ee240612c932c66188dd09\n",
      "ERROR getting the market creator of 0xd72455c8d5398a2b3b822bbc7cc0de638ea35519\n",
      "ERROR getting the market creator of 0x2c83cf4bb92e55e35b6e4af6eca6c0a85fb73650\n",
      "ERROR getting the market creator of 0xf2baf410b7d42d7572fb2f39cf216ffae8d4cafe\n",
      "ERROR getting the market creator of 0xb42a955a0e06b3e6bdf229c9abfd2fdad20688a7\n",
      "ERROR getting the market creator of 0x35021fcc0d15c4e87fc1c7fb527f389829dde3d9\n",
      "ERROR getting the market creator of 0xaa19120a9976c75dc569ab2cfcc087cd224db4e2\n",
      "ERROR getting the market creator of 0x6e79766698f58a25d2548b76601de9535c5080d3\n",
      "ERROR getting the market creator of 0x6915dcb7601802ea4a2dd840c44b6ed4473b5ce2\n",
      "ERROR getting the market creator of 0x6957f7ac4a0a09f237a901749e518a678d1a614a\n",
      "ERROR getting the market creator of 0x785a9d3329955ffd7cd24ca7a89ce2da21ac62da\n",
      "ERROR getting the market creator of 0x1e738f7e82102e2f56fef62df473d3f1f1dc53b1\n",
      "ERROR getting the market creator of 0x8e23b89649f22a6e8084b34a1a5de28d9ddf5a88\n",
      "ERROR getting the market creator of 0x31c6b19cae793ba90ee9c70263af773c27df2774\n",
      "ERROR getting the market creator of 0x3a2d7bf095988f30daf308b5484cd74903d82c22\n",
      "ERROR getting the market creator of 0xde10d01d4315cf64d9feeb79e9a593d78da8a50b\n",
      "ERROR getting the market creator of 0xa57b7f04bb813b5a6ded7cc92c5bd56586d8f7d4\n",
      "ERROR getting the market creator of 0x97609769fddc72ea9f45f62cef1f7a9658dd1efe\n",
      "ERROR getting the market creator of 0x7ddbfbebbec1635315f9217cbf9de8afd272c8de\n",
      "ERROR getting the market creator of 0x37cdc93194dc7f46f3cc377cf4350f56455a4f85\n",
      "ERROR getting the market creator of 0x75c10935141d740b71e1763aa6a3139643754655\n",
      "ERROR getting the market creator of 0x0f98789650877b1928960490a5a19769ac1c84b3\n",
      "ERROR getting the market creator of 0x9f87c202db8b3270406a3084817909a9d4afc6ea\n",
      "ERROR getting the market creator of 0x8cfb5af2b0287b34a423755d0481478f0a8f1356\n",
      "ERROR getting the market creator of 0x09244905029648aca18830291bb62634b04d9a46\n",
      "ERROR getting the market creator of 0x4e9a5580ce24dd06ed8d6b1d75a7ccce7abf7361\n",
      "ERROR getting the market creator of 0x8bbeb8a3e1f6fdc9e95aa0d7e80ebc6dc1468b7a\n",
      "ERROR getting the market creator of 0xcb279a4ebb3f0d78cb15817e942cc7aea01b8545\n",
      "ERROR getting the market creator of 0xb36fa15e34dd50b8199c57305573dc48d1271b50\n",
      "ERROR getting the market creator of 0x2198981fc1d8b3c61e7df9a50cf240708c057dfa\n",
      "ERROR getting the market creator of 0x37bab68f9ae4f9c7ce915d9e1f3404e7cd1794cc\n",
      "ERROR getting the market creator of 0x97f59586921ebdcfc07694ba8376f59871db11f9\n",
      "ERROR getting the market creator of 0xc79bf3f6370e8a8002a3093c379752f395a3c291\n",
      "ERROR getting the market creator of 0x178021f40d4e1ed270f2d2125f9f80d3e78a1836\n",
      "ERROR getting the market creator of 0xcca6ccde20a551caec29d6c1318f4f2ec7e6063c\n"
     ]
    }
   ],
   "source": [
    "tools[\"market_creator\"] = \"\"\n",
    "# traverse the list of traders\n",
    "traders_list = list(tools.trader_address.unique())\n",
    "for trader_address in traders_list:\n",
    "    market_creator = \"\"\n",
    "    try:\n",
    "        trades = fpmms_trades[fpmms_trades[\"trader_address\"] == trader_address]\n",
    "        market_creator = trades.iloc[0][\"market_creator\"]  # first value is enough\n",
    "    except Exception:\n",
    "        print(f\"ERROR getting the market creator of {trader_address}\")\n",
    "    tools_of_the_trader = tools[tools[\"trader_address\"] == trader_address]\n",
    "    # update\n",
    "    tools.loc[tools[\"trader_address\"] == trader_address, \"market_creator\"] = market_creator"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "market_creator\n",
       "quickstart    121106\n",
       "pearl          12729\n",
       "                5182\n",
       "Name: count, dtype: int64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "tools.market_creator.value_counts()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "139017"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(tools)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.03727601660228605"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "5182/139017"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [],
   "source": [
    "tools = tools.loc[tools[\"market_creator\"] != \"\"]\n",
    "tools.to_parquet(\"../data/tools.parquet\", index=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "hf_dashboards",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}