analysis
Guide Kalshi, Polymarket, and cross-venue analysis workflows for prediction-market-analysis.
- License 许可
- MIT
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- analysis
- license
- MIT
- metadata
- { "disco-role": "operating" }
- description
- Guide Kalshi, Polymarket, and cross-venue analysis workflows for prediction-market-analysis.
- disable-model-invocation
- true
02 资源文件 2
- 参考文档references/troubleshooting.md1.6 KB
- 参考文档references/workflows.md1.6 KB
03 SKILL.md 正文
analysis
Use this sub-skill for anything that runs, interprets, or extends the repo's analysis classes.
It covers both the menu-driven CLI and the Python Analysis framework.
Use this route when
- The user wants to run a named analysis or all analyses.
- The user wants calibration, return, volume, category, or statistical-study guidance.
- The user wants a new analysis class or a fix to an existing one.
- The user wants help understanding
Analysis,AnalysisOutput, orChartConfig.
Scope
Included
- Kalshi calibration and pricing analyses.
- Kalshi maker/taker, category, hour-of-day, and volume analyses.
- Kalshi meta statistics and paper-style statistical tests.
- Polymarket calibration, volume, and trade-time analyses.
- The cross-venue animated calibration comparison.
Analysis.save()output formats andChartConfigJSON export.
Excluded
- Market/trade/block backfills and cursor recovery, which belong to
sub-skills/indexing/. - Dataset download, archive creation, and host-tool installation, which belong to
sub-skills/data-ops/.
Read first
../../references/analysis-catalog.mdfor the full analysis list.../../references/api-reference.mdfor theAnalysisandChartConfigAPIs.../../references/data-layout.mdfor the required Parquet inputs.../../references/troubleshooting.mdfor cross-cutting failures.
Core workflow
- Identify the analysis name from the catalog or from
scripts/catalog.py. - Confirm the required input directories exist.
- Run the analysis with
uv run main.py analyze <name>or the equivalent wrapper. - Read the saved outputs under
output/<analysis-name>.*. - If the analysis is missing, thin, or failing, inspect the relevant source module and the family-specific troubleshooting notes.
Analysis families
Kalshi calibration and pricing
Use these when the task is about price calibration, mispricing, or expected value:
win_rate_by_pricemispricing_by_pricewin_rate_by_trade_sizeev_yes_vs_no
Typical inputs:
data/kalshi/trades/, data/kalshi/markets/.
Kalshi time and volume
Use these when the task is about temporal trends or notional volume:
returns_by_hourvwap_by_hourvolume_over_timelongshot_volume_share_over_timekalshi_calibration_deviation_over_timemaker_taker_gap_over_time
Typical inputs:
data/kalshi/trades/, sometimes data/kalshi/markets/.
Kalshi maker/taker and category studies
Use these when the task compares makers and takers, direction, or category grouping:
trade_size_by_rolemaker_returns_by_directionmaker_win_rate_by_directionmaker_vs_taker_returnsmaker_taker_returns_by_categorymarket_typesyes_vs_no_by_pricemeta_statsstatistical_tests
Typical inputs:
data/kalshi/trades/, data/kalshi/markets/, and src.analysis.kalshi.util.categories.
Polymarket analyses
Use these when the task is about Polymarket calibration, volume, or block-level trade history:
polymarket_win_rate_by_pricepolymarket_calibration_by_bucketpolymarket_volume_over_timepolymarket_trades_over_time
Typical inputs:
data/polymarket/trades/, data/polymarket/legacy_trades/, data/polymarket/markets/, data/polymarket/blocks/, and data/polymarket/fpmm_collateral_lookup.json.
Cross-venue comparison
Use win_rate_by_price_animated when the user wants a single workflow that compares Kalshi and Polymarket in one animated calibration plot.
Typical inputs:
Both platforms' data directories plus data/polymarket/blocks/ and the collateral lookup file.
Adding or fixing an analysis
- Subclass
Analysis. - Set a stable
nameand a human-readabledescriptionin__init__. - Keep data selection, transformations, figure creation, and chart serialization inside
run()or helper methods. - Return
AnalysisOutput. - Use
self.progress()for longer SQL or dataframe steps. - Prefer
ChartConfighelpers when the analysis should also emit JSON chart output. - Use the category helpers from
src.analysis.kalshi.util.categorieswhen grouping Kalshi markets.
Common failure patterns
- Missing or empty
data/subtrees. - No finalized or resolved markets, leading to empty dataframes.
- Missing Polymarket helper files, especially the collateral lookup or block timestamps.
Analysis.load()returning no classes because the command was run from the wrong directory.- Matplotlib backend issues on headless hosts.
Helpful helper
../../scripts/catalog.pylists the analysis names without opening the interactive menu when run through the repo environment.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).