Skip to main content

analysis-poly

Real Profit (Fee-Excluded View)

PnL Ratio rebate

中文说明见:README_zh.md

Polymarket market PnL analyzer with a web UI.

Scope (Important)

  • The dashboard discovers markets from Polymarket user activity within the selected time range, then replays the matched markets.
  • It is intended for Polymarket market analysis in general, including but not limited to crypto markets.
  • Main purpose: quantify and visualize realized PnL, fee impact, market-level performance, and Net PnL vs No-Fee PnL.

Data API v2

Activity discovery and market replay use /v2/activity and /v2/trades, following pagination.next_cursor until null, including short or empty intermediate pages. Responses accept v2 snake_case fields and map token_id to the replay engine's asset field. Gamma market metadata remains on its existing API.

Completed activity ranges and market results use fresh caches at .cache/user_activity_v2 and .cache/address_market_results_v2. The first run refetches data; old cache files are preserved. Direct Python callers of get_user_activity_page must pass cursor instead of offset and read .data and .pagination.next_cursor from the returned page.

For local requests through a proxy, set HTTP_PROXY=http://127.0.0.1:8117 and HTTPS_PROXY=http://127.0.0.1:8117 before running uv run commands. See the official migration guide.

Requirements

  • Python 3.11+ (recommended: 3.11)
  • uv package manager is optional for local development

Quick Start

pip install analysis-poly
analysis-poly-server --host 127.0.0.1 --port 8000

Open http://localhost:8000.

Local Install From Source

uv pip install .
# or
pip install .

Then start the web server with the same one-line command:

analysis-poly-server --host 127.0.0.1 --port 8000

For source checkout development, this also works:

uv sync
uv run python main.py

CLI Open + Auto Start

Use a standalone script to start server, open browser, and pass params in URL.

uv run -m analysis_poly.open_with_params \
  --address 0xabc \
  --keywords updown,15m \
  --start-time "2026-03-01 00:00" \
  --end-time "2026-03-02 00:00" \
  --concurrency 8

Frontend will read query params, fill form fields, and auto start the run.

CLI Run Once

Use the synchronous CLI entry when you want a single final JSON payload on stdout without SSE or web UI:

analysis-poly-run \
  --address 0xabc \
  --keywords updown,15m \
  --start-time "2026-03-01 00:00" \
  --end-time "2026-03-02 00:00"

The command blocks until analysis finishes, writes report artifacts into output_dir, and prints:

{
  "status": "COMPLETED",
  "summary": { "...": "..." },
  "artifacts": {
    "json": "reports/...",
    "total_curve_csv": "reports/...",
    "market_curve_csv": "reports/..."
  }
}

First Clone

analysis_poly/static/dist is committed in the repository, so first startup does not require front-end build.

If you modify frontend/src, rebuild assets:

npm install
npm run build

API

  • POST /api/runs
  • GET /api/runs/{run_id}/stream (SSE)
  • POST /api/runs/{run_id}/stop
  • GET /api/runs/{run_id}/result
  • GET /api/runs/{run_id}/state

Test

uv run pytest

Frontend

  • Source: frontend/src
  • Build output: analysis_poly/static/dist/app.js and analysis_poly/static/dist/app.css

Metadata

Release files for analysis-poly 0.1.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for analysis-poly 0.1.11
File Size Uploaded
analysis_poly-0.1.11.tar.gz 745.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for analysis-poly 0.1.11
File Interpreter ABI Platform
analysis_poly-0.1.11-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / analysis_poly-0.1.11.tar.gz

Download URL analysis_poly-0.1.11.tar.gz
Size 745.5 kB
Tags Source
SHA-256 checksum
How to use checksums
c80cf1748597ae9b01d489f08a992f74c1d12a0ac5a6e061ff8a72b043d6f15c
BLAKE2b-256 checksum
How to use checksums
45b4b2d7168684902eb30c0ac93e0938017e7cd4fce3e789d7af5b1cc8a69bfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release files / analysis_poly-0.1.11-py3-none-any.whl

Download URL analysis_poly-0.1.11-py3-none-any.whl
Size 737.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ba8d5365d81cc1e62260297988e6b49d0ded44487a5eff68fdc6104fac2f1bd
BLAKE2b-256 checksum
How to use checksums
1c5a5314b4b8572534c333ebc802c79c530a26db1bb54081983623f374077106
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.14

Release history Release notifications | RSS feed

This release

0.1.11 This release

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page