Spaces:
Sleeping
Sleeping
cyberosa
commited on
Commit
·
7968201
1
Parent(s):
6c470e7
upgrading python version and new metric filter
Browse files- README.md +1 -0
- live_data/analysis_of_markets_data.ipynb +286 -282
- live_data/markets_live_data.parquet +2 -2
- requirements.txt +0 -1
- scripts/live_markets_data.py +19 -17
- scripts/live_traders_data.py +21 -23
- scripts/queries.py +4 -3
README.md
CHANGED
|
@@ -4,6 +4,7 @@ emoji: 💹
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
|
|
|
| 7 |
sdk_version: 4.39.0
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
|
|
|
| 4 |
colorFrom: gray
|
| 5 |
colorTo: red
|
| 6 |
sdk: gradio
|
| 7 |
+
python_version: 3.12.2
|
| 8 |
sdk_version: 4.39.0
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
live_data/analysis_of_markets_data.ipynb
CHANGED
|
@@ -14,7 +14,7 @@
|
|
| 14 |
},
|
| 15 |
{
|
| 16 |
"cell_type": "code",
|
| 17 |
-
"execution_count":
|
| 18 |
"metadata": {},
|
| 19 |
"outputs": [
|
| 20 |
{
|
|
@@ -59,98 +59,98 @@
|
|
| 59 |
" <tbody>\n",
|
| 60 |
" <tr>\n",
|
| 61 |
" <th>0</th>\n",
|
| 62 |
-
" <td>
|
| 63 |
-
" <td>
|
| 64 |
-
" <td>
|
| 65 |
-
" <td>
|
| 66 |
-
" <td>
|
| 67 |
-
" <td>[
|
| 68 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 69 |
-
" <td>Will
|
| 70 |
-
" <td>
|
| 71 |
" <td>True</td>\n",
|
| 72 |
-
" <td>
|
| 73 |
-
" <td>
|
| 74 |
-
" <td>
|
| 75 |
-
" <td>
|
| 76 |
-
" <td>
|
| 77 |
-
" <td>
|
| 78 |
" </tr>\n",
|
| 79 |
" <tr>\n",
|
| 80 |
" <th>1</th>\n",
|
| 81 |
-
" <td>
|
| 82 |
-
" <td>
|
| 83 |
-
" <td>
|
| 84 |
-
" <td>
|
| 85 |
-
" <td>
|
| 86 |
-
" <td>[
|
| 87 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 88 |
-
" <td>Will
|
| 89 |
-
" <td>
|
| 90 |
" <td>True</td>\n",
|
| 91 |
-
" <td>
|
| 92 |
-
" <td>
|
| 93 |
-
" <td>
|
| 94 |
-
" <td>
|
| 95 |
-
" <td>
|
| 96 |
-
" <td>
|
| 97 |
" </tr>\n",
|
| 98 |
" <tr>\n",
|
| 99 |
" <th>2</th>\n",
|
| 100 |
-
" <td>
|
| 101 |
-
" <td>
|
| 102 |
-
" <td>
|
| 103 |
-
" <td>
|
| 104 |
" <td>1722556800</td>\n",
|
| 105 |
-
" <td>[
|
| 106 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 107 |
-
" <td>Will
|
| 108 |
-
" <td>
|
| 109 |
" <td>True</td>\n",
|
| 110 |
-
" <td>
|
| 111 |
-
" <td>
|
| 112 |
-
" <td>
|
| 113 |
-
" <td>
|
| 114 |
-
" <td>
|
| 115 |
-
" <td>
|
| 116 |
" </tr>\n",
|
| 117 |
" <tr>\n",
|
| 118 |
" <th>3</th>\n",
|
| 119 |
-
" <td>
|
| 120 |
-
" <td>
|
| 121 |
-
" <td>
|
| 122 |
-
" <td>
|
| 123 |
-
" <td>
|
| 124 |
-
" <td>[
|
| 125 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 126 |
-
" <td>Will
|
| 127 |
-
" <td>
|
| 128 |
" <td>True</td>\n",
|
| 129 |
-
" <td>
|
| 130 |
-
" <td>
|
| 131 |
-
" <td>
|
| 132 |
-
" <td>
|
| 133 |
-
" <td>
|
| 134 |
-
" <td>
|
| 135 |
" </tr>\n",
|
| 136 |
" <tr>\n",
|
| 137 |
" <th>4</th>\n",
|
| 138 |
-
" <td>
|
| 139 |
-
" <td>
|
| 140 |
-
" <td>
|
| 141 |
-
" <td>
|
| 142 |
-
" <td>
|
| 143 |
-
" <td>[
|
| 144 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 145 |
-
" <td>Will
|
| 146 |
-
" <td>
|
| 147 |
" <td>True</td>\n",
|
| 148 |
-
" <td>
|
| 149 |
-
" <td>
|
| 150 |
-
" <td>
|
| 151 |
-
" <td>
|
| 152 |
-
" <td>
|
| 153 |
-
" <td>
|
| 154 |
" </tr>\n",
|
| 155 |
" </tbody>\n",
|
| 156 |
"</table>\n",
|
|
@@ -158,25 +158,25 @@
|
|
| 158 |
],
|
| 159 |
"text/plain": [
|
| 160 |
" creationTimestamp id \\\n",
|
| 161 |
-
"0
|
| 162 |
-
"1
|
| 163 |
-
"2
|
| 164 |
-
"3
|
| 165 |
-
"4
|
| 166 |
"\n",
|
| 167 |
" liquidityMeasure liquidityParameter openingTimestamp \\\n",
|
| 168 |
-
"0
|
| 169 |
-
"1
|
| 170 |
-
"2
|
| 171 |
-
"3
|
| 172 |
-
"4
|
| 173 |
"\n",
|
| 174 |
" outcomeTokenAmounts \\\n",
|
| 175 |
-
"0
|
| 176 |
-
"1
|
| 177 |
-
"2 [
|
| 178 |
-
"3 [
|
| 179 |
-
"4
|
| 180 |
"\n",
|
| 181 |
" question \\\n",
|
| 182 |
"0 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
|
@@ -186,28 +186,28 @@
|
|
| 186 |
"4 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 187 |
"\n",
|
| 188 |
" title tokens_timestamp open \\\n",
|
| 189 |
-
"0 Will
|
| 190 |
-
"1 Will
|
| 191 |
-
"2 Will
|
| 192 |
-
"3 Will
|
| 193 |
-
"4 Will
|
| 194 |
"\n",
|
| 195 |
" total_trades dist_gap_perc votes_first_outcome_perc \\\n",
|
| 196 |
-
"0
|
| 197 |
-
"1
|
| 198 |
-
"2
|
| 199 |
-
"3
|
| 200 |
-
"4
|
| 201 |
"\n",
|
| 202 |
" votes_second_outcome_perc first_token_perc second_token_perc \n",
|
| 203 |
-
"0
|
| 204 |
-
"1
|
| 205 |
-
"2
|
| 206 |
-
"3
|
| 207 |
-
"4
|
| 208 |
]
|
| 209 |
},
|
| 210 |
-
"execution_count":
|
| 211 |
"metadata": {},
|
| 212 |
"output_type": "execute_result"
|
| 213 |
}
|
|
@@ -219,18 +219,38 @@
|
|
| 219 |
},
|
| 220 |
{
|
| 221 |
"cell_type": "code",
|
| 222 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 223 |
"metadata": {},
|
| 224 |
"outputs": [
|
| 225 |
{
|
| 226 |
"data": {
|
| 227 |
"text/plain": [
|
| 228 |
"tokens_timestamp\n",
|
| 229 |
-
"
|
| 230 |
"Name: count, dtype: int64"
|
| 231 |
]
|
| 232 |
},
|
| 233 |
-
"execution_count":
|
| 234 |
"metadata": {},
|
| 235 |
"output_type": "execute_result"
|
| 236 |
}
|
|
@@ -241,24 +261,23 @@
|
|
| 241 |
},
|
| 242 |
{
|
| 243 |
"cell_type": "code",
|
| 244 |
-
"execution_count":
|
| 245 |
"metadata": {},
|
| 246 |
"outputs": [
|
| 247 |
{
|
| 248 |
"data": {
|
| 249 |
"text/plain": [
|
| 250 |
"openingTimestamp\n",
|
| 251 |
-
"1722384000 10\n",
|
| 252 |
-
"1722470400 10\n",
|
| 253 |
"1722556800 10\n",
|
| 254 |
"1722729600 10\n",
|
|
|
|
| 255 |
"1722643200 10\n",
|
| 256 |
"1767225600 1\n",
|
| 257 |
"1730502000 1\n",
|
| 258 |
"Name: count, dtype: int64"
|
| 259 |
]
|
| 260 |
},
|
| 261 |
-
"execution_count":
|
| 262 |
"metadata": {},
|
| 263 |
"output_type": "execute_result"
|
| 264 |
}
|
|
@@ -269,7 +288,7 @@
|
|
| 269 |
},
|
| 270 |
{
|
| 271 |
"cell_type": "code",
|
| 272 |
-
"execution_count":
|
| 273 |
"metadata": {},
|
| 274 |
"outputs": [
|
| 275 |
{
|
|
@@ -313,45 +332,45 @@
|
|
| 313 |
" </thead>\n",
|
| 314 |
" <tbody>\n",
|
| 315 |
" <tr>\n",
|
| 316 |
-
" <th>
|
| 317 |
-
" <td>
|
| 318 |
-
" <td>
|
| 319 |
-
" <td>
|
| 320 |
-
" <td>
|
| 321 |
-
" <td>
|
| 322 |
-
" <td>[
|
| 323 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 324 |
-
" <td>Will
|
| 325 |
-
" <td>
|
| 326 |
" <td>True</td>\n",
|
| 327 |
-
" <td>
|
| 328 |
-
" <td>
|
| 329 |
-
" <td>0.
|
| 330 |
-
" <td>
|
| 331 |
-
" <td>
|
| 332 |
-
" <td>
|
| 333 |
" </tr>\n",
|
| 334 |
" <tr>\n",
|
| 335 |
-
" <th>
|
| 336 |
" <td>1722221950</td>\n",
|
| 337 |
" <td>0xe67bb5f7355c5383db4ca3d04496dbc5258fe4f0</td>\n",
|
| 338 |
-
" <td>
|
| 339 |
-
" <td>
|
| 340 |
" <td>1722643200</td>\n",
|
| 341 |
-
" <td>[
|
| 342 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 343 |
" <td>Will HP release a new AI software or hardware ...</td>\n",
|
| 344 |
-
" <td>
|
| 345 |
" <td>True</td>\n",
|
| 346 |
-
" <td>
|
| 347 |
-
" <td>
|
| 348 |
-
" <td>
|
| 349 |
-
" <td>
|
| 350 |
-
" <td>
|
| 351 |
-
" <td>
|
| 352 |
" </tr>\n",
|
| 353 |
" <tr>\n",
|
| 354 |
-
" <th>
|
| 355 |
" <td>1690321980</td>\n",
|
| 356 |
" <td>0xe7ed8a5f2f0f17f7d584ae8ddd0592d1ac67791f</td>\n",
|
| 357 |
" <td>228054710678899</td>\n",
|
|
@@ -360,52 +379,52 @@
|
|
| 360 |
" <td>[114042185304014, 876868500313803307]</td>\n",
|
| 361 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 362 |
" <td>Will Twitter implement a new misinformation po...</td>\n",
|
| 363 |
-
" <td>
|
| 364 |
" <td>True</td>\n",
|
| 365 |
-
" <td>
|
| 366 |
-
" <td>
|
| 367 |
-
" <td>
|
| 368 |
-
" <td>
|
| 369 |
" <td>0.01</td>\n",
|
| 370 |
" <td>99.99</td>\n",
|
| 371 |
" </tr>\n",
|
| 372 |
" <tr>\n",
|
| 373 |
-
" <th>
|
| 374 |
-
" <td>
|
| 375 |
-
" <td>
|
| 376 |
-
" <td>
|
| 377 |
-
" <td>
|
| 378 |
-
" <td>
|
| 379 |
-
" <td>[
|
| 380 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 381 |
-
" <td>Will
|
| 382 |
-
" <td>
|
| 383 |
" <td>True</td>\n",
|
| 384 |
-
" <td>
|
| 385 |
-
" <td>
|
| 386 |
-
" <td>
|
| 387 |
-
" <td>
|
| 388 |
-
" <td>
|
| 389 |
-
" <td>
|
| 390 |
" </tr>\n",
|
| 391 |
" <tr>\n",
|
| 392 |
-
" <th>
|
| 393 |
-
" <td>
|
| 394 |
-
" <td>
|
| 395 |
-
" <td>
|
| 396 |
-
" <td>
|
| 397 |
-
" <td>
|
| 398 |
-
" <td>[
|
| 399 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 400 |
-
" <td>Will
|
| 401 |
-
" <td>
|
| 402 |
" <td>True</td>\n",
|
| 403 |
-
" <td>
|
| 404 |
-
" <td>
|
| 405 |
-
" <td>
|
| 406 |
-
" <td>
|
| 407 |
-
" <td>
|
| 408 |
-
" <td>
|
| 409 |
" </tr>\n",
|
| 410 |
" </tbody>\n",
|
| 411 |
"</table>\n",
|
|
@@ -413,56 +432,56 @@
|
|
| 413 |
],
|
| 414 |
"text/plain": [
|
| 415 |
" creationTimestamp id \\\n",
|
| 416 |
-
"
|
| 417 |
-
"
|
| 418 |
-
"
|
| 419 |
-
"
|
| 420 |
-
"
|
| 421 |
"\n",
|
| 422 |
" liquidityMeasure liquidityParameter openingTimestamp \\\n",
|
| 423 |
-
"
|
| 424 |
-
"
|
| 425 |
-
"
|
| 426 |
-
"
|
| 427 |
-
"
|
| 428 |
"\n",
|
| 429 |
" outcomeTokenAmounts \\\n",
|
| 430 |
-
"
|
| 431 |
-
"
|
| 432 |
-
"
|
| 433 |
-
"
|
| 434 |
-
"
|
| 435 |
"\n",
|
| 436 |
" question \\\n",
|
| 437 |
-
"
|
| 438 |
-
"
|
| 439 |
-
"
|
| 440 |
-
"
|
| 441 |
-
"
|
| 442 |
"\n",
|
| 443 |
" title tokens_timestamp open \\\n",
|
| 444 |
-
"
|
| 445 |
-
"
|
| 446 |
-
"
|
| 447 |
-
"
|
| 448 |
-
"
|
| 449 |
"\n",
|
| 450 |
" total_trades dist_gap_perc votes_first_outcome_perc \\\n",
|
| 451 |
-
"
|
| 452 |
-
"
|
| 453 |
-
"
|
| 454 |
-
"
|
| 455 |
-
"
|
| 456 |
"\n",
|
| 457 |
" votes_second_outcome_perc first_token_perc second_token_perc \n",
|
| 458 |
-
"
|
| 459 |
-
"
|
| 460 |
-
"
|
| 461 |
-
"
|
| 462 |
-
"
|
| 463 |
]
|
| 464 |
},
|
| 465 |
-
"execution_count":
|
| 466 |
"metadata": {},
|
| 467 |
"output_type": "execute_result"
|
| 468 |
}
|
|
@@ -471,14 +490,9 @@
|
|
| 471 |
"live_fpmms.tail()"
|
| 472 |
]
|
| 473 |
},
|
| 474 |
-
{
|
| 475 |
-
"cell_type": "markdown",
|
| 476 |
-
"metadata": {},
|
| 477 |
-
"source": []
|
| 478 |
-
},
|
| 479 |
{
|
| 480 |
"cell_type": "code",
|
| 481 |
-
"execution_count":
|
| 482 |
"metadata": {},
|
| 483 |
"outputs": [
|
| 484 |
{
|
|
@@ -486,28 +500,28 @@
|
|
| 486 |
"output_type": "stream",
|
| 487 |
"text": [
|
| 488 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 489 |
-
"RangeIndex:
|
| 490 |
"Data columns (total 16 columns):\n",
|
| 491 |
" # Column Non-Null Count Dtype \n",
|
| 492 |
"--- ------ -------------- ----- \n",
|
| 493 |
-
" 0 creationTimestamp
|
| 494 |
-
" 1 id
|
| 495 |
-
" 2 liquidityMeasure
|
| 496 |
-
" 3 liquidityParameter
|
| 497 |
-
" 4 openingTimestamp
|
| 498 |
-
" 5 outcomeTokenAmounts
|
| 499 |
-
" 6 question
|
| 500 |
-
" 7 title
|
| 501 |
-
" 8 tokens_timestamp
|
| 502 |
-
" 9 open
|
| 503 |
-
" 10 total_trades
|
| 504 |
-
" 11 dist_gap_perc
|
| 505 |
-
" 12 votes_first_outcome_perc
|
| 506 |
-
" 13 votes_second_outcome_perc
|
| 507 |
-
" 14 first_token_perc
|
| 508 |
-
" 15 second_token_perc
|
| 509 |
"dtypes: bool(1), float64(5), int64(2), object(8)\n",
|
| 510 |
-
"memory usage:
|
| 511 |
]
|
| 512 |
}
|
| 513 |
],
|
|
@@ -517,24 +531,24 @@
|
|
| 517 |
},
|
| 518 |
{
|
| 519 |
"cell_type": "code",
|
| 520 |
-
"execution_count":
|
| 521 |
"metadata": {},
|
| 522 |
"outputs": [
|
| 523 |
{
|
| 524 |
"data": {
|
| 525 |
"text/plain": [
|
| 526 |
-
"count
|
| 527 |
-
"mean
|
| 528 |
-
"std
|
| 529 |
-
"min
|
| 530 |
-
"25%
|
| 531 |
-
"50%
|
| 532 |
-
"75%
|
| 533 |
-
"max
|
| 534 |
"Name: votes_first_outcome_perc, dtype: float64"
|
| 535 |
]
|
| 536 |
},
|
| 537 |
-
"execution_count":
|
| 538 |
"metadata": {},
|
| 539 |
"output_type": "execute_result"
|
| 540 |
}
|
|
@@ -545,24 +559,24 @@
|
|
| 545 |
},
|
| 546 |
{
|
| 547 |
"cell_type": "code",
|
| 548 |
-
"execution_count":
|
| 549 |
"metadata": {},
|
| 550 |
"outputs": [
|
| 551 |
{
|
| 552 |
"data": {
|
| 553 |
"text/plain": [
|
| 554 |
-
"count
|
| 555 |
-
"mean
|
| 556 |
-
"std
|
| 557 |
"min 0.000000\n",
|
| 558 |
-
"25%
|
| 559 |
-
"50%
|
| 560 |
-
"75%
|
| 561 |
"max 100.000000\n",
|
| 562 |
"Name: votes_second_outcome_perc, dtype: float64"
|
| 563 |
]
|
| 564 |
},
|
| 565 |
-
"execution_count":
|
| 566 |
"metadata": {},
|
| 567 |
"output_type": "execute_result"
|
| 568 |
}
|
|
@@ -573,65 +587,55 @@
|
|
| 573 |
},
|
| 574 |
{
|
| 575 |
"cell_type": "code",
|
| 576 |
-
"execution_count":
|
| 577 |
"metadata": {},
|
| 578 |
"outputs": [
|
| 579 |
{
|
| 580 |
"name": "stdout",
|
| 581 |
"output_type": "stream",
|
| 582 |
"text": [
|
| 583 |
-
" title = Will Conns HomePlus close more than 70 stores by 30 July 2024?\n",
|
| 584 |
-
" title = Will the missing plane in Alaska be found by 29 July 2024?\n",
|
| 585 |
-
" title = Will Apple Maps surpass Google Maps in terms of users by 31 July 2024?\n",
|
| 586 |
" title = Will the new AI-powered upgrade for the Philips Hue camera be released by 1 August 2024?\n",
|
| 587 |
" title = Will Harvey Weinstein recover from Covid-19 and double pneumonia by August 1, 2024?\n",
|
| 588 |
-
" title = Will Roku successfully introduce Instagram-style shoppable ads on its platform by 30 July 2024?\n",
|
| 589 |
-
" title = Will the Google Pixel 9 and Pixel 9 Pro be released by 29th July 2024?\n",
|
| 590 |
-
" title = Will Southwest Airlines start assigning seats and premium seating by 31st July 2024?\n",
|
| 591 |
" title = Will Tesla's net income increase in the third quarter of 2024?\n",
|
|
|
|
| 592 |
" title = Will the wildfire in California be under control on or by 1 August 2024?\n",
|
| 593 |
-
" title = Will the
|
| 594 |
-
" title = Will Aston Martin officially announce their return to Le Mans in 2025 on 29 July 2024?\n",
|
| 595 |
" title = Will the Disney Plus, Hulu, and Max streaming bundle surpass 5 million subscribers by 2nd August 2024?\n",
|
| 596 |
-
" title = Will the population of Florida exceed 23 million by 29 July 2024?\n",
|
| 597 |
" title = Will non-binary athletes win any medals at the Paris Olympics on 1 August 2024?\n",
|
| 598 |
-
" title = Will
|
| 599 |
-
" title = Will
|
| 600 |
-
" title = Will OpenAI's SearchGPT be launched fully on or before 31 July 2024?\n",
|
| 601 |
" title = Will the Kids Online Safety Act be passed by Congress by 1 August 2024?\n",
|
| 602 |
-
" title = Will the
|
| 603 |
-
" title = Will
|
| 604 |
" title = Will the Paris Olympics occur without any major security concerns on 2 August 2024?\n",
|
| 605 |
" title = Will Apple's launch of Maps on the web surpass Google Maps in user count by August 1, 2024?\n",
|
|
|
|
| 606 |
" title = Will Microsoft implement the proposed changes to Windows by 1 August 2024?\n",
|
| 607 |
-
" title = Will
|
| 608 |
" title = Will US GDP growth exceed 2.8% in the third quarter of 2024?\n",
|
| 609 |
-
" title = Will
|
| 610 |
-
" title = Will
|
| 611 |
-
" title = Will
|
|
|
|
| 612 |
" title = Will Russia increase its naval visits to Cuba by 2 August 2024?\n",
|
| 613 |
-
" title = Will
|
| 614 |
" title = Will 'Hillbilly Elegy' by VP candidate JD Vance be in the top 10 bestsellers on 2 August 2024?\n",
|
| 615 |
" title = Will Microsoft introduce taskbar-related changes to Windows 11 by 2 August 2024?\n",
|
|
|
|
| 616 |
" title = Will the US operation succeed in capturing all Sinaloa cartel leaders by August 1, 2024?\n",
|
| 617 |
-
" title = Will the Boeing capsule return the two NASA astronauts from the International Space Station on or before 31 July 2024?\n",
|
| 618 |
-
" title = Will Kamala Harris win the 2024 presidential election on 29 July 2024?\n",
|
| 619 |
-
" title = Will there be another eruption at Yellowstone on 30 July 2024?\n",
|
| 620 |
-
" title = Will the Google Pixel 9 series be launched by 31st July 2024?\n",
|
| 621 |
" title = Will TSMC start 4-nanometer chip production in its Phoenix, Arizona factory by the end of 2025?\n",
|
| 622 |
" title = Will the Park Fire in California be fully contained on or by 2 August 2024?\n",
|
| 623 |
-
" title = Will
|
| 624 |
-
" title = Will
|
| 625 |
-
" title = Will
|
| 626 |
-
" title = Will
|
|
|
|
| 627 |
" title = Will Pep Guardiola announce his extension with Manchester City on 1 August 2024?\n",
|
| 628 |
-
" title = Will Kamala Harris beat Donald Trump in the 2024 Presidential Elections?\n",
|
| 629 |
" title = Will a solar-powered car break the Cannonball Run record by 2nd August 2024?\n",
|
| 630 |
-
" title = Will the George Floyd Justice in Policing Act be passed by 31st July 2024?\n",
|
| 631 |
" title = Will HP release a new AI software or hardware on or before August 2, 2024?\n",
|
| 632 |
" title = Will Twitter implement a new misinformation policy before the 2024 elections?\n",
|
| 633 |
-
" title = Will
|
| 634 |
-
" title = Will
|
| 635 |
]
|
| 636 |
}
|
| 637 |
],
|
|
@@ -752,7 +756,7 @@
|
|
| 752 |
},
|
| 753 |
{
|
| 754 |
"cell_type": "code",
|
| 755 |
-
"execution_count":
|
| 756 |
"metadata": {},
|
| 757 |
"outputs": [],
|
| 758 |
"source": [
|
|
|
|
| 14 |
},
|
| 15 |
{
|
| 16 |
"cell_type": "code",
|
| 17 |
+
"execution_count": 56,
|
| 18 |
"metadata": {},
|
| 19 |
"outputs": [
|
| 20 |
{
|
|
|
|
| 59 |
" <tbody>\n",
|
| 60 |
" <tr>\n",
|
| 61 |
" <th>0</th>\n",
|
| 62 |
+
" <td>1722127095</td>\n",
|
| 63 |
+
" <td>0x18386924426f7c8ab7f5db4ad586c12dac5cd5e3</td>\n",
|
| 64 |
+
" <td>5357434458586455820</td>\n",
|
| 65 |
+
" <td>7000000000000000008</td>\n",
|
| 66 |
+
" <td>1722556800</td>\n",
|
| 67 |
+
" <td>[3259539556698765978, 15032798083182885068]</td>\n",
|
| 68 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 69 |
+
" <td>Will the new AI-powered upgrade for the Philip...</td>\n",
|
| 70 |
+
" <td>1722423299</td>\n",
|
| 71 |
" <td>True</td>\n",
|
| 72 |
+
" <td>27</td>\n",
|
| 73 |
+
" <td>45.14</td>\n",
|
| 74 |
+
" <td>62.96</td>\n",
|
| 75 |
+
" <td>37.04</td>\n",
|
| 76 |
+
" <td>17.82</td>\n",
|
| 77 |
+
" <td>82.18</td>\n",
|
| 78 |
" </tr>\n",
|
| 79 |
" <tr>\n",
|
| 80 |
" <th>1</th>\n",
|
| 81 |
+
" <td>1722133525</td>\n",
|
| 82 |
+
" <td>0x1f0f1fd3fcb3b49eeeb6197abcb5c44c1907dfbd</td>\n",
|
| 83 |
+
" <td>6977882567566373948</td>\n",
|
| 84 |
+
" <td>7000000000000000010</td>\n",
|
| 85 |
+
" <td>1722556800</td>\n",
|
| 86 |
+
" <td>[6464408186664933119, 7579966887159038865]</td>\n",
|
| 87 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 88 |
+
" <td>Will Harvey Weinstein recover from Covid-19 an...</td>\n",
|
| 89 |
+
" <td>1722423299</td>\n",
|
| 90 |
" <td>True</td>\n",
|
| 91 |
+
" <td>37</td>\n",
|
| 92 |
+
" <td>16.13</td>\n",
|
| 93 |
+
" <td>62.16</td>\n",
|
| 94 |
+
" <td>37.84</td>\n",
|
| 95 |
+
" <td>46.03</td>\n",
|
| 96 |
+
" <td>53.97</td>\n",
|
| 97 |
" </tr>\n",
|
| 98 |
" <tr>\n",
|
| 99 |
" <th>2</th>\n",
|
| 100 |
+
" <td>1722132875</td>\n",
|
| 101 |
+
" <td>0x3725b8f54cc53b468cdc165ee10218344b607158</td>\n",
|
| 102 |
+
" <td>6909621707239077880</td>\n",
|
| 103 |
+
" <td>7000000000000000010</td>\n",
|
| 104 |
" <td>1722556800</td>\n",
|
| 105 |
+
" <td>[5955677720374361649, 8227443172818283549]</td>\n",
|
| 106 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 107 |
+
" <td>Will Tesla's net income increase in the third ...</td>\n",
|
| 108 |
+
" <td>1722423299</td>\n",
|
| 109 |
" <td>True</td>\n",
|
| 110 |
+
" <td>41</td>\n",
|
| 111 |
+
" <td>9.23</td>\n",
|
| 112 |
+
" <td>51.22</td>\n",
|
| 113 |
+
" <td>48.78</td>\n",
|
| 114 |
+
" <td>41.99</td>\n",
|
| 115 |
+
" <td>58.01</td>\n",
|
| 116 |
" </tr>\n",
|
| 117 |
" <tr>\n",
|
| 118 |
" <th>3</th>\n",
|
| 119 |
+
" <td>1722300340</td>\n",
|
| 120 |
+
" <td>0x38d2b80cbd152b93a8df640a21d80e4b9d75039a</td>\n",
|
| 121 |
+
" <td>6990748493371702452</td>\n",
|
| 122 |
+
" <td>7000000000000000007</td>\n",
|
| 123 |
+
" <td>1722729600</td>\n",
|
| 124 |
+
" <td>[6649016172429909848, 7369511327582280786]</td>\n",
|
| 125 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 126 |
+
" <td>Will SpaceX launch Falcon 9 rocket on 3 August...</td>\n",
|
| 127 |
+
" <td>1722423299</td>\n",
|
| 128 |
" <td>True</td>\n",
|
| 129 |
+
" <td>23</td>\n",
|
| 130 |
+
" <td>13.44</td>\n",
|
| 131 |
+
" <td>60.87</td>\n",
|
| 132 |
+
" <td>39.13</td>\n",
|
| 133 |
+
" <td>47.43</td>\n",
|
| 134 |
+
" <td>52.57</td>\n",
|
| 135 |
" </tr>\n",
|
| 136 |
" <tr>\n",
|
| 137 |
" <th>4</th>\n",
|
| 138 |
+
" <td>1722125375</td>\n",
|
| 139 |
+
" <td>0x39e657d48714c483b7ee2bc9314e6c7ad63d2d79</td>\n",
|
| 140 |
+
" <td>6984860773463178504</td>\n",
|
| 141 |
+
" <td>7000000000000000013</td>\n",
|
| 142 |
+
" <td>1722556800</td>\n",
|
| 143 |
+
" <td>[6554044347951723468, 7476299731678429895]</td>\n",
|
| 144 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 145 |
+
" <td>Will the wildfire in California be under contr...</td>\n",
|
| 146 |
+
" <td>1722423299</td>\n",
|
| 147 |
" <td>True</td>\n",
|
| 148 |
+
" <td>53</td>\n",
|
| 149 |
+
" <td>4.23</td>\n",
|
| 150 |
+
" <td>50.94</td>\n",
|
| 151 |
+
" <td>49.06</td>\n",
|
| 152 |
+
" <td>46.71</td>\n",
|
| 153 |
+
" <td>53.29</td>\n",
|
| 154 |
" </tr>\n",
|
| 155 |
" </tbody>\n",
|
| 156 |
"</table>\n",
|
|
|
|
| 158 |
],
|
| 159 |
"text/plain": [
|
| 160 |
" creationTimestamp id \\\n",
|
| 161 |
+
"0 1722127095 0x18386924426f7c8ab7f5db4ad586c12dac5cd5e3 \n",
|
| 162 |
+
"1 1722133525 0x1f0f1fd3fcb3b49eeeb6197abcb5c44c1907dfbd \n",
|
| 163 |
+
"2 1722132875 0x3725b8f54cc53b468cdc165ee10218344b607158 \n",
|
| 164 |
+
"3 1722300340 0x38d2b80cbd152b93a8df640a21d80e4b9d75039a \n",
|
| 165 |
+
"4 1722125375 0x39e657d48714c483b7ee2bc9314e6c7ad63d2d79 \n",
|
| 166 |
"\n",
|
| 167 |
" liquidityMeasure liquidityParameter openingTimestamp \\\n",
|
| 168 |
+
"0 5357434458586455820 7000000000000000008 1722556800 \n",
|
| 169 |
+
"1 6977882567566373948 7000000000000000010 1722556800 \n",
|
| 170 |
+
"2 6909621707239077880 7000000000000000010 1722556800 \n",
|
| 171 |
+
"3 6990748493371702452 7000000000000000007 1722729600 \n",
|
| 172 |
+
"4 6984860773463178504 7000000000000000013 1722556800 \n",
|
| 173 |
"\n",
|
| 174 |
" outcomeTokenAmounts \\\n",
|
| 175 |
+
"0 [3259539556698765978, 15032798083182885068] \n",
|
| 176 |
+
"1 [6464408186664933119, 7579966887159038865] \n",
|
| 177 |
+
"2 [5955677720374361649, 8227443172818283549] \n",
|
| 178 |
+
"3 [6649016172429909848, 7369511327582280786] \n",
|
| 179 |
+
"4 [6554044347951723468, 7476299731678429895] \n",
|
| 180 |
"\n",
|
| 181 |
" question \\\n",
|
| 182 |
"0 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
|
|
|
| 186 |
"4 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 187 |
"\n",
|
| 188 |
" title tokens_timestamp open \\\n",
|
| 189 |
+
"0 Will the new AI-powered upgrade for the Philip... 1722423299 True \n",
|
| 190 |
+
"1 Will Harvey Weinstein recover from Covid-19 an... 1722423299 True \n",
|
| 191 |
+
"2 Will Tesla's net income increase in the third ... 1722423299 True \n",
|
| 192 |
+
"3 Will SpaceX launch Falcon 9 rocket on 3 August... 1722423299 True \n",
|
| 193 |
+
"4 Will the wildfire in California be under contr... 1722423299 True \n",
|
| 194 |
"\n",
|
| 195 |
" total_trades dist_gap_perc votes_first_outcome_perc \\\n",
|
| 196 |
+
"0 27 45.14 62.96 \n",
|
| 197 |
+
"1 37 16.13 62.16 \n",
|
| 198 |
+
"2 41 9.23 51.22 \n",
|
| 199 |
+
"3 23 13.44 60.87 \n",
|
| 200 |
+
"4 53 4.23 50.94 \n",
|
| 201 |
"\n",
|
| 202 |
" votes_second_outcome_perc first_token_perc second_token_perc \n",
|
| 203 |
+
"0 37.04 17.82 82.18 \n",
|
| 204 |
+
"1 37.84 46.03 53.97 \n",
|
| 205 |
+
"2 48.78 41.99 58.01 \n",
|
| 206 |
+
"3 39.13 47.43 52.57 \n",
|
| 207 |
+
"4 49.06 46.71 53.29 "
|
| 208 |
]
|
| 209 |
},
|
| 210 |
+
"execution_count": 56,
|
| 211 |
"metadata": {},
|
| 212 |
"output_type": "execute_result"
|
| 213 |
}
|
|
|
|
| 219 |
},
|
| 220 |
{
|
| 221 |
"cell_type": "code",
|
| 222 |
+
"execution_count": 57,
|
| 223 |
+
"metadata": {},
|
| 224 |
+
"outputs": [
|
| 225 |
+
{
|
| 226 |
+
"data": {
|
| 227 |
+
"text/plain": [
|
| 228 |
+
"'0x18386924426f7c8ab7f5db4ad586c12dac5cd5e3'"
|
| 229 |
+
]
|
| 230 |
+
},
|
| 231 |
+
"execution_count": 57,
|
| 232 |
+
"metadata": {},
|
| 233 |
+
"output_type": "execute_result"
|
| 234 |
+
}
|
| 235 |
+
],
|
| 236 |
+
"source": [
|
| 237 |
+
"live_fpmms.iloc[0].id"
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"cell_type": "code",
|
| 242 |
+
"execution_count": 60,
|
| 243 |
"metadata": {},
|
| 244 |
"outputs": [
|
| 245 |
{
|
| 246 |
"data": {
|
| 247 |
"text/plain": [
|
| 248 |
"tokens_timestamp\n",
|
| 249 |
+
"1722423299 42\n",
|
| 250 |
"Name: count, dtype: int64"
|
| 251 |
]
|
| 252 |
},
|
| 253 |
+
"execution_count": 60,
|
| 254 |
"metadata": {},
|
| 255 |
"output_type": "execute_result"
|
| 256 |
}
|
|
|
|
| 261 |
},
|
| 262 |
{
|
| 263 |
"cell_type": "code",
|
| 264 |
+
"execution_count": 61,
|
| 265 |
"metadata": {},
|
| 266 |
"outputs": [
|
| 267 |
{
|
| 268 |
"data": {
|
| 269 |
"text/plain": [
|
| 270 |
"openingTimestamp\n",
|
|
|
|
|
|
|
| 271 |
"1722556800 10\n",
|
| 272 |
"1722729600 10\n",
|
| 273 |
+
"1722816000 10\n",
|
| 274 |
"1722643200 10\n",
|
| 275 |
"1767225600 1\n",
|
| 276 |
"1730502000 1\n",
|
| 277 |
"Name: count, dtype: int64"
|
| 278 |
]
|
| 279 |
},
|
| 280 |
+
"execution_count": 61,
|
| 281 |
"metadata": {},
|
| 282 |
"output_type": "execute_result"
|
| 283 |
}
|
|
|
|
| 288 |
},
|
| 289 |
{
|
| 290 |
"cell_type": "code",
|
| 291 |
+
"execution_count": 62,
|
| 292 |
"metadata": {},
|
| 293 |
"outputs": [
|
| 294 |
{
|
|
|
|
| 332 |
" </thead>\n",
|
| 333 |
" <tbody>\n",
|
| 334 |
" <tr>\n",
|
| 335 |
+
" <th>37</th>\n",
|
| 336 |
+
" <td>1722212580</td>\n",
|
| 337 |
+
" <td>0xdda18501129700e4fdc92432697f948276b890ed</td>\n",
|
| 338 |
+
" <td>5519746643162243029</td>\n",
|
| 339 |
+
" <td>7000000000000000004</td>\n",
|
| 340 |
+
" <td>1722643200</td>\n",
|
| 341 |
+
" <td>[14336616250453709233, 3417821830757958855]</td>\n",
|
| 342 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 343 |
+
" <td>Will a solar-powered car break the Cannonball ...</td>\n",
|
| 344 |
+
" <td>1722423299</td>\n",
|
| 345 |
" <td>True</td>\n",
|
| 346 |
+
" <td>10</td>\n",
|
| 347 |
+
" <td>80.75</td>\n",
|
| 348 |
+
" <td>0.00</td>\n",
|
| 349 |
+
" <td>100.00</td>\n",
|
| 350 |
+
" <td>80.75</td>\n",
|
| 351 |
+
" <td>19.25</td>\n",
|
| 352 |
" </tr>\n",
|
| 353 |
" <tr>\n",
|
| 354 |
+
" <th>38</th>\n",
|
| 355 |
" <td>1722221950</td>\n",
|
| 356 |
" <td>0xe67bb5f7355c5383db4ca3d04496dbc5258fe4f0</td>\n",
|
| 357 |
+
" <td>5311382085934218416</td>\n",
|
| 358 |
+
" <td>7000000000000000007</td>\n",
|
| 359 |
" <td>1722643200</td>\n",
|
| 360 |
+
" <td>[3216368448721577775, 15234573022713307875]</td>\n",
|
| 361 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 362 |
" <td>Will HP release a new AI software or hardware ...</td>\n",
|
| 363 |
+
" <td>1722423299</td>\n",
|
| 364 |
" <td>True</td>\n",
|
| 365 |
+
" <td>21</td>\n",
|
| 366 |
+
" <td>49.24</td>\n",
|
| 367 |
+
" <td>66.67</td>\n",
|
| 368 |
+
" <td>33.33</td>\n",
|
| 369 |
+
" <td>17.43</td>\n",
|
| 370 |
+
" <td>82.57</td>\n",
|
| 371 |
" </tr>\n",
|
| 372 |
" <tr>\n",
|
| 373 |
+
" <th>39</th>\n",
|
| 374 |
" <td>1690321980</td>\n",
|
| 375 |
" <td>0xe7ed8a5f2f0f17f7d584ae8ddd0592d1ac67791f</td>\n",
|
| 376 |
" <td>228054710678899</td>\n",
|
|
|
|
| 379 |
" <td>[114042185304014, 876868500313803307]</td>\n",
|
| 380 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 381 |
" <td>Will Twitter implement a new misinformation po...</td>\n",
|
| 382 |
+
" <td>1722423299</td>\n",
|
| 383 |
" <td>True</td>\n",
|
| 384 |
+
" <td>200</td>\n",
|
| 385 |
+
" <td>60.49</td>\n",
|
| 386 |
+
" <td>60.50</td>\n",
|
| 387 |
+
" <td>39.50</td>\n",
|
| 388 |
" <td>0.01</td>\n",
|
| 389 |
" <td>99.99</td>\n",
|
| 390 |
" </tr>\n",
|
| 391 |
" <tr>\n",
|
| 392 |
+
" <th>40</th>\n",
|
| 393 |
+
" <td>1722386975</td>\n",
|
| 394 |
+
" <td>0xe8cbe98177fd3c8c87bbfbb490089d8eeb0626f1</td>\n",
|
| 395 |
+
" <td>6887825265154595082</td>\n",
|
| 396 |
+
" <td>7000000000000000003</td>\n",
|
| 397 |
+
" <td>1722816000</td>\n",
|
| 398 |
+
" <td>[5845530536838973482, 8382472675696125685]</td>\n",
|
| 399 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 400 |
+
" <td>Will Robert Downey Jr appear in the announced ...</td>\n",
|
| 401 |
+
" <td>1722423299</td>\n",
|
| 402 |
" <td>True</td>\n",
|
| 403 |
+
" <td>11</td>\n",
|
| 404 |
+
" <td>4.37</td>\n",
|
| 405 |
+
" <td>45.45</td>\n",
|
| 406 |
+
" <td>54.55</td>\n",
|
| 407 |
+
" <td>41.08</td>\n",
|
| 408 |
+
" <td>58.92</td>\n",
|
| 409 |
" </tr>\n",
|
| 410 |
" <tr>\n",
|
| 411 |
+
" <th>41</th>\n",
|
| 412 |
+
" <td>1722223250</td>\n",
|
| 413 |
+
" <td>0xf2d66476f8c4b9e7a5401bf3e777ddb54f83b597</td>\n",
|
| 414 |
+
" <td>6292372117023262534</td>\n",
|
| 415 |
+
" <td>7000000000000000010</td>\n",
|
| 416 |
+
" <td>1722643200</td>\n",
|
| 417 |
+
" <td>[4375376549185758232, 11199036117044308589]</td>\n",
|
| 418 |
" <td>{'answers': [], 'currentAnswerTimestamp': None...</td>\n",
|
| 419 |
+
" <td>Will Intel release a patch to fix the instabil...</td>\n",
|
| 420 |
+
" <td>1722423299</td>\n",
|
| 421 |
" <td>True</td>\n",
|
| 422 |
+
" <td>33</td>\n",
|
| 423 |
+
" <td>41.61</td>\n",
|
| 424 |
+
" <td>69.70</td>\n",
|
| 425 |
+
" <td>30.30</td>\n",
|
| 426 |
+
" <td>28.09</td>\n",
|
| 427 |
+
" <td>71.91</td>\n",
|
| 428 |
" </tr>\n",
|
| 429 |
" </tbody>\n",
|
| 430 |
"</table>\n",
|
|
|
|
| 432 |
],
|
| 433 |
"text/plain": [
|
| 434 |
" creationTimestamp id \\\n",
|
| 435 |
+
"37 1722212580 0xdda18501129700e4fdc92432697f948276b890ed \n",
|
| 436 |
+
"38 1722221950 0xe67bb5f7355c5383db4ca3d04496dbc5258fe4f0 \n",
|
| 437 |
+
"39 1690321980 0xe7ed8a5f2f0f17f7d584ae8ddd0592d1ac67791f \n",
|
| 438 |
+
"40 1722386975 0xe8cbe98177fd3c8c87bbfbb490089d8eeb0626f1 \n",
|
| 439 |
+
"41 1722223250 0xf2d66476f8c4b9e7a5401bf3e777ddb54f83b597 \n",
|
| 440 |
"\n",
|
| 441 |
" liquidityMeasure liquidityParameter openingTimestamp \\\n",
|
| 442 |
+
"37 5519746643162243029 7000000000000000004 1722643200 \n",
|
| 443 |
+
"38 5311382085934218416 7000000000000000007 1722643200 \n",
|
| 444 |
+
"39 228054710678899 10000000000001981 1730502000 \n",
|
| 445 |
+
"40 6887825265154595082 7000000000000000003 1722816000 \n",
|
| 446 |
+
"41 6292372117023262534 7000000000000000010 1722643200 \n",
|
| 447 |
"\n",
|
| 448 |
" outcomeTokenAmounts \\\n",
|
| 449 |
+
"37 [14336616250453709233, 3417821830757958855] \n",
|
| 450 |
+
"38 [3216368448721577775, 15234573022713307875] \n",
|
| 451 |
+
"39 [114042185304014, 876868500313803307] \n",
|
| 452 |
+
"40 [5845530536838973482, 8382472675696125685] \n",
|
| 453 |
+
"41 [4375376549185758232, 11199036117044308589] \n",
|
| 454 |
"\n",
|
| 455 |
" question \\\n",
|
| 456 |
+
"37 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 457 |
+
"38 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 458 |
+
"39 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 459 |
+
"40 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 460 |
+
"41 {'answers': [], 'currentAnswerTimestamp': None... \n",
|
| 461 |
"\n",
|
| 462 |
" title tokens_timestamp open \\\n",
|
| 463 |
+
"37 Will a solar-powered car break the Cannonball ... 1722423299 True \n",
|
| 464 |
+
"38 Will HP release a new AI software or hardware ... 1722423299 True \n",
|
| 465 |
+
"39 Will Twitter implement a new misinformation po... 1722423299 True \n",
|
| 466 |
+
"40 Will Robert Downey Jr appear in the announced ... 1722423299 True \n",
|
| 467 |
+
"41 Will Intel release a patch to fix the instabil... 1722423299 True \n",
|
| 468 |
"\n",
|
| 469 |
" total_trades dist_gap_perc votes_first_outcome_perc \\\n",
|
| 470 |
+
"37 10 80.75 0.00 \n",
|
| 471 |
+
"38 21 49.24 66.67 \n",
|
| 472 |
+
"39 200 60.49 60.50 \n",
|
| 473 |
+
"40 11 4.37 45.45 \n",
|
| 474 |
+
"41 33 41.61 69.70 \n",
|
| 475 |
"\n",
|
| 476 |
" votes_second_outcome_perc first_token_perc second_token_perc \n",
|
| 477 |
+
"37 100.00 80.75 19.25 \n",
|
| 478 |
+
"38 33.33 17.43 82.57 \n",
|
| 479 |
+
"39 39.50 0.01 99.99 \n",
|
| 480 |
+
"40 54.55 41.08 58.92 \n",
|
| 481 |
+
"41 30.30 28.09 71.91 "
|
| 482 |
]
|
| 483 |
},
|
| 484 |
+
"execution_count": 62,
|
| 485 |
"metadata": {},
|
| 486 |
"output_type": "execute_result"
|
| 487 |
}
|
|
|
|
| 490 |
"live_fpmms.tail()"
|
| 491 |
]
|
| 492 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 493 |
{
|
| 494 |
"cell_type": "code",
|
| 495 |
+
"execution_count": 63,
|
| 496 |
"metadata": {},
|
| 497 |
"outputs": [
|
| 498 |
{
|
|
|
|
| 500 |
"output_type": "stream",
|
| 501 |
"text": [
|
| 502 |
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 503 |
+
"RangeIndex: 42 entries, 0 to 41\n",
|
| 504 |
"Data columns (total 16 columns):\n",
|
| 505 |
" # Column Non-Null Count Dtype \n",
|
| 506 |
"--- ------ -------------- ----- \n",
|
| 507 |
+
" 0 creationTimestamp 42 non-null object \n",
|
| 508 |
+
" 1 id 42 non-null object \n",
|
| 509 |
+
" 2 liquidityMeasure 42 non-null object \n",
|
| 510 |
+
" 3 liquidityParameter 42 non-null object \n",
|
| 511 |
+
" 4 openingTimestamp 42 non-null object \n",
|
| 512 |
+
" 5 outcomeTokenAmounts 42 non-null object \n",
|
| 513 |
+
" 6 question 42 non-null object \n",
|
| 514 |
+
" 7 title 42 non-null object \n",
|
| 515 |
+
" 8 tokens_timestamp 42 non-null int64 \n",
|
| 516 |
+
" 9 open 42 non-null bool \n",
|
| 517 |
+
" 10 total_trades 42 non-null int64 \n",
|
| 518 |
+
" 11 dist_gap_perc 42 non-null float64\n",
|
| 519 |
+
" 12 votes_first_outcome_perc 42 non-null float64\n",
|
| 520 |
+
" 13 votes_second_outcome_perc 42 non-null float64\n",
|
| 521 |
+
" 14 first_token_perc 42 non-null float64\n",
|
| 522 |
+
" 15 second_token_perc 42 non-null float64\n",
|
| 523 |
"dtypes: bool(1), float64(5), int64(2), object(8)\n",
|
| 524 |
+
"memory usage: 5.1+ KB\n"
|
| 525 |
]
|
| 526 |
}
|
| 527 |
],
|
|
|
|
| 531 |
},
|
| 532 |
{
|
| 533 |
"cell_type": "code",
|
| 534 |
+
"execution_count": 64,
|
| 535 |
"metadata": {},
|
| 536 |
"outputs": [
|
| 537 |
{
|
| 538 |
"data": {
|
| 539 |
"text/plain": [
|
| 540 |
+
"count 42.000000\n",
|
| 541 |
+
"mean 53.371190\n",
|
| 542 |
+
"std 26.533149\n",
|
| 543 |
+
"min 0.000000\n",
|
| 544 |
+
"25% 42.757500\n",
|
| 545 |
+
"50% 57.515000\n",
|
| 546 |
+
"75% 67.472500\n",
|
| 547 |
+
"max 100.000000\n",
|
| 548 |
"Name: votes_first_outcome_perc, dtype: float64"
|
| 549 |
]
|
| 550 |
},
|
| 551 |
+
"execution_count": 64,
|
| 552 |
"metadata": {},
|
| 553 |
"output_type": "execute_result"
|
| 554 |
}
|
|
|
|
| 559 |
},
|
| 560 |
{
|
| 561 |
"cell_type": "code",
|
| 562 |
+
"execution_count": 65,
|
| 563 |
"metadata": {},
|
| 564 |
"outputs": [
|
| 565 |
{
|
| 566 |
"data": {
|
| 567 |
"text/plain": [
|
| 568 |
+
"count 42.000000\n",
|
| 569 |
+
"mean 46.628810\n",
|
| 570 |
+
"std 26.533149\n",
|
| 571 |
"min 0.000000\n",
|
| 572 |
+
"25% 32.527500\n",
|
| 573 |
+
"50% 42.485000\n",
|
| 574 |
+
"75% 57.242500\n",
|
| 575 |
"max 100.000000\n",
|
| 576 |
"Name: votes_second_outcome_perc, dtype: float64"
|
| 577 |
]
|
| 578 |
},
|
| 579 |
+
"execution_count": 65,
|
| 580 |
"metadata": {},
|
| 581 |
"output_type": "execute_result"
|
| 582 |
}
|
|
|
|
| 587 |
},
|
| 588 |
{
|
| 589 |
"cell_type": "code",
|
| 590 |
+
"execution_count": 66,
|
| 591 |
"metadata": {},
|
| 592 |
"outputs": [
|
| 593 |
{
|
| 594 |
"name": "stdout",
|
| 595 |
"output_type": "stream",
|
| 596 |
"text": [
|
|
|
|
|
|
|
|
|
|
| 597 |
" title = Will the new AI-powered upgrade for the Philips Hue camera be released by 1 August 2024?\n",
|
| 598 |
" title = Will Harvey Weinstein recover from Covid-19 and double pneumonia by August 1, 2024?\n",
|
|
|
|
|
|
|
|
|
|
| 599 |
" title = Will Tesla's net income increase in the third quarter of 2024?\n",
|
| 600 |
+
" title = Will SpaceX launch Falcon 9 rocket on 3 August 2024?\n",
|
| 601 |
" title = Will the wildfire in California be under control on or by 1 August 2024?\n",
|
| 602 |
+
" title = Will the second season of 'The Rings of Power' be released on August 4, 2024?\n",
|
|
|
|
| 603 |
" title = Will the Disney Plus, Hulu, and Max streaming bundle surpass 5 million subscribers by 2nd August 2024?\n",
|
|
|
|
| 604 |
" title = Will non-binary athletes win any medals at the Paris Olympics on 1 August 2024?\n",
|
| 605 |
+
" title = Will Microsoft announce a major Windows update on 3 August 2024?\n",
|
| 606 |
+
" title = Will there be a hurricane in the central Atlantic on 3rd August 2024?\n",
|
|
|
|
| 607 |
" title = Will the Kids Online Safety Act be passed by Congress by 1 August 2024?\n",
|
| 608 |
+
" title = Will the water quality issues of the Seine River be resolved by 3 August 2024, allowing for the Olympic pre-race triathlon event?\n",
|
| 609 |
+
" title = Will New York City Mayor's emergency order suspending parts of new solitary confinement law be in effect on August 4, 2024?\n",
|
| 610 |
" title = Will the Paris Olympics occur without any major security concerns on 2 August 2024?\n",
|
| 611 |
" title = Will Apple's launch of Maps on the web surpass Google Maps in user count by August 1, 2024?\n",
|
| 612 |
+
" title = Will the hazardous materials on the highway connecting Los Angeles and Las Vegas be cleared by 4 August 2024?\n",
|
| 613 |
" title = Will Microsoft implement the proposed changes to Windows by 1 August 2024?\n",
|
| 614 |
+
" title = Will Samsung Galaxy S24 Ultra receive another camera upgrade with One UI 7 on or before 4 August 2024?\n",
|
| 615 |
" title = Will US GDP growth exceed 2.8% in the third quarter of 2024?\n",
|
| 616 |
+
" title = Will Yasmin Harper and Scarlett Mew Jensen win another medal in the Paris 2024 Olympics by 4 August 2024?\n",
|
| 617 |
+
" title = Will Pep Guardiola confirm his stay at Manchester City beyond the 2024-25 season on 3 August 2024?\n",
|
| 618 |
+
" title = Will OpenAI's AI-powered search engine, SearchGPT, have a full release by 4 August 2024?\n",
|
| 619 |
+
" title = Will Adam Peaty win a third consecutive 100m breaststroke Olympic gold medal at the 2024 Paris Olympics?\n",
|
| 620 |
" title = Will Russia increase its naval visits to Cuba by 2 August 2024?\n",
|
| 621 |
+
" title = Will there be a terrorist attack on French citizens during the Paris Olympics on 3 August 2024?\n",
|
| 622 |
" title = Will 'Hillbilly Elegy' by VP candidate JD Vance be in the top 10 bestsellers on 2 August 2024?\n",
|
| 623 |
" title = Will Microsoft introduce taskbar-related changes to Windows 11 by 2 August 2024?\n",
|
| 624 |
+
" title = Will there be a Tropical Hurricane in the Atlantic on 4 August 2024?\n",
|
| 625 |
" title = Will the US operation succeed in capturing all Sinaloa cartel leaders by August 1, 2024?\n",
|
|
|
|
|
|
|
|
|
|
|
|
|
| 626 |
" title = Will TSMC start 4-nanometer chip production in its Phoenix, Arizona factory by the end of 2025?\n",
|
| 627 |
" title = Will the Park Fire in California be fully contained on or by 2 August 2024?\n",
|
| 628 |
+
" title = Will Benjamin Netanyahu still be the Prime Minister of Israel on 4 August 2024?\n",
|
| 629 |
+
" title = Will the Boeing Starliner's first astronaut-crewed capsule return from the International Space Station on 4 August 2024?\n",
|
| 630 |
+
" title = Will Ismael 'El Mayo' Zambada be found guilty of US charges by 3 August 2024?\n",
|
| 631 |
+
" title = Will Kamala Harris win the US Presidential Elections on 3 August 2024?\n",
|
| 632 |
+
" title = Will the sales of smart kettles increase significantly on or before 3 August 2024?\n",
|
| 633 |
" title = Will Pep Guardiola announce his extension with Manchester City on 1 August 2024?\n",
|
|
|
|
| 634 |
" title = Will a solar-powered car break the Cannonball Run record by 2nd August 2024?\n",
|
|
|
|
| 635 |
" title = Will HP release a new AI software or hardware on or before August 2, 2024?\n",
|
| 636 |
" title = Will Twitter implement a new misinformation policy before the 2024 elections?\n",
|
| 637 |
+
" title = Will Robert Downey Jr appear in the announced 'Avengers Doomsday and Secret Wars' as Dr Doom by 4 August 2024?\n",
|
| 638 |
+
" title = Will Intel release a patch to fix the instability problems with 14th-gen and 13th-gen CPUs on or by 2 August 2024?\n"
|
| 639 |
]
|
| 640 |
}
|
| 641 |
],
|
|
|
|
| 756 |
},
|
| 757 |
{
|
| 758 |
"cell_type": "code",
|
| 759 |
+
"execution_count": 67,
|
| 760 |
"metadata": {},
|
| 761 |
"outputs": [],
|
| 762 |
"source": [
|
live_data/markets_live_data.parquet
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e29014d0396e1174838cbe49097cd73c21b8cd2168aeea23ba98240f16c96996
|
| 3 |
+
size 22391
|
requirements.txt
CHANGED
|
@@ -1,5 +1,4 @@
|
|
| 1 |
pandas==2.2.2
|
| 2 |
-
python_version==3.12.2
|
| 3 |
seaborn
|
| 4 |
matplotlib
|
| 5 |
huggingface-hub
|
|
|
|
| 1 |
pandas==2.2.2
|
|
|
|
| 2 |
seaborn
|
| 3 |
matplotlib
|
| 4 |
huggingface-hub
|
scripts/live_markets_data.py
CHANGED
|
@@ -55,7 +55,7 @@ from queries import (
|
|
| 55 |
FPMMS_FIELD,
|
| 56 |
)
|
| 57 |
|
| 58 |
-
logging.
|
| 59 |
|
| 60 |
ResponseItemType = List[Dict[str, str]]
|
| 61 |
SubgraphResponseType = Dict[str, ResponseItemType]
|
|
@@ -146,7 +146,7 @@ def query_subgraph(url: str, query: str, key: str) -> SubgraphResponseType:
|
|
| 146 |
def fpmms_fetcher(current_timestamp: int) -> Generator[ResponseItemType, int, None]:
|
| 147 |
"""An indefinite fetcher for the FPMMs."""
|
| 148 |
omen_subgraph = OMEN_SUBGRAPH_URL.substitute(subgraph_api_key=SUBGRAPH_API_KEY)
|
| 149 |
-
|
| 150 |
while True:
|
| 151 |
fpmm_id = yield
|
| 152 |
fpmms_query = FPMMS_WITH_TOKENS_QUERY.substitute(
|
|
@@ -166,20 +166,20 @@ def fpmms_fetcher(current_timestamp: int) -> Generator[ResponseItemType, int, No
|
|
| 166 |
liquidity_measure_field=LIQUIDIY_MEASURE_FIELD,
|
| 167 |
token_amounts_field=TOKEN_AMOUNTS_FIELD,
|
| 168 |
)
|
| 169 |
-
|
| 170 |
yield query_subgraph(omen_subgraph, fpmms_query, FPMMS_FIELD)
|
| 171 |
|
| 172 |
|
| 173 |
def fetch_fpmms(current_timestamp: int) -> pd.DataFrame:
|
| 174 |
"""Fetch all the fpmms of the creator."""
|
| 175 |
-
|
| 176 |
latest_id = ""
|
| 177 |
fpmms = []
|
| 178 |
fetcher = fpmms_fetcher(current_timestamp)
|
| 179 |
for _ in tqdm(fetcher, unit="fpmms", unit_scale=BATCH_SIZE):
|
| 180 |
batch = fetcher.send(latest_id)
|
| 181 |
if len(batch) == 0:
|
| 182 |
-
|
| 183 |
break
|
| 184 |
|
| 185 |
# TODO Add the incremental batching system from market creator
|
|
@@ -187,14 +187,14 @@ def fetch_fpmms(current_timestamp: int) -> pd.DataFrame:
|
|
| 187 |
# for fpmm in batch:
|
| 188 |
# if fpmm["id"] not in fpmms or "trades" not in prev_fpmms[fpmm["id"]]:
|
| 189 |
# prev_fpmms[fpmm["id"]] = fpmm
|
| 190 |
-
|
| 191 |
latest_id = batch[-1].get(ID_FIELD, "")
|
| 192 |
if latest_id == "":
|
| 193 |
raise ValueError(f"Unexpected data format retrieved: {batch}")
|
| 194 |
|
| 195 |
fpmms.extend(batch)
|
| 196 |
|
| 197 |
-
|
| 198 |
return pd.DataFrame(fpmms)
|
| 199 |
|
| 200 |
|
|
@@ -247,12 +247,12 @@ def transform_fpmms(fpmms: pd.DataFrame, filename: str, current_timestamp: int)
|
|
| 247 |
if old_fpmms is not None:
|
| 248 |
# update which markets are not open anymore
|
| 249 |
open_markets = list(fpmms.id.unique())
|
| 250 |
-
|
| 251 |
open_mask = old_fpmms["id"].isin(open_markets)
|
| 252 |
old_fpmms.loc[~open_mask, "open"] = False
|
| 253 |
|
| 254 |
# now concatenate
|
| 255 |
-
|
| 256 |
return pd.concat([old_fpmms, fpmms], axis=0, ignore_index=True)
|
| 257 |
|
| 258 |
return fpmms
|
|
@@ -262,20 +262,20 @@ def transform_fpmms(fpmms: pd.DataFrame, filename: str, current_timestamp: int)
|
|
| 262 |
def compute_distributions(filename: Optional[str]) -> pd.DataFrame:
|
| 263 |
"""Fetch, process, store and return the markets as a Dataframe."""
|
| 264 |
|
| 265 |
-
|
| 266 |
current_timestamp = int(datetime.now(UTC).timestamp())
|
| 267 |
fpmms = fetch_fpmms(current_timestamp)
|
| 268 |
-
|
| 269 |
-
|
| 270 |
|
| 271 |
-
|
| 272 |
fpmms = transform_fpmms(fpmms, filename, current_timestamp)
|
| 273 |
-
|
| 274 |
|
| 275 |
-
|
| 276 |
add_trading_info(fpmms, current_timestamp)
|
| 277 |
|
| 278 |
-
|
| 279 |
print(fpmms.info())
|
| 280 |
if filename:
|
| 281 |
fpmms.to_parquet(DATA_DIR / filename, index=False)
|
|
@@ -294,5 +294,7 @@ if __name__ == "__main__":
|
|
| 294 |
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
| 295 |
)
|
| 296 |
stream_handler.setFormatter(formatter)
|
| 297 |
-
|
|
|
|
|
|
|
| 298 |
compute_distributions("markets_live_data.parquet")
|
|
|
|
| 55 |
FPMMS_FIELD,
|
| 56 |
)
|
| 57 |
|
| 58 |
+
logger = logging.getLogger(__name__)
|
| 59 |
|
| 60 |
ResponseItemType = List[Dict[str, str]]
|
| 61 |
SubgraphResponseType = Dict[str, ResponseItemType]
|
|
|
|
| 146 |
def fpmms_fetcher(current_timestamp: int) -> Generator[ResponseItemType, int, None]:
|
| 147 |
"""An indefinite fetcher for the FPMMs."""
|
| 148 |
omen_subgraph = OMEN_SUBGRAPH_URL.substitute(subgraph_api_key=SUBGRAPH_API_KEY)
|
| 149 |
+
logger.debug(f"omen_subgraph = {omen_subgraph}")
|
| 150 |
while True:
|
| 151 |
fpmm_id = yield
|
| 152 |
fpmms_query = FPMMS_WITH_TOKENS_QUERY.substitute(
|
|
|
|
| 166 |
liquidity_measure_field=LIQUIDIY_MEASURE_FIELD,
|
| 167 |
token_amounts_field=TOKEN_AMOUNTS_FIELD,
|
| 168 |
)
|
| 169 |
+
logger.debug(f"Executing query {fpmms_query}")
|
| 170 |
yield query_subgraph(omen_subgraph, fpmms_query, FPMMS_FIELD)
|
| 171 |
|
| 172 |
|
| 173 |
def fetch_fpmms(current_timestamp: int) -> pd.DataFrame:
|
| 174 |
"""Fetch all the fpmms of the creator."""
|
| 175 |
+
logger.info("Fetching all markets")
|
| 176 |
latest_id = ""
|
| 177 |
fpmms = []
|
| 178 |
fetcher = fpmms_fetcher(current_timestamp)
|
| 179 |
for _ in tqdm(fetcher, unit="fpmms", unit_scale=BATCH_SIZE):
|
| 180 |
batch = fetcher.send(latest_id)
|
| 181 |
if len(batch) == 0:
|
| 182 |
+
logger.debug("no data")
|
| 183 |
break
|
| 184 |
|
| 185 |
# TODO Add the incremental batching system from market creator
|
|
|
|
| 187 |
# for fpmm in batch:
|
| 188 |
# if fpmm["id"] not in fpmms or "trades" not in prev_fpmms[fpmm["id"]]:
|
| 189 |
# prev_fpmms[fpmm["id"]] = fpmm
|
| 190 |
+
logger.debug(f"length of the data received = {len(batch)}")
|
| 191 |
latest_id = batch[-1].get(ID_FIELD, "")
|
| 192 |
if latest_id == "":
|
| 193 |
raise ValueError(f"Unexpected data format retrieved: {batch}")
|
| 194 |
|
| 195 |
fpmms.extend(batch)
|
| 196 |
|
| 197 |
+
logger.info("Finished collecting data")
|
| 198 |
return pd.DataFrame(fpmms)
|
| 199 |
|
| 200 |
|
|
|
|
| 247 |
if old_fpmms is not None:
|
| 248 |
# update which markets are not open anymore
|
| 249 |
open_markets = list(fpmms.id.unique())
|
| 250 |
+
logger.info("Updating market status of old markets")
|
| 251 |
open_mask = old_fpmms["id"].isin(open_markets)
|
| 252 |
old_fpmms.loc[~open_mask, "open"] = False
|
| 253 |
|
| 254 |
# now concatenate
|
| 255 |
+
logger.info("Appending new data to previous data")
|
| 256 |
return pd.concat([old_fpmms, fpmms], axis=0, ignore_index=True)
|
| 257 |
|
| 258 |
return fpmms
|
|
|
|
| 262 |
def compute_distributions(filename: Optional[str]) -> pd.DataFrame:
|
| 263 |
"""Fetch, process, store and return the markets as a Dataframe."""
|
| 264 |
|
| 265 |
+
logger.info("fetching new markets information")
|
| 266 |
current_timestamp = int(datetime.now(UTC).timestamp())
|
| 267 |
fpmms = fetch_fpmms(current_timestamp)
|
| 268 |
+
logger.debug("New collected data")
|
| 269 |
+
logger.debug(fpmms.head())
|
| 270 |
|
| 271 |
+
logger.info("transforming and updating previous data")
|
| 272 |
fpmms = transform_fpmms(fpmms, filename, current_timestamp)
|
| 273 |
+
logger.debug(fpmms.info())
|
| 274 |
|
| 275 |
+
logger.info("Adding trading information")
|
| 276 |
add_trading_info(fpmms, current_timestamp)
|
| 277 |
|
| 278 |
+
logger.info("saving the data")
|
| 279 |
print(fpmms.info())
|
| 280 |
if filename:
|
| 281 |
fpmms.to_parquet(DATA_DIR / filename, index=False)
|
|
|
|
| 294 |
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
| 295 |
)
|
| 296 |
stream_handler.setFormatter(formatter)
|
| 297 |
+
logging.basicConfig(
|
| 298 |
+
handlers=[logging.FileHandler("live_markets.log"), stream_handler]
|
| 299 |
+
)
|
| 300 |
compute_distributions("markets_live_data.parquet")
|
scripts/live_traders_data.py
CHANGED
|
@@ -13,21 +13,20 @@ from utils import (
|
|
| 13 |
from utils import SUBGRAPH_API_KEY, _to_content
|
| 14 |
from queries import omen_trader_votes_query
|
| 15 |
|
|
|
|
| 16 |
|
| 17 |
headers = {
|
| 18 |
"Accept": "application/json, multipart/mixed",
|
| 19 |
"Content-Type": "application/json",
|
| 20 |
}
|
| 21 |
|
| 22 |
-
logging.basicConfig(level=logging.INFO)
|
| 23 |
-
|
| 24 |
|
| 25 |
def _query_omen_xdai_subgraph(
|
| 26 |
fpmm_id: str,
|
| 27 |
) -> dict[str, Any]:
|
| 28 |
"""Query the subgraph."""
|
| 29 |
omen_subgraph = OMEN_SUBGRAPH_URL.substitute(subgraph_api_key=SUBGRAPH_API_KEY)
|
| 30 |
-
|
| 31 |
grouped_results = defaultdict(list)
|
| 32 |
id_gt = ""
|
| 33 |
|
|
@@ -38,7 +37,7 @@ def _query_omen_xdai_subgraph(
|
|
| 38 |
id_gt=id_gt,
|
| 39 |
fpmm_id=fpmm_id,
|
| 40 |
)
|
| 41 |
-
|
| 42 |
content_json = _to_content(query)
|
| 43 |
|
| 44 |
res = requests.post(omen_subgraph, headers=headers, json=content_json)
|
|
@@ -69,10 +68,10 @@ def _query_omen_xdai_subgraph(
|
|
| 69 |
|
| 70 |
def transform_trades(trades_json: dict) -> pd.DataFrame:
|
| 71 |
# convert to dataframe
|
| 72 |
-
|
| 73 |
df = pd.DataFrame(trades_json["data"]["fpmmTrades"])
|
| 74 |
if len(df) == 0:
|
| 75 |
-
|
| 76 |
return df
|
| 77 |
|
| 78 |
# print(df.info())
|
|
@@ -107,7 +106,7 @@ def compute_from_timestamp_value(
|
|
| 107 |
# the last value is the current timestamp so we need to take the previous one
|
| 108 |
return timestamps[-2]
|
| 109 |
except Exception as e:
|
| 110 |
-
|
| 111 |
f"Error when trying to get the from timestamp value of the market id {fpmm_id}"
|
| 112 |
)
|
| 113 |
return None
|
|
@@ -120,7 +119,7 @@ def compute_votes_distribution(market_trades: pd.DataFrame):
|
|
| 120 |
# outcomeIndex is always 1 or 0?
|
| 121 |
sum_outcome_index_1 = sum(market_trades.outcomeIndex)
|
| 122 |
print(f"The total number of votes for index 1 is {sum_outcome_index_1}")
|
| 123 |
-
|
| 124 |
percentage_index_1 = round((sum_outcome_index_1 / total_trades) * 100, 2)
|
| 125 |
return (100 - percentage_index_1), percentage_index_1
|
| 126 |
|
|
@@ -128,40 +127,39 @@ def compute_votes_distribution(market_trades: pd.DataFrame):
|
|
| 128 |
def add_trading_info(fpmms: pd.DataFrame, current_timestamp: int) -> None:
|
| 129 |
"""Function to update only the information related with the current timestamp"""
|
| 130 |
# Iterate over the markets
|
| 131 |
-
|
| 132 |
|
| 133 |
for i, fpmm in tqdm(fpmms.iterrows(), total=len(fpmms), desc="Analysing trades"):
|
| 134 |
# update the trades for this market and at this specific current_timestamp
|
| 135 |
-
|
| 136 |
to_update = fpmm["open"] and fpmm["tokens_timestamp"] == current_timestamp
|
| 137 |
if not to_update: # jump closed markets or old data
|
| 138 |
-
|
| 139 |
continue
|
| 140 |
market_id = fpmm["id"]
|
| 141 |
|
| 142 |
-
|
| 143 |
market_trades_json = _query_omen_xdai_subgraph(
|
| 144 |
fpmm_id=market_id,
|
| 145 |
)
|
| 146 |
market_trades = transform_trades(market_trades_json)
|
| 147 |
if len(market_trades) == 0:
|
| 148 |
-
|
| 149 |
continue
|
| 150 |
# to compute the votes distribution
|
| 151 |
-
|
| 152 |
-
|
| 153 |
first_outcome, second_outcome = compute_votes_distribution(market_trades)
|
| 154 |
-
|
| 155 |
f"first outcome votes ={first_outcome}, second outcome votes = {second_outcome}"
|
| 156 |
)
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
fpmm["votes_second_outcome_perc"] = second_outcome
|
| 160 |
metric = abs(fpmm["first_token_perc"] - first_outcome)
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
return
|
| 166 |
|
| 167 |
|
|
|
|
| 13 |
from utils import SUBGRAPH_API_KEY, _to_content
|
| 14 |
from queries import omen_trader_votes_query
|
| 15 |
|
| 16 |
+
logger = logging.getLogger(__name__)
|
| 17 |
|
| 18 |
headers = {
|
| 19 |
"Accept": "application/json, multipart/mixed",
|
| 20 |
"Content-Type": "application/json",
|
| 21 |
}
|
| 22 |
|
|
|
|
|
|
|
| 23 |
|
| 24 |
def _query_omen_xdai_subgraph(
|
| 25 |
fpmm_id: str,
|
| 26 |
) -> dict[str, Any]:
|
| 27 |
"""Query the subgraph."""
|
| 28 |
omen_subgraph = OMEN_SUBGRAPH_URL.substitute(subgraph_api_key=SUBGRAPH_API_KEY)
|
| 29 |
+
logger.info(f"omen_subgraph = {omen_subgraph}")
|
| 30 |
grouped_results = defaultdict(list)
|
| 31 |
id_gt = ""
|
| 32 |
|
|
|
|
| 37 |
id_gt=id_gt,
|
| 38 |
fpmm_id=fpmm_id,
|
| 39 |
)
|
| 40 |
+
logger.debug(f"query for the omen to collect trades {query}")
|
| 41 |
content_json = _to_content(query)
|
| 42 |
|
| 43 |
res = requests.post(omen_subgraph, headers=headers, json=content_json)
|
|
|
|
| 68 |
|
| 69 |
def transform_trades(trades_json: dict) -> pd.DataFrame:
|
| 70 |
# convert to dataframe
|
| 71 |
+
logger.info("transforming trades")
|
| 72 |
df = pd.DataFrame(trades_json["data"]["fpmmTrades"])
|
| 73 |
if len(df) == 0:
|
| 74 |
+
logger.warning("No trades for this market")
|
| 75 |
return df
|
| 76 |
|
| 77 |
# print(df.info())
|
|
|
|
| 106 |
# the last value is the current timestamp so we need to take the previous one
|
| 107 |
return timestamps[-2]
|
| 108 |
except Exception as e:
|
| 109 |
+
logger.error(
|
| 110 |
f"Error when trying to get the from timestamp value of the market id {fpmm_id}"
|
| 111 |
)
|
| 112 |
return None
|
|
|
|
| 119 |
# outcomeIndex is always 1 or 0?
|
| 120 |
sum_outcome_index_1 = sum(market_trades.outcomeIndex)
|
| 121 |
print(f"The total number of votes for index 1 is {sum_outcome_index_1}")
|
| 122 |
+
logger.info(f"The total number of votes for index 1 is {sum_outcome_index_1}")
|
| 123 |
percentage_index_1 = round((sum_outcome_index_1 / total_trades) * 100, 2)
|
| 124 |
return (100 - percentage_index_1), percentage_index_1
|
| 125 |
|
|
|
|
| 127 |
def add_trading_info(fpmms: pd.DataFrame, current_timestamp: int) -> None:
|
| 128 |
"""Function to update only the information related with the current timestamp"""
|
| 129 |
# Iterate over the markets
|
| 130 |
+
logger.info("Adding votes distribution per market")
|
| 131 |
|
| 132 |
for i, fpmm in tqdm(fpmms.iterrows(), total=len(fpmms), desc="Analysing trades"):
|
| 133 |
# update the trades for this market and at this specific current_timestamp
|
| 134 |
+
logger.debug(f"current timestamp = {current_timestamp} and market timestamp={fpmm["tokens_timestamp"]}")
|
| 135 |
to_update = fpmm["open"] and fpmm["tokens_timestamp"] == current_timestamp
|
| 136 |
if not to_update: # jump closed markets or old data
|
| 137 |
+
logger.debug("Jumping this row")
|
| 138 |
continue
|
| 139 |
market_id = fpmm["id"]
|
| 140 |
|
| 141 |
+
logger.info(f"Adding information for the market {market_id}")
|
| 142 |
market_trades_json = _query_omen_xdai_subgraph(
|
| 143 |
fpmm_id=market_id,
|
| 144 |
)
|
| 145 |
market_trades = transform_trades(market_trades_json)
|
| 146 |
if len(market_trades) == 0:
|
| 147 |
+
logger.info("No trades for this market")
|
| 148 |
continue
|
| 149 |
# to compute the votes distribution
|
| 150 |
+
logger.info("Computing the votes distribution")
|
| 151 |
+
fpmms.at[i,"total_trades"] = len(market_trades)
|
| 152 |
first_outcome, second_outcome = compute_votes_distribution(market_trades)
|
| 153 |
+
logger.info(
|
| 154 |
f"first outcome votes ={first_outcome}, second outcome votes = {second_outcome}"
|
| 155 |
)
|
| 156 |
+
fpmms.at[i,"votes_first_outcome_perc"] = first_outcome
|
| 157 |
+
fpmms.at[i,"votes_second_outcome_perc"] = second_outcome
|
|
|
|
| 158 |
metric = abs(fpmm["first_token_perc"] - first_outcome)
|
| 159 |
+
logger.info(f"metric for this market {metric}")
|
| 160 |
+
fpmms.at[i,"dist_gap_perc"] = metric
|
| 161 |
+
logger.debug("Dataset after adding trading info")
|
| 162 |
+
logger.debug(fpmms.head())
|
| 163 |
return
|
| 164 |
|
| 165 |
|
scripts/queries.py
CHANGED
|
@@ -43,9 +43,10 @@ FPMMS_WITH_TOKENS_QUERY = Template(
|
|
| 43 |
where: {
|
| 44 |
creator: "${creator}",
|
| 45 |
id_gt: "${fpmm_id}",
|
| 46 |
-
isPendingArbitration: false
|
| 47 |
-
currentAnswer: null
|
| 48 |
-
openingTimestamp_gt:${current_timestamp}
|
|
|
|
| 49 |
},
|
| 50 |
orderBy: ${id_field}
|
| 51 |
orderDirection: asc
|
|
|
|
| 43 |
where: {
|
| 44 |
creator: "${creator}",
|
| 45 |
id_gt: "${fpmm_id}",
|
| 46 |
+
isPendingArbitration: false,
|
| 47 |
+
currentAnswer: null,
|
| 48 |
+
openingTimestamp_gt:${current_timestamp},
|
| 49 |
+
outcomeTokenAmounts_not: ["0","0"]
|
| 50 |
},
|
| 51 |
orderBy: ${id_field}
|
| 52 |
orderDirection: asc
|