dexscraper 0.1.1.dev0__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 (42) hide show
  1. dexscraper-0.1.1.dev0/.github/FUNDING.yml +4 -0
  2. dexscraper-0.1.1.dev0/.github/workflows/ci.yml +98 -0
  3. dexscraper-0.1.1.dev0/.github/workflows/release.yml +168 -0
  4. dexscraper-0.1.1.dev0/.gitignore +170 -0
  5. dexscraper-0.1.1.dev0/.pre-commit-config.yaml +49 -0
  6. dexscraper-0.1.1.dev0/.python-version +1 -0
  7. dexscraper-0.1.1.dev0/CLAUDE.md +180 -0
  8. dexscraper-0.1.1.dev0/CONTRIBUTING.md +322 -0
  9. dexscraper-0.1.1.dev0/LICENSE +674 -0
  10. dexscraper-0.1.1.dev0/Makefile +155 -0
  11. dexscraper-0.1.1.dev0/PKG-INFO +369 -0
  12. dexscraper-0.1.1.dev0/README.md +329 -0
  13. dexscraper-0.1.1.dev0/dex.py +59 -0
  14. dexscraper-0.1.1.dev0/dexscraper/__init__.py +44 -0
  15. dexscraper-0.1.1.dev0/dexscraper/_version.py +34 -0
  16. dexscraper-0.1.1.dev0/dexscraper/cli.py +992 -0
  17. dexscraper-0.1.1.dev0/dexscraper/cloudflare_bypass.py +88 -0
  18. dexscraper-0.1.1.dev0/dexscraper/config.py +370 -0
  19. dexscraper-0.1.1.dev0/dexscraper/enhanced_protocol.py +299 -0
  20. dexscraper-0.1.1.dev0/dexscraper/logger.py +228 -0
  21. dexscraper-0.1.1.dev0/dexscraper/models.py +722 -0
  22. dexscraper-0.1.1.dev0/dexscraper/protocol.py +428 -0
  23. dexscraper-0.1.1.dev0/dexscraper/scraper.py +1343 -0
  24. dexscraper-0.1.1.dev0/dexscraper/utils.py +503 -0
  25. dexscraper-0.1.1.dev0/dexscraper.egg-info/PKG-INFO +369 -0
  26. dexscraper-0.1.1.dev0/dexscraper.egg-info/SOURCES.txt +41 -0
  27. dexscraper-0.1.1.dev0/dexscraper.egg-info/dependency_links.txt +1 -0
  28. dexscraper-0.1.1.dev0/dexscraper.egg-info/entry_points.txt +2 -0
  29. dexscraper-0.1.1.dev0/dexscraper.egg-info/requires.txt +14 -0
  30. dexscraper-0.1.1.dev0/dexscraper.egg-info/top_level.txt +1 -0
  31. dexscraper-0.1.1.dev0/pyproject.toml +178 -0
  32. dexscraper-0.1.1.dev0/requirements.txt +1 -0
  33. dexscraper-0.1.1.dev0/setup.cfg +22 -0
  34. dexscraper-0.1.1.dev0/tests/__init__.py +1 -0
  35. dexscraper-0.1.1.dev0/tests/conftest.py +45 -0
  36. dexscraper-0.1.1.dev0/tests/test_cli.py +363 -0
  37. dexscraper-0.1.1.dev0/tests/test_config.py +242 -0
  38. dexscraper-0.1.1.dev0/tests/test_decode_pair.py +33 -0
  39. dexscraper-0.1.1.dev0/tests/test_edge_cases.py +399 -0
  40. dexscraper-0.1.1.dev0/tests/test_enhanced_ohlc.py +247 -0
  41. dexscraper-0.1.1.dev0/tests/test_models.py +243 -0
  42. dexscraper-0.1.1.dev0/tests/test_scraper.py +294 -0
@@ -0,0 +1,4 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: vincentkoc
4
+ buy_me_a_coffee: vincentkoc
@@ -0,0 +1,98 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [ main, develop ]
6
+ pull_request:
7
+ branches: [ main ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.9", "3.10", "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 dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install build pytest pytest-cov pytest-asyncio
28
+ pip install -e .[dev]
29
+
30
+ - name: Run pre-commit hooks
31
+ run: |
32
+ pre-commit run --all-files
33
+
34
+ - name: Test with pytest
35
+ run: |
36
+ pytest tests/ -v --cov=dexscraper --cov-report=xml --cov-report=term-missing
37
+
38
+ - name: Upload coverage to Codecov
39
+ uses: codecov/codecov-action@v4
40
+ with:
41
+ file: ./coverage.xml
42
+ flags: unittests
43
+ name: codecov-umbrella
44
+ fail_ci_if_error: false
45
+
46
+ security:
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Set up Python
52
+ uses: actions/setup-python@v5
53
+ with:
54
+ python-version: '3.11'
55
+
56
+ - name: Install dependencies
57
+ run: |
58
+ python -m pip install --upgrade pip
59
+ pip install bandit safety
60
+ pip install -e .
61
+
62
+ - name: Security check with bandit
63
+ run: |
64
+ bandit -r dexscraper/
65
+
66
+ - name: Safety check
67
+ run: |
68
+ safety check
69
+
70
+ build:
71
+ runs-on: ubuntu-latest
72
+ needs: [test, security]
73
+ steps:
74
+ - uses: actions/checkout@v4
75
+ with:
76
+ fetch-depth: 0
77
+
78
+ - name: Set up Python
79
+ uses: actions/setup-python@v5
80
+ with:
81
+ python-version: '3.11'
82
+
83
+ - name: Install dependencies
84
+ run: |
85
+ python -m pip install --upgrade pip
86
+ pip install build twine
87
+
88
+ - name: Build package
89
+ run: python -m build
90
+
91
+ - name: Check package
92
+ run: python -m twine check dist/*
93
+
94
+ - name: Upload build artifacts
95
+ uses: actions/upload-artifact@v4
96
+ with:
97
+ name: dist
98
+ path: dist/
@@ -0,0 +1,168 @@
1
+ ---
2
+ # yamllint disable rule:line-length
3
+ name: Release
4
+
5
+ 'on':
6
+ push:
7
+ tags:
8
+ - 'v*.*.*'
9
+
10
+ permissions:
11
+ contents: write
12
+ discussions: write
13
+ id-token: write # IMPORTANT: Required for PyPI trusted publishing
14
+
15
+ jobs:
16
+ release:
17
+ name: Create Release & Deploy to PyPI
18
+ runs-on: ubuntu-latest
19
+ environment: release
20
+
21
+ steps:
22
+ - name: Checkout code
23
+ uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+ ref: ${{ github.ref }}
27
+
28
+ - name: Verify tag format
29
+ run: |
30
+ if [[ ! "${{ github.ref_name }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
31
+ echo "❌ Invalid tag format. Expected: v1.2.3"
32
+ exit 1
33
+ fi
34
+ echo "✅ Tag format is valid: ${{ github.ref_name }}"
35
+
36
+ - name: Verify we're on the exact tag commit
37
+ run: |
38
+ echo "Current commit: $(git rev-parse HEAD)"
39
+ echo "Tag commit: $(git rev-parse ${{ github.ref_name }})"
40
+ if [[ "$(git rev-parse HEAD)" != "$(git rev-parse ${{ github.ref_name }})" ]]; then
41
+ echo "❌ Not on tag commit!"
42
+ exit 1
43
+ fi
44
+ echo "✅ On exact tag commit"
45
+
46
+ - name: Set up Python
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: '3.11'
50
+
51
+ - name: Install build dependencies
52
+ run: |
53
+ python -m pip install --upgrade pip
54
+ pip install build twine
55
+
56
+ - name: Generate changelog
57
+ id: changelog
58
+ run: |
59
+ echo "🔍 Generating changelog..."
60
+ # Get the previous tag
61
+ PREV_TAG=$(git describe --tags --abbrev=0 ${{ github.ref_name }}^ 2>/dev/null || echo "")
62
+
63
+ if [ -z "$PREV_TAG" ]; then
64
+ echo "changelog=🎉 Initial release of DexScraper Python package!" >> $GITHUB_OUTPUT
65
+ else
66
+ echo "changelog<<EOF" >> $GITHUB_OUTPUT
67
+ echo "Changes since ${PREV_TAG}:" >> $GITHUB_OUTPUT
68
+ echo "" >> $GITHUB_OUTPUT
69
+ git log --pretty=format:"* %s (%h)" ${PREV_TAG}..${{ github.ref_name }} >> $GITHUB_OUTPUT
70
+ echo "" >> $GITHUB_OUTPUT
71
+ echo "EOF" >> $GITHUB_OUTPUT
72
+ fi
73
+
74
+ - name: Build package
75
+ run: |
76
+ echo "🔨 Building Python package..."
77
+ python -m build
78
+
79
+ echo "📦 Package contents:"
80
+ ls -la dist/
81
+
82
+ echo "✅ Checking package integrity..."
83
+ python -m twine check dist/*
84
+
85
+ - name: Deploy to PyPI
86
+ uses: pypa/gh-action-pypi-publish@release/v1
87
+ with:
88
+ # Trusted publishing - no password/token needed!
89
+ verbose: true
90
+ print-hash: true
91
+
92
+ - name: Create GitHub Release
93
+ uses: softprops/action-gh-release@v2
94
+ with:
95
+ name: "🚀 DexScraper ${{ github.ref_name }}"
96
+ body: |
97
+ ## 👻 DexScraper Release ${{ github.ref_name }}
98
+
99
+ > ⚠️ **RESEARCH & EDUCATIONAL PURPOSE ONLY** ⚠️
100
+ > This project has **NO AFFILIATION** with DexScreener. Use at your own risk.
101
+
102
+ ### 🎉 What's New
103
+
104
+ ${{ steps.changelog.outputs.changelog }}
105
+
106
+ ### 📦 Installation
107
+
108
+ #### From PyPI (Recommended)
109
+ ```bash
110
+ pip install dexscraper==${{ github.ref_name }}
111
+ ```
112
+
113
+ #### Quick Start
114
+ ```bash
115
+ # Interactive mode with Rich UI
116
+ dexscraper interactive
117
+
118
+ # Simple trending pairs
119
+ dexscraper trending --chain solana --limit 10
120
+
121
+ # Export to file
122
+ dexscraper trending --output data.json --format json
123
+ ```
124
+
125
+ #### Python API
126
+ ```python
127
+ import asyncio
128
+ from dexscraper import DexScraper, Chain
129
+
130
+ async def main():
131
+ scraper = DexScraper()
132
+ batch = await scraper.extract_token_data()
133
+ print(f"Found {len(batch.tokens)} tokens!")
134
+
135
+ asyncio.run(main())
136
+ ```
137
+
138
+ ### ✨ Key Features
139
+
140
+ - 🔗 **Multi-chain support**: Solana, Ethereum, Base, BSC, Polygon, Arbitrum, Optimism
141
+ - 📊 **Rich CLI**: Interactive terminal interface with live updates
142
+ - 📈 **Multiple formats**: JSON, CSV, OHLC, MetaTrader-compatible
143
+ - 🛡️ **Enterprise-ready**: Rate limiting, error recovery, Cloudflare bypass
144
+ - 🔬 **Research focused**: Perfect for academic and educational use
145
+
146
+ ### 🔗 Links
147
+
148
+ - 📖 **Documentation**: [README.md](https://github.com/vincentkoc/dexscraper/blob/main/README.md)
149
+ - 🤝 **Contributing**: [CONTRIBUTING.md](https://github.com/vincentkoc/dexscraper/blob/main/CONTRIBUTING.md)
150
+ - 🐛 **Issues**: [GitHub Issues](https://github.com/vincentkoc/dexscraper/issues)
151
+ - ☕ **Support**: [Buy me a coffee](https://buymeacoffee.com/vincentkoc)
152
+
153
+ ### 🔬 Research & Educational Use Only
154
+
155
+ This software is provided for research and educational purposes only. It has no affiliation with DexScreener and should not be used for trading decisions. Always verify data independently and understand the risks of cryptocurrency markets.
156
+
157
+ files: |
158
+ dist/*
159
+ draft: false
160
+ prerelease: ${{ contains(github.ref_name, 'beta') || contains(github.ref_name, 'alpha') || contains(github.ref_name, 'rc') }}
161
+ generate_release_notes: false
162
+
163
+ - name: Post-release verification
164
+ run: |
165
+ echo "🎉 Release ${{ github.ref_name }} completed successfully!"
166
+ echo "📦 PyPI: https://pypi.org/project/dexscraper/${{ github.ref_name }}/"
167
+ echo "🚀 GitHub: https://github.com/vincentkoc/dexscraper/releases/tag/${{ github.ref_name }}"
168
+ echo "💡 Install with: pip install dexscraper==${{ github.ref_name }}"
@@ -0,0 +1,170 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
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
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
110
+ .pdm.toml
111
+ .pdm-python
112
+ .pdm-build/
113
+
114
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
115
+ __pypackages__/
116
+
117
+ # Celery stuff
118
+ celerybeat-schedule
119
+ celerybeat.pid
120
+
121
+ # SageMath parsed files
122
+ *.sage.py
123
+
124
+ # Environments
125
+ .env
126
+ .venv
127
+ env/
128
+ venv/
129
+ ENV/
130
+ env.bak/
131
+ venv.bak/
132
+
133
+ # Spyder project settings
134
+ .spyderproject
135
+ .spyproject
136
+
137
+ # Rope project settings
138
+ .ropeproject
139
+
140
+ # mkdocs documentation
141
+ /site
142
+
143
+ # mypy
144
+ .mypy_cache/
145
+ .dmypy.json
146
+ dmypy.json
147
+
148
+ # Pyre type checker
149
+ .pyre/
150
+
151
+ # pytype static type analyzer
152
+ .pytype/
153
+
154
+ # Cython debug symbols
155
+ cython_debug/
156
+
157
+ # PyCharm
158
+ .idea/
159
+
160
+ # VSCode
161
+ .vscode/
162
+
163
+ # macOS
164
+ .DS_Store
165
+
166
+ # Project specific
167
+ *.log
168
+ data/
169
+ output/
170
+ *.json
@@ -0,0 +1,49 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v6.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: end-of-file-fixer
7
+ - id: check-yaml
8
+ - id: check-added-large-files
9
+ - id: check-merge-conflict
10
+ - id: debug-statements
11
+
12
+ - repo: https://github.com/psf/black
13
+ rev: 25.1.0
14
+ hooks:
15
+ - id: black
16
+ language_version: python3
17
+ args: [--line-length=88]
18
+ exclude: 'dexscraper/_version\.py'
19
+
20
+ - repo: https://github.com/PyCQA/isort
21
+ rev: 6.0.1
22
+ hooks:
23
+ - id: isort
24
+ args: [--profile, black, --line-length=88]
25
+ exclude: 'dexscraper/_version\.py'
26
+
27
+ - repo: https://github.com/PyCQA/flake8
28
+ rev: 7.3.0
29
+ hooks:
30
+ - id: flake8
31
+ args: [--config=setup.cfg]
32
+ exclude: 'dexscraper/_version\.py'
33
+
34
+ # Temporarily disabled mypy to focus on core functionality
35
+ # - repo: https://github.com/pre-commit/mirrors-mypy
36
+ # rev: v1.17.1
37
+ # hooks:
38
+ # - id: mypy
39
+ # additional_dependencies: [types-requests]
40
+ # args: [--ignore-missing-imports, --no-strict-optional]
41
+ # exclude: '^(tests/|dexscraper/_version\.py)'
42
+
43
+ - repo: https://github.com/PyCQA/bandit
44
+ rev: 1.8.6
45
+ hooks:
46
+ - id: bandit
47
+ args: [-c, pyproject.toml]
48
+ additional_dependencies: ["bandit[toml]"]
49
+ exclude: '^(tests/|dexscraper/_version\.py)'
@@ -0,0 +1 @@
1
+ 3.9
@@ -0,0 +1,180 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is a comprehensive Python package for real-time cryptocurrency trading data from DexScreener's WebSocket API. The project has evolved from a single-file script into a full-featured package with multi-chain support, rich CLI interface, and enterprise-ready architecture supporting multiple blockchain networks including Solana, Ethereum, Base, BSC, and more.
8
+
9
+ ## Commands
10
+
11
+ ### Package Installation
12
+ ```bash
13
+ pip install -e .[dev] # Development install with all dependencies
14
+ pip install dexscraper # PyPI installation (when published)
15
+ ```
16
+
17
+ ### Running the Application
18
+ ```bash
19
+ # CLI interface
20
+ dexscraper interactive # Rich interactive mode
21
+ dexscraper trending --chain solana --limit 10 # Simple trending pairs
22
+
23
+ # Legacy compatibility
24
+ python dex.py # Still works, calls new package
25
+ ```
26
+
27
+ ### Testing
28
+ ```bash
29
+ pytest tests/ -v # Run all tests
30
+ pytest tests/ -v --cov=dexscraper --cov-report=html # With coverage
31
+ pytest -m integration # Integration tests only
32
+ pytest -m "not slow" # Skip slow tests
33
+ ```
34
+
35
+ ### Code Quality
36
+ ```bash
37
+ black dexscraper/ tests/ # Format code
38
+ isort dexscraper/ tests/ # Sort imports
39
+ flake8 dexscraper/ # Lint code
40
+ mypy dexscraper/ # Type check
41
+ pre-commit run --all-files # Run all pre-commit hooks
42
+ ```
43
+
44
+ ### Security
45
+ ```bash
46
+ bandit -r dexscraper/ # Security scan
47
+ safety check # Dependency vulnerability scan
48
+ ```
49
+
50
+ ## Architecture
51
+
52
+ ### Package Structure
53
+ ```
54
+ dexscraper/
55
+ ├── __init__.py # Package exports and version
56
+ ├── scraper.py # Main DexScraper class
57
+ ├── config.py # Configuration classes and enums
58
+ ├── models.py # Data models (TradingPair, TokenProfile, etc.)
59
+ ├── protocol.py # Binary protocol decoder (legacy)
60
+ ├── enhanced_protocol.py # Enhanced protocol with OHLC support
61
+ ├── cloudflare_bypass.py # Cloudflare bypass utilities
62
+ ├── cli.py # Rich-based CLI interface
63
+ ├── logger.py # Logging configuration
64
+ ├── utils.py # Utility functions
65
+ └── _version.py # Auto-generated version (setuptools-scm)
66
+ ```
67
+
68
+ ### Core Components
69
+
70
+ **DexScraper Class (`scraper.py`)**:
71
+ - Multi-chain WebSocket management with automatic reconnection
72
+ - Configurable rate limiting and retry logic
73
+ - Binary protocol decoder for DexScreener's proprietary format
74
+ - Support for streaming and batch processing
75
+ - Optional Cloudflare bypass integration
76
+
77
+ **Configuration System (`config.py`)**:
78
+ - `ScrapingConfig`: Main configuration class with validation
79
+ - `PresetConfigs`: Ready-to-use configurations for common scenarios
80
+ - Enums for `Chain`, `Timeframe`, `RankBy`, `Order`, `DEX`
81
+ - `Filters` class for advanced filtering options
82
+
83
+ **Data Models (`models.py`)**:
84
+ - `TradingPair`: Complete trading pair information
85
+ - `TokenProfile`: Enhanced token metadata with social links
86
+ - `OHLCData`: MetaTrader-compatible candlestick data
87
+ - `ExtractedTokenBatch`: Batch processing results
88
+ - Export methods for JSON, CSV, and custom formats
89
+
90
+ **CLI Interface (`cli.py`)**:
91
+ - Rich-based interactive terminal interface
92
+ - Real-time data visualization with tables and progress bars
93
+ - Export functionality to multiple formats
94
+ - Configuration prompts and validation
95
+
96
+ **Key Functions**:
97
+ - `DexScraper.get_pairs()`: Batch pair retrieval
98
+ - `DexScraper.stream_pairs()`: Real-time streaming
99
+ - `decode_pair()`: Binary decoder for individual trading pairs
100
+ - `decode_enhanced_ohlc()`: OHLC data extraction
101
+ - `clean_string()`: String sanitization
102
+ - `CloudflareBypass.get_session()`: Bypass utilities
103
+
104
+ ### Data Flow
105
+ 1. **Configuration**: ScrapingConfig defines chains, filters, and ranking options
106
+ 2. **Connection**: WebSocket connects with configurable parameters for any supported chain
107
+ 3. **Protocol Handling**: Binary messages validated and decoded using enhanced protocol
108
+ 4. **Data Processing**: Messages parsed in chunks with support for different data types:
109
+ - Standard trading pairs (512-byte chunks)
110
+ - OHLC data (candlestick format)
111
+ - Token profiles (metadata)
112
+ 5. **Output**: Clean, validated data in multiple formats (JSON, CSV, MetaTrader)
113
+ 6. **Streaming**: Real-time updates via async generators or batch processing
114
+
115
+ ### Binary Protocol Details
116
+ - **Message Types**: Support for multiple message formats (pairs, OHLC, profiles)
117
+ - **String Fields**: Length-prefixed (1-2 bytes length + UTF-8 data)
118
+ - **Numeric Data**: Packed as consecutive doubles with 8-byte alignment
119
+ - **Enhanced Protocol**: Additional support for:
120
+ - OHLC candlestick data
121
+ - Token profile metadata
122
+ - Social media links and descriptions
123
+ - **Validation**: Built-in checks for string lengths, numeric ranges, and data integrity
124
+ - **Version Handling**: Multiple protocol versions with backward compatibility
125
+
126
+ ### Testing Strategy
127
+ Comprehensive test coverage across all components:
128
+ - **Unit Tests**: Individual functions and classes
129
+ - `test_scraper.py`: Core scraper functionality
130
+ - `test_config.py`: Configuration validation
131
+ - `test_models.py`: Data model serialization
132
+ - `test_cli.py`: CLI interface testing
133
+ - **Integration Tests**: End-to-end scenarios
134
+ - `test_enhanced_ohlc.py`: OHLC data processing
135
+ - `test_edge_cases.py`: Protocol edge cases
136
+ - **Protocol Tests**: Binary data handling
137
+ - `test_decode_pair.py`: Pair decoding edge cases
138
+ - Malformed binary data scenarios
139
+ - Invalid length fields and corrupted data
140
+ - **Quality Gates**: Pre-commit hooks ensure code quality
141
+ - Type checking with mypy
142
+ - Security scanning with bandit
143
+ - Code formatting with black and isort
144
+
145
+ ### Configuration
146
+ - **Logging**: Configurable via `logger.py` with multiple levels
147
+ - **Multi-Chain**: Support for 8+ blockchain networks via `Chain` enum
148
+ - **Flexible Ranking**: Multiple ranking options (volume, trending, price change)
149
+ - **Advanced Filtering**: Volume, liquidity, market cap, age filters
150
+ - **Rate Limiting**: Configurable request throttling (default 4 req/sec)
151
+ - **Retry Logic**: Exponential backoff with configurable max retries
152
+ - **Headers**: Browser-compatible headers with optional Cloudflare bypass
153
+ - **Preset Configs**: Ready-to-use configurations:
154
+ - `PresetConfigs.trending()`: Default trending pairs
155
+ - `PresetConfigs.high_volume()`: Volume-focused
156
+ - `PresetConfigs.defi_focus()`: Multi-chain DeFi tokens
157
+
158
+ ### Error Handling Philosophy
159
+ Enterprise-grade defensive programming:
160
+ - **Connection-level**: Auto-reconnect with exponential backoff, max retry limits
161
+ - **Protocol-level**: Handle multiple message formats, version compatibility
162
+ - **Data-level**: Comprehensive validation, NaN/Inf handling, type safety
163
+ - **Configuration-level**: Validate all user inputs, provide helpful error messages
164
+ - **CLI-level**: Graceful error display, recovery suggestions
165
+ - **Security-level**: Input sanitization, dependency scanning, safe defaults
166
+
167
+ ### Package Management
168
+ - **setuptools-scm**: Automatic version management from git tags
169
+ - **pyproject.toml**: Modern Python packaging with full metadata
170
+ - **Entry Points**: CLI command registration for `dexscraper` command
171
+ - **Optional Dependencies**: Rich UI optional, core functionality always available
172
+ - **Development Tools**: Complete development workflow with pre-commit hooks
173
+
174
+ ### CI/CD Pipeline
175
+ - **Multi-OS Testing**: Ubuntu, Windows, macOS
176
+ - **Multi-Python**: Python 3.7-3.12 support
177
+ - **Quality Gates**: Linting, type checking, security scanning
178
+ - **Coverage**: Comprehensive test coverage reporting
179
+ - **PyPI Publishing**: Automated releases via GitHub Actions
180
+ - **Trusted Publishing**: Secure PyPI deployment without API tokens