Use this file to discover all available pages before exploring further.
Stores markets, events, exchanges, and other entities as nodes. Connects them with typed, weighted edges (correlations, hedges, part-of). Records timestamped facts about each entity. All SQLite, no external dependencies.
Markets, events, categories, exchanges, assets, people, organizations. Each has a type, name, JSON properties, and HMAC signature.
relationships
Directed typed edges between entities. Types: correlated_with, caused_by, part_of, hedges, competes_with, related_to, influences, depends_on. Each has a weight and validity window.
facts
Timestamped assertions about entities. Types: observation, signal, outcome, correlation, price_move, settlement, edge_detected, regime_change. Each has a confidence score and optional expiry.
# Create or update (upserts on conflict)kg.add_entity("btc-above-100k", "market", "BTC above $100k by June", properties={"exchange": "kalshi"})# Lookupentity = kg.get_entity("btc-above-100k")# Search by type and/or namemarkets = kg.find_entities(entity_type="market", limit=50)matches = kg.find_entities(name_pattern="trump", limit=20)# Delete (cascades to relationships and facts)kg.remove_entity("btc-above-100k")
Every relationship has valid_from and valid_to. When valid_to is NULL, it is active. Expiring a relationship sets valid_to = now so the historical record is preserved.