79 lines
2.6 KiB
Python
79 lines
2.6 KiB
Python
import json, collections, math
|
|
from datetime import datetime
|
|
|
|
with open('data/processed_transactions.json') as f:
|
|
txns = json.load(f)
|
|
|
|
print(f"Total transactions in file: {len(txns)}")
|
|
print()
|
|
|
|
# Sample
|
|
print("=== Sample (first 3) ===")
|
|
for t in txns[:3]:
|
|
print(json.dumps(t, indent=2))
|
|
print()
|
|
|
|
# Fields available
|
|
print("=== Available Fields ===")
|
|
sample = txns[0]
|
|
print(list(sample.keys()))
|
|
print()
|
|
|
|
# Direction distribution
|
|
print("=== Direction ===")
|
|
dirs = collections.Counter()
|
|
for t in txns:
|
|
dirs[t.get('side','?')]+=1
|
|
print(dirs)
|
|
print()
|
|
|
|
# Side breakdown
|
|
print("=== BUY vs SELL ===")
|
|
for s in ['BUY','SELL']:
|
|
n=sum(1 for t in txns if t.get('side')==s)
|
|
print(f" {s}: {n}")
|
|
print()
|
|
|
|
# Size distribution
|
|
print("=== Trade Size (USD) Distribution ===")
|
|
bins=[(0,100),(100,500),(500,1000),(1000,2000),(2000,5000),(5000,10000),(10000,20000),(20000,50000),(50000,100000),(100000,999999)]
|
|
for lo,hi in bins:
|
|
n=sum(1 for t in txns if lo<t.get('usdc_size',0)<=hi)
|
|
if n>0:
|
|
avg=sum(t.get('usdc_size',0) for t in txns if lo<t.get('usdc_size',0)<=hi)/n
|
|
print(f" ${lo:,.0f}-${hi:,.0f}: {n} txns, avg ${avg:,.0f}")
|
|
print()
|
|
|
|
# Price distribution
|
|
print("=== Price Distribution (BUY only) ===")
|
|
buy_txns=[t for t in txns if t.get('side')=='BUY']
|
|
price_bins=[(0,0.1),(0.1,0.2),(0.2,0.3),(0.3,0.4),(0.4,0.5),(0.5,0.6),(0.6,0.7),(0.7,0.8),(0.8,0.9),(0.9,1.0)]
|
|
for lo,hi in price_bins:
|
|
n=sum(1 for t in buy_txns if lo<=t.get('price',0)<hi)
|
|
if n>0:
|
|
print(f" {lo}-{hi}: {n}")
|
|
print()
|
|
|
|
# Largest trades
|
|
print("=== Top 20 Largest Trades (BUY) ===")
|
|
largest=sorted(buy_txns, key=lambda t: t.get('usdc_size',0), reverse=True)[:20]
|
|
for t in largest:
|
|
print(f" ${t['usdc_size']:,.0f} | {t['side']} {t.get('outcome','?')} @ {t['price']:.4f} | {t.get('title','?')[:60]}")
|
|
print()
|
|
|
|
# Check what happens at each filter stage
|
|
print("=== Filter Stage Analysis (BUY only, 0.0-0.95 price) ===")
|
|
print(f"BUY txns with price in 0.0-0.95: {sum(1 for t in buy_txns if 0<=t.get('price',0)<=0.95)}")
|
|
print(f"BUY txns size >= 1000: {sum(1 for t in buy_txns if t.get('usdc_size',0)>=1000)}")
|
|
print(f"BUY txns size >= 3000: {sum(1 for t in buy_txns if t.get('usdc_size',0)>=3000)}")
|
|
print(f"BUY txns size >= 5000: {sum(1 for t in buy_txns if t.get('usdc_size',0)>=5000)}")
|
|
print()
|
|
|
|
# Check if there are BUY txns >= 5000 with price in range
|
|
big_buy=[t for t in buy_txns if t.get('usdc_size',0)>=5000 and 0<=t.get('price',0)<=0.95]
|
|
print(f"BUY txns >= $5K and price in range: {len(big_buy)}")
|
|
if big_buy:
|
|
print(" Sample of qualifying transactions:")
|
|
for t in big_buy[:5]:
|
|
print(f" ${t['usdc_size']:,.0f} @ {t['price']:.4f} | vol={t.get('volume',0):,.0f}")
|