analysis-poly 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. analysis_poly-0.1.0/PKG-INFO +107 -0
  2. analysis_poly-0.1.0/README.md +91 -0
  3. analysis_poly-0.1.0/analysis_poly/__init__.py +3 -0
  4. analysis_poly-0.1.0/analysis_poly/analyzer.py +587 -0
  5. analysis_poly-0.1.0/analysis_poly/cli.py +28 -0
  6. analysis_poly-0.1.0/analysis_poly/logging_config.py +29 -0
  7. analysis_poly-0.1.0/analysis_poly/main.py +27 -0
  8. analysis_poly-0.1.0/analysis_poly/market_cache.py +133 -0
  9. analysis_poly-0.1.0/analysis_poly/market_result_cache.py +52 -0
  10. analysis_poly-0.1.0/analysis_poly/models.py +183 -0
  11. analysis_poly-0.1.0/analysis_poly/open_with_params.py +143 -0
  12. analysis_poly-0.1.0/analysis_poly/polymarket_client.py +141 -0
  13. analysis_poly-0.1.0/analysis_poly/profit_engine.py +417 -0
  14. analysis_poly-0.1.0/analysis_poly/run_manager.py +289 -0
  15. analysis_poly-0.1.0/analysis_poly/slugs.py +31 -0
  16. analysis_poly-0.1.0/analysis_poly/static/dist/app.css +1 -0
  17. analysis_poly-0.1.0/analysis_poly/static/dist/app.js +485 -0
  18. analysis_poly-0.1.0/analysis_poly/templates/index.html +17 -0
  19. analysis_poly-0.1.0/analysis_poly/web.py +74 -0
  20. analysis_poly-0.1.0/analysis_poly.egg-info/PKG-INFO +107 -0
  21. analysis_poly-0.1.0/analysis_poly.egg-info/SOURCES.txt +35 -0
  22. analysis_poly-0.1.0/analysis_poly.egg-info/dependency_links.txt +1 -0
  23. analysis_poly-0.1.0/analysis_poly.egg-info/entry_points.txt +3 -0
  24. analysis_poly-0.1.0/analysis_poly.egg-info/requires.txt +10 -0
  25. analysis_poly-0.1.0/analysis_poly.egg-info/top_level.txt +1 -0
  26. analysis_poly-0.1.0/pyproject.toml +50 -0
  27. analysis_poly-0.1.0/setup.cfg +4 -0
  28. analysis_poly-0.1.0/tests/test_analyzer_chunking.py +40 -0
  29. analysis_poly-0.1.0/tests/test_analyzer_filter_empty_market.py +30 -0
  30. analysis_poly-0.1.0/tests/test_analyzer_market_cache.py +66 -0
  31. analysis_poly-0.1.0/tests/test_market_cache.py +81 -0
  32. analysis_poly-0.1.0/tests/test_market_result_cache.py +30 -0
  33. analysis_poly-0.1.0/tests/test_models_defaults.py +36 -0
  34. analysis_poly-0.1.0/tests/test_open_with_params.py +58 -0
  35. analysis_poly-0.1.0/tests/test_profit_engine.py +173 -0
  36. analysis_poly-0.1.0/tests/test_run_manager.py +75 -0
  37. analysis_poly-0.1.0/tests/test_slugs.py +15 -0
@@ -0,0 +1,107 @@
1
+ Metadata-Version: 2.4
2
+ Name: analysis-poly
3
+ Version: 0.1.0
4
+ Summary: Polymarket real-profit web analyzer
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ Requires-Dist: fastapi>=0.115.0
8
+ Requires-Dist: httpx>=0.28.1
9
+ Requires-Dist: jinja2>=3.1.6
10
+ Requires-Dist: loguru>=0.7.3
11
+ Requires-Dist: pydantic>=2.11.0
12
+ Requires-Dist: uvicorn>=0.35.0
13
+ Provides-Extra: dev
14
+ Requires-Dist: pytest>=8.3.4; extra == "dev"
15
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
16
+
17
+ # analysis-poly
18
+
19
+ **Real Profit (Fee-Excluded View)**
20
+
21
+ ![PnL](assets/pnl.png)
22
+ ![Ratio](assets/ratio.png)
23
+
24
+ 中文说明见:[README_zh.md](README_zh.md)
25
+
26
+ Polymarket real-profit analyzer with a web UI.
27
+
28
+ ## Scope (Important)
29
+
30
+ - This tool is primarily designed for Polymarket crypto `updown` markets with taker fees, especially `5m` and `15m` intervals.
31
+ - It is **not** intended as a universal PnL engine for all Polymarket market types.
32
+ - Main purpose: quantify and visualize the impact of trading fees on real profitability (`Net PnL` vs `No-Fee PnL`).
33
+
34
+ ## Requirements
35
+
36
+ - Python `3.11+` (recommended: `3.11`)
37
+ - `uv` package manager
38
+
39
+ ## Install As Package
40
+
41
+ ```bash
42
+ uv pip install .
43
+ # or
44
+ pip install .
45
+ ```
46
+
47
+ After install:
48
+
49
+ ```bash
50
+ analysis-poly
51
+ analysis-poly-open --address 0xabc --symbols btc,eth --intervals 5,15
52
+ ```
53
+
54
+ ## Run
55
+
56
+ ```bash
57
+ uv sync
58
+ uv run python main.py
59
+ ```
60
+
61
+ Open [http://localhost:8000](http://localhost:8000).
62
+
63
+ ## CLI Open + Auto Start
64
+
65
+ Use a standalone script to start server, open browser, and pass params in URL.
66
+
67
+ ```bash
68
+ uv run -m analysis_poly.open_with_params \
69
+ --address 0xabc \
70
+ --symbols btc,eth \
71
+ --intervals 5,15 \
72
+ --start-time "2026-03-01 00:00" \
73
+ --end-time "2026-03-02 00:00" \
74
+ --concurrency 8
75
+ ```
76
+
77
+ Frontend will read query params, fill form fields, and auto start the run.
78
+
79
+ ## First Clone
80
+
81
+ `analysis_poly/static/dist` is committed in the repository, so first startup does not require front-end build.
82
+
83
+ If you modify `frontend/src`, rebuild assets:
84
+
85
+ ```bash
86
+ npm install
87
+ npm run build
88
+ ```
89
+
90
+ ## API
91
+
92
+ - `POST /api/runs`
93
+ - `GET /api/runs/{run_id}/stream` (SSE)
94
+ - `POST /api/runs/{run_id}/stop`
95
+ - `GET /api/runs/{run_id}/result`
96
+ - `GET /api/runs/{run_id}/state`
97
+
98
+ ## Test
99
+
100
+ ```bash
101
+ uv run pytest
102
+ ```
103
+
104
+ ## Frontend
105
+
106
+ - Source: `frontend/src`
107
+ - Build output: `analysis_poly/static/dist/app.js` and `analysis_poly/static/dist/app.css`
@@ -0,0 +1,91 @@
1
+ # analysis-poly
2
+
3
+ **Real Profit (Fee-Excluded View)**
4
+
5
+ ![PnL](assets/pnl.png)
6
+ ![Ratio](assets/ratio.png)
7
+
8
+ 中文说明见:[README_zh.md](README_zh.md)
9
+
10
+ Polymarket real-profit analyzer with a web UI.
11
+
12
+ ## Scope (Important)
13
+
14
+ - This tool is primarily designed for Polymarket crypto `updown` markets with taker fees, especially `5m` and `15m` intervals.
15
+ - It is **not** intended as a universal PnL engine for all Polymarket market types.
16
+ - Main purpose: quantify and visualize the impact of trading fees on real profitability (`Net PnL` vs `No-Fee PnL`).
17
+
18
+ ## Requirements
19
+
20
+ - Python `3.11+` (recommended: `3.11`)
21
+ - `uv` package manager
22
+
23
+ ## Install As Package
24
+
25
+ ```bash
26
+ uv pip install .
27
+ # or
28
+ pip install .
29
+ ```
30
+
31
+ After install:
32
+
33
+ ```bash
34
+ analysis-poly
35
+ analysis-poly-open --address 0xabc --symbols btc,eth --intervals 5,15
36
+ ```
37
+
38
+ ## Run
39
+
40
+ ```bash
41
+ uv sync
42
+ uv run python main.py
43
+ ```
44
+
45
+ Open [http://localhost:8000](http://localhost:8000).
46
+
47
+ ## CLI Open + Auto Start
48
+
49
+ Use a standalone script to start server, open browser, and pass params in URL.
50
+
51
+ ```bash
52
+ uv run -m analysis_poly.open_with_params \
53
+ --address 0xabc \
54
+ --symbols btc,eth \
55
+ --intervals 5,15 \
56
+ --start-time "2026-03-01 00:00" \
57
+ --end-time "2026-03-02 00:00" \
58
+ --concurrency 8
59
+ ```
60
+
61
+ Frontend will read query params, fill form fields, and auto start the run.
62
+
63
+ ## First Clone
64
+
65
+ `analysis_poly/static/dist` is committed in the repository, so first startup does not require front-end build.
66
+
67
+ If you modify `frontend/src`, rebuild assets:
68
+
69
+ ```bash
70
+ npm install
71
+ npm run build
72
+ ```
73
+
74
+ ## API
75
+
76
+ - `POST /api/runs`
77
+ - `GET /api/runs/{run_id}/stream` (SSE)
78
+ - `POST /api/runs/{run_id}/stop`
79
+ - `GET /api/runs/{run_id}/result`
80
+ - `GET /api/runs/{run_id}/state`
81
+
82
+ ## Test
83
+
84
+ ```bash
85
+ uv run pytest
86
+ ```
87
+
88
+ ## Frontend
89
+
90
+ - Source: `frontend/src`
91
+ - Build output: `analysis_poly/static/dist/app.js` and `analysis_poly/static/dist/app.css`
@@ -0,0 +1,3 @@
1
+ from .web import app
2
+
3
+ __all__ = ["app"]