RPC_URL = os.getenv("RPC_URL") # Your Infura/Alchemy key w3 = Web3(Web3.HTTPProvider(RPC_URL))

return swaps latest = w3.eth.block_number swaps = get_recent_swaps("0x...PAIR_ADDRESS...", latest-100, latest)

from web3 import Web3 w3 = Web3(Web3.HTTPProvider("YOUR_RPC_URL")) UNISWAP_V2_PAIR = "0xB4e16d0168e52d35CaCD2c6185b44281Ec28C9Dc" # USDC/WETH

while True: current_block = w3.eth.block_number

import time last_block = w3.eth.block_number

BACK TO TOP