whalecli 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 (53) hide show
  1. whalecli-0.1.0/.github/workflows/ci.yml +100 -0
  2. whalecli-0.1.0/.github/workflows/publish.yml +47 -0
  3. whalecli-0.1.0/.gitignore +207 -0
  4. whalecli-0.1.0/LICENSE +21 -0
  5. whalecli-0.1.0/PKG-INFO +342 -0
  6. whalecli-0.1.0/PLANNER_REPORT.md +238 -0
  7. whalecli-0.1.0/README.md +281 -0
  8. whalecli-0.1.0/docs/API.md +910 -0
  9. whalecli-0.1.0/docs/ARCHITECTURE.md +462 -0
  10. whalecli-0.1.0/docs/MODULES.md +1087 -0
  11. whalecli-0.1.0/docs/ROADMAP.md +262 -0
  12. whalecli-0.1.0/docs/SKILL.md +547 -0
  13. whalecli-0.1.0/examples/agent_integration.py +96 -0
  14. whalecli-0.1.0/examples/basic_scan.py +40 -0
  15. whalecli-0.1.0/examples/stream_alerts.py +59 -0
  16. whalecli-0.1.0/pyproject.toml +146 -0
  17. whalecli-0.1.0/tests/conftest.py +254 -0
  18. whalecli-0.1.0/tests/test_alert.py +328 -0
  19. whalecli-0.1.0/tests/test_alert_coverage.py +165 -0
  20. whalecli-0.1.0/tests/test_cli.py +339 -0
  21. whalecli-0.1.0/tests/test_cli_coverage.py +383 -0
  22. whalecli-0.1.0/tests/test_config.py +189 -0
  23. whalecli-0.1.0/tests/test_db.py +390 -0
  24. whalecli-0.1.0/tests/test_db_coverage.py +236 -0
  25. whalecli-0.1.0/tests/test_exceptions.py +152 -0
  26. whalecli-0.1.0/tests/test_fetchers.py +393 -0
  27. whalecli-0.1.0/tests/test_fetchers_coverage.py +697 -0
  28. whalecli-0.1.0/tests/test_fetchers_factory.py +55 -0
  29. whalecli-0.1.0/tests/test_models.py +199 -0
  30. whalecli-0.1.0/tests/test_output.py +347 -0
  31. whalecli-0.1.0/tests/test_output_coverage.py +184 -0
  32. whalecli-0.1.0/tests/test_scorer.py +426 -0
  33. whalecli-0.1.0/tests/test_stream.py +270 -0
  34. whalecli-0.1.0/tests/test_stream_coverage.py +201 -0
  35. whalecli-0.1.0/uv.lock +699 -0
  36. whalecli-0.1.0/whalecli/__init__.py +5 -0
  37. whalecli-0.1.0/whalecli/alert.py +221 -0
  38. whalecli-0.1.0/whalecli/cli.py +964 -0
  39. whalecli-0.1.0/whalecli/config.py +278 -0
  40. whalecli-0.1.0/whalecli/data/exchange_addresses.json +70 -0
  41. whalecli-0.1.0/whalecli/db.py +751 -0
  42. whalecli-0.1.0/whalecli/exceptions.py +136 -0
  43. whalecli-0.1.0/whalecli/fetchers/__init__.py +106 -0
  44. whalecli-0.1.0/whalecli/fetchers/base.py +90 -0
  45. whalecli-0.1.0/whalecli/fetchers/btc.py +300 -0
  46. whalecli-0.1.0/whalecli/fetchers/eth.py +291 -0
  47. whalecli-0.1.0/whalecli/fetchers/hl.py +172 -0
  48. whalecli-0.1.0/whalecli/models.py +192 -0
  49. whalecli-0.1.0/whalecli/output.py +420 -0
  50. whalecli-0.1.0/whalecli/scorer.py +357 -0
  51. whalecli-0.1.0/whalecli/skill/__init__.py +5 -0
  52. whalecli-0.1.0/whalecli/skill/whalecli_skill.py +202 -0
  53. whalecli-0.1.0/whalecli/stream.py +254 -0
@@ -0,0 +1,100 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install uv
25
+ uses: astral-sh/setup-uv@v4
26
+
27
+ - name: Install dependencies
28
+ run: |
29
+ uv venv
30
+ uv pip install -e ".[dev]"
31
+
32
+ - name: Run tests
33
+ run: uv run pytest --cov=whalecli --cov-report=xml --cov-report=term-missing
34
+
35
+ - name: Check coverage
36
+ run: uv run coverage report --fail-under=90
37
+
38
+ - name: Upload coverage to Codecov
39
+ uses: codecov/codecov-action@v4
40
+ with:
41
+ file: ./coverage.xml
42
+ fail_ci_if_error: false
43
+
44
+ lint:
45
+ runs-on: ubuntu-latest
46
+
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Set up Python
51
+ uses: actions/setup-python@v5
52
+ with:
53
+ python-version: "3.11"
54
+
55
+ - name: Install uv
56
+ uses: astral-sh/setup-uv@v4
57
+
58
+ - name: Install dependencies
59
+ run: |
60
+ uv venv
61
+ uv pip install -e ".[dev]"
62
+
63
+ - name: Check formatting (black)
64
+ run: uv run black --check whalecli tests
65
+
66
+ - name: Check imports (ruff)
67
+ run: uv run ruff check --select I whalecli tests
68
+
69
+ - name: Lint (ruff)
70
+ run: uv run ruff check whalecli tests
71
+
72
+ - name: Type checking (mypy)
73
+ run: uv run mypy whalecli --ignore-missing-imports --no-error-summary
74
+ continue-on-error: true # TODO: fix bare dict types for strict mypy
75
+
76
+ build:
77
+ runs-on: ubuntu-latest
78
+ needs: [test, lint]
79
+
80
+ steps:
81
+ - uses: actions/checkout@v4
82
+
83
+ - name: Set up Python
84
+ uses: actions/setup-python@v5
85
+ with:
86
+ python-version: "3.11"
87
+
88
+ - name: Install uv
89
+ uses: astral-sh/setup-uv@v4
90
+
91
+ - name: Build package
92
+ run: |
93
+ uv venv
94
+ uv pip install build
95
+ uv run python -m build
96
+
97
+ - name: Check package
98
+ run: |
99
+ uv pip install twine
100
+ uv run twine check dist/*
@@ -0,0 +1,47 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ jobs:
9
+ publish:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ id-token: write
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.11"
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v4
24
+
25
+ - name: Install dependencies and run tests
26
+ run: |
27
+ uv venv
28
+ uv pip install -e ".[dev]"
29
+ uv run pytest --cov=whalecli --cov-report=term-missing
30
+
31
+ - name: Check coverage
32
+ run: uv run coverage report --fail-under=90
33
+
34
+ - name: Build package
35
+ run: |
36
+ uv pip install build
37
+ uv run python -m build
38
+
39
+ - name: Publish to PyPI
40
+ uses: pypa/gh-action-pypi-publish@release/v1
41
+ with:
42
+ password: ${{ secrets.PYPI_API_TOKEN }}
43
+
44
+ - name: Verify
45
+ run: |
46
+ echo "Published whalecli to PyPI!"
47
+ echo "Check https://pypi.org/project/whalecli/"
@@ -0,0 +1,207 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[codz]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py.cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+ #poetry.toml
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ # pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
114
+ # https://pdm-project.org/en/latest/usage/project/#working-with-version-control
115
+ #pdm.lock
116
+ #pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # pixi
121
+ # Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
122
+ #pixi.lock
123
+ # Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
124
+ # in the .venv directory. It is recommended not to include this directory in version control.
125
+ .pixi
126
+
127
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
128
+ __pypackages__/
129
+
130
+ # Celery stuff
131
+ celerybeat-schedule
132
+ celerybeat.pid
133
+
134
+ # SageMath parsed files
135
+ *.sage.py
136
+
137
+ # Environments
138
+ .env
139
+ .envrc
140
+ .venv
141
+ env/
142
+ venv/
143
+ ENV/
144
+ env.bak/
145
+ venv.bak/
146
+
147
+ # Spyder project settings
148
+ .spyderproject
149
+ .spyproject
150
+
151
+ # Rope project settings
152
+ .ropeproject
153
+
154
+ # mkdocs documentation
155
+ /site
156
+
157
+ # mypy
158
+ .mypy_cache/
159
+ .dmypy.json
160
+ dmypy.json
161
+
162
+ # Pyre type checker
163
+ .pyre/
164
+
165
+ # pytype static type analyzer
166
+ .pytype/
167
+
168
+ # Cython debug symbols
169
+ cython_debug/
170
+
171
+ # PyCharm
172
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
173
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
174
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
175
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
176
+ #.idea/
177
+
178
+ # Abstra
179
+ # Abstra is an AI-powered process automation framework.
180
+ # Ignore directories containing user credentials, local state, and settings.
181
+ # Learn more at https://abstra.io/docs
182
+ .abstra/
183
+
184
+ # Visual Studio Code
185
+ # Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
186
+ # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
187
+ # and can be added to the global gitignore or merged into this file. However, if you prefer,
188
+ # you could uncomment the following to ignore the entire vscode folder
189
+ # .vscode/
190
+
191
+ # Ruff stuff:
192
+ .ruff_cache/
193
+
194
+ # PyPI configuration file
195
+ .pypirc
196
+
197
+ # Cursor
198
+ # Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
199
+ # exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
200
+ # refer to https://docs.cursor.com/context/ignore-files
201
+ .cursorignore
202
+ .cursorindexingignore
203
+
204
+ # Marimo
205
+ marimo/_static/
206
+ marimo/_lsp/
207
+ __marimo__/
whalecli-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ClawInfra
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,342 @@
1
+ Metadata-Version: 2.4
2
+ Name: whalecli
3
+ Version: 0.1.0
4
+ Summary: Agent-native whale wallet tracker for ETH and BTC chains
5
+ Project-URL: Homepage, https://github.com/clawinfra/whalecli
6
+ Project-URL: Repository, https://github.com/clawinfra/whalecli
7
+ Project-URL: Issues, https://github.com/clawinfra/whalecli/issues
8
+ Project-URL: Documentation, https://github.com/clawinfra/whalecli/blob/main/README.md
9
+ Author-email: Alex Chen <alex.chen31337@gmail.com>
10
+ License: MIT License
11
+
12
+ Copyright (c) 2026 ClawInfra
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ License-File: LICENSE
32
+ Keywords: agent,bitcoin,blockchain,cli,crypto,ethereum,monitoring,on-chain,whale
33
+ Classifier: Development Status :: 3 - Alpha
34
+ Classifier: Environment :: Console
35
+ Classifier: Intended Audience :: Developers
36
+ Classifier: Intended Audience :: Financial and Insurance Industry
37
+ Classifier: License :: OSI Approved :: MIT License
38
+ Classifier: Programming Language :: Python :: 3
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Topic :: Internet :: WWW/HTTP
42
+ Classifier: Topic :: Office/Business :: Financial
43
+ Classifier: Typing :: Typed
44
+ Requires-Python: >=3.11
45
+ Requires-Dist: aiosqlite>=0.20
46
+ Requires-Dist: bech32>=1.2
47
+ Requires-Dist: click>=8.0
48
+ Requires-Dist: httpx>=0.27
49
+ Requires-Dist: rich>=13.0
50
+ Requires-Dist: toml>=0.10
51
+ Provides-Extra: dev
52
+ Requires-Dist: black>=24; extra == 'dev'
53
+ Requires-Dist: isort>=5.13; extra == 'dev'
54
+ Requires-Dist: mypy>=1.9; extra == 'dev'
55
+ Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
56
+ Requires-Dist: pytest-cov>=4; extra == 'dev'
57
+ Requires-Dist: pytest>=8; extra == 'dev'
58
+ Requires-Dist: respx>=0.21; extra == 'dev'
59
+ Requires-Dist: ruff>=0.4; extra == 'dev'
60
+ Description-Content-Type: text/markdown
61
+
62
+ # whalecli — Agent-Native Whale Wallet Tracker
63
+
64
+ **Track crypto whale movements. Close the loop.**
65
+
66
+ A CLI tool + OpenClaw agent skill for tracking whale wallet flows on ETH and BTC chains. Designed from the ground up for AI agents — all output is structured JSON/JSONL by default, exit codes are meaningful, and streaming is supported.
67
+
68
+ ## Why Agent-Native?
69
+
70
+ Most crypto CLI tools are designed for humans first — pretty tables, colorful output, parsed text that's hard for machines to consume. **whalecli** flips this: agents (EvoClaw, Claude, any A2A participant) can call it programmatically without UI scraping.
71
+
72
+ **The vision:** close the loop from on-chain signal → agent reasoning → prediction market bet (Simmer/Polymarket). When whales move, agents know — and can act.
73
+
74
+ ## Quick Install
75
+
76
+ ```bash
77
+ # From PyPI (when published)
78
+ uv pip install whalecli
79
+
80
+ # Development install
81
+ git clone https://github.com/clawinfra/whalecli.git
82
+ cd whalecli
83
+ uv pip install -e .
84
+ ```
85
+
86
+ ## Quick Start (5 Commands)
87
+
88
+ ```bash
89
+ # 1. Initialize config
90
+ whalecli config init
91
+
92
+ # 2. Add API keys
93
+ whalecli config set api.etherscan_api_key YOUR_KEY
94
+
95
+ # 3. Add whale wallets to track
96
+ whalecli wallet add 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --chain ETH --label "Binance Cold"
97
+
98
+ # 4. Scan for recent activity
99
+ whalecli scan --chain ETH --hours 24 --format json
100
+
101
+ # 5. Set up real-time alerts
102
+ whalecli alert set --score 75
103
+ ```
104
+
105
+ ## CLI Reference
106
+
107
+ ### Wallet Management
108
+
109
+ ```bash
110
+ # Add a whale wallet
111
+ whalecli wallet add <address> --chain ETH --label "Binance Cold"
112
+
113
+ # List all tracked wallets
114
+ whalecli wallet list
115
+
116
+ # Remove a wallet
117
+ whalecli wallet remove <address>
118
+
119
+ # Import wallets from CSV (columns: address, chain, label)
120
+ whalecli wallet import whales.csv
121
+ ```
122
+
123
+ ### Scanning
124
+
125
+ ```bash
126
+ # Scan all wallets on a chain
127
+ whalecli scan --chain ETH --hours 24 --format json
128
+
129
+ # Scan specific wallet
130
+ whalecli scan --wallet 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --hours 4 --format table
131
+
132
+ # Scan all wallets with score threshold
133
+ whalecli scan --all --threshold 70 --format jsonl
134
+
135
+ # Scan with custom alert window
136
+ whalecli scan --chain BTC --hours 12 --window 1h --format json
137
+ ```
138
+
139
+ ### Alerts
140
+
141
+ ```bash
142
+ # Alert on flow threshold (USD)
143
+ whalecli alert set --threshold 1000000 --window 1h
144
+
145
+ # Alert on whale score
146
+ whalecli alert set --score 75
147
+
148
+ # List active alerts
149
+ whalecli alert list
150
+
151
+ # Stream alerts continuously
152
+ whalecli stream --chain ETH --interval 60 --format jsonl
153
+ ```
154
+
155
+ ### Reporting
156
+
157
+ ```bash
158
+ # Generate wallet report
159
+ whalecli report --wallet 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045 --days 30 --format json
160
+
161
+ # Summary report across all wallets
162
+ whalecli report --summary --days 7
163
+
164
+ # CSV export
165
+ whalecli report --wallet <addr> --days 30 --format csv > flows.csv
166
+ ```
167
+
168
+ ### Configuration
169
+
170
+ ```bash
171
+ # Initialize config
172
+ whalecli config init
173
+
174
+ # Set config values
175
+ whalecli config set api.etherscan_api_key YOUR_KEY
176
+ whalecli config set alert_webhook https://hooks.example.com/whale
177
+
178
+ # Show current config
179
+ whalecli config show
180
+ ```
181
+
182
+ ## Agent Integration
183
+
184
+ ### How Agents Call whalecli
185
+
186
+ ```python
187
+ import subprocess
188
+ import json
189
+
190
+ # Scan for whale activity
191
+ result = subprocess.run(
192
+ ["whalecli", "scan", "--chain", "ETH", "--hours", "24", "--format", "json"],
193
+ capture_output=True,
194
+ text=True
195
+ )
196
+
197
+ if result.returncode == 0:
198
+ data = json.loads(result.stdout)
199
+ for wallet in data["wallets"]:
200
+ if wallet["score"] > 70:
201
+ # Trigger prediction market bet
202
+ place_bet(wallet["direction"])
203
+ ```
204
+
205
+ ### Parsing JSONL Streams
206
+
207
+ ```python
208
+ import json
209
+
210
+ # Streaming alerts
211
+ process = subprocess.Popen(
212
+ ["whalecli", "stream", "--chain", "ETH", "--interval", "60", "--format", "jsonl"],
213
+ stdout=subprocess.PIPE,
214
+ text=True
215
+ )
216
+
217
+ for line in process.stdout:
218
+ event = json.loads(line)
219
+ if event["type"] == "whale_alert":
220
+ handle_whale_movement(event)
221
+ ```
222
+
223
+ ### Exit Codes
224
+
225
+ - `0` — Success
226
+ - `1` — CLI error (invalid args, file not found)
227
+ - `2` — API error (rate limit, invalid key)
228
+ - `3` — Network error (timeout, connection failed)
229
+ - `4` — Data error (invalid address, no transactions found)
230
+
231
+ Agents can use exit codes for conditional logic:
232
+
233
+ ```bash
234
+ whalecli scan --chain ETH --hours 24
235
+ if [ $? -eq 0 ]; then
236
+ # Process results
237
+ fi
238
+ ```
239
+
240
+ ## Data Sources
241
+
242
+ ### Ethereum (ETH)
243
+ - **Etherscan API** — Transaction history, token transfers, internal txns
244
+ - **Rate limits:** 5 calls/sec (free tier)
245
+ - **Required:** `etherscan_api_key` in config
246
+
247
+ ### Bitcoin (BTC)
248
+ - **Mempool.space API** — Mempool transactions, fee estimates
249
+ - **Blockchain.info** — Historical transaction data
250
+ - **No API key required**
251
+
252
+ ### Hyperliquid (HL)
253
+ - **Hyperliquid API** — Perpetual futures flows
254
+ - **No API key required**
255
+
256
+ ## Configuration
257
+
258
+ Config file: `~/.whalecli/config.toml`
259
+
260
+ ```toml
261
+ [api]
262
+ etherscan_api_key = "YOUR_KEY"
263
+ blockchain_info_api_key = "" # Optional
264
+
265
+ [alert]
266
+ score_threshold = 70
267
+ flow_threshold_usd = 1000000
268
+ window_minutes = 60
269
+ webhook_url = "https://hooks.example.com/whale"
270
+
271
+ [database]
272
+ path = "~/.whalecli/whale.db"
273
+ cache_ttl_hours = 24
274
+
275
+ [output]
276
+ default_format = "json"
277
+ timezone = "UTC"
278
+ ```
279
+
280
+ ## Output Formats
281
+
282
+ ### JSON (default)
283
+ ```json
284
+ {
285
+ "wallets": [
286
+ {
287
+ "address": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045",
288
+ "chain": "ETH",
289
+ "label": "Binance Cold",
290
+ "score": 85,
291
+ "net_flow_usd": 15000000,
292
+ "tx_count": 42,
293
+ "last_activity": "2026-02-22T09:44:00Z"
294
+ }
295
+ ],
296
+ "scan_time": "2026-02-22T09:44:00Z"
297
+ }
298
+ ```
299
+
300
+ ### JSONL (streaming)
301
+ ```json
302
+ {"type": "scan_start", "timestamp": "2026-02-22T09:44:00Z"}
303
+ {"type": "wallet_scan", "address": "0x...", "score": 85}
304
+ {"type": "scan_end", "wallets_scanned": 10, "alerts_triggered": 3}
305
+ ```
306
+
307
+ ### Table (human-readable)
308
+ ```
309
+ ┌─────────────────────┬──────┬──────────────┬───────┬──────────────┬─────────────────────┐
310
+ │ Address │ Chain│ Label │ Score │ Net Flow (USD)│ Last Activity │
311
+ ├─────────────────────┼──────┼──────────────┼───────┼──────────────┼─────────────────────┤
312
+ │ 0xd8dA...96045 │ ETH │ Binance Cold │ 85 │ +15,000,000 │ 2026-02-22 09:44:00 │
313
+ └─────────────────────┴──────┴──────────────┴───────┴──────────────┴─────────────────────┘
314
+ ```
315
+
316
+ ## Contributing
317
+
318
+ See `docs/ARCHITECTURE.md` for system design and `docs/MODULES.md` for code structure.
319
+
320
+ **Development setup:**
321
+ ```bash
322
+ git clone git@github-alexchen:clawinfra/whalecli.git
323
+ cd whalecli
324
+ uv pip install -e ".[dev]"
325
+ pytest
326
+ ```
327
+
328
+ **ClawInfra standards:**
329
+ - Documentation first (this repo)
330
+ - Test-driven development (coverage ≥ 90%)
331
+ - Type-safe (full type annotations)
332
+ - CI must be green before merge
333
+
334
+ ## License
335
+
336
+ MIT License — see `LICENSE` file.
337
+
338
+ ## Links
339
+
340
+ - GitHub: https://github.com/clawinfra/whalecli
341
+ - Docs: `docs/` directory
342
+ - Issues: https://github.com/clawinfra/whalecli/issues