Skip to content

Instantly share code, notes, and snippets.

# process_resolutions.py
#
# This script implements the exact same logic as the Polymarket Conditional Token contract
# for calculating condition IDs and position IDs, including the elliptic curve
# ops used in getCollectionId.
import json
import time
import logging
import pathlib
# get_raw_hist_resolutions.py
#
# This script fetches raw QuestionResolved events from the UMA Adapter contracts
# and saves them to a CSV file.
import json
import time
import logging
import pathlib
import random
# process_trades.py
#
# This script processes raw trade events from get_raw_trades.py output
# and converts them into structured trade data with calculated fields
import json
import time
import math
import logging
import pathlib
# get_raw_trades.py
# This script fetches raw OrderFilled events from the Main & Neg-Risk CTF Exchanges
# for a given date range and saves them to `OUTPUT_FILENAME`
import json
import os
import time
import logging
import pathlib
# get_hist_resolutions.py - DRAFT - 2.1.1
import json, time, logging, pathlib, random
from contextlib import contextmanager
from dataclasses import dataclass
from datetime import datetime, timezone
from typing import List, Optional, Dict, Set, Any, Tuple
from web3 import Web3
from web3.types import LogReceipt, FilterParams