Installation
π New to GMGN.ai? Create your account with our referral link to support GmGnAPIβs development β Sign up on GMGN.ai
π¬ Need help? Join the Chipa Discord Β· β‘ Go no-code with ChipaEditor
Multiple ways to install GmGnAPI β from a simple pip install to a full development setup.
Prerequisites
Before installing GmGnAPI, make sure you have:
- Python 3.8+ β check with
python --version(Python 3.11+ recommended for best asyncio performance) - pip β keep it current with
pip install --upgrade pip - A GMGN account β create a free account for API access: Create GMGN Account
Install via pip (Recommended)
The easiest way to install GmGnAPI is from PyPI:
pip install gmgnapi
This installs the latest stable release along with all required dependencies:
- websockets >= 12.0 β WebSocket client library
- pydantic >= 2.0 β Data validation using Python type annotations
- aiofiles >= 23.0 β Async file operations
For production use, pin the version in your requirements.txt:
pip install gmgnapi==1.3.0Install from Source
To get the latest development version or contribute to the project:
# Clone the repository
git clone https://gitlab.chipatrade.com/chipadevorg/GmGnAPI.git
cd GmGnAPI
# Install in development mode
pip install -e .
# Install with development dependencies
pip install -e ".[dev]"
Development dependencies include:
- pytest β Testing framework
- pytest-asyncio β Async test support
- black β Code formatting
- mypy β Static type checking
- ruff β Fast Python linter
Optional Dependencies
GmGnAPI supports optional extras for specific use cases:
# Install with all optional dependencies
pip install gmgnapi[all]
# Data analysis extras (pandas, numpy)
pip install gmgnapi[analysis]
# Webhook & notification extras (aiohttp)
pip install gmgnapi[webhooks]
# Export extras (openpyxl for Excel export)
pip install gmgnapi[export]| Extra | Packages | Use Case |
|---|---|---|
analysis | pandas, numpy | Advanced data analysis and manipulation of pool/token data |
webhooks | aiohttp | Sending webhook notifications to Slack, Discord, or custom endpoints |
export | openpyxl | Exporting data to Excel spreadsheets alongside JSON and CSV |
Docker Setup
Run GmGnAPI inside a Docker container for isolated, reproducible environments:
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
CMD ["python", "main.py"]# Build and run
docker build -t gmgnapi-app .
docker run -e GMGN_ACCESS_TOKEN=your_token gmgnapi-appVirtual Environments
We strongly recommend using virtual environments to isolate your project dependencies.
venv (Built-in)
# Create virtual environment
python -m venv .venv
# Activate (macOS/Linux)
source .venv/bin/activate
# Activate (Windows)
.venv\Scripts\activate
# Install GmGnAPI
pip install gmgnapiPoetry
# Add GmGnAPI to your project
poetry add gmgnapi
# With optional extras
poetry add "gmgnapi[all]"Conda
# Create conda environment
conda create -n gmgnapi python=3.11
conda activate gmgnapi
# Install via pip inside conda
pip install gmgnapiVerify Installation
Confirm that GmGnAPI is installed correctly:
import gmgnapi
print(f"GmGnAPI version: {gmgnapi.__version__}")
# Test basic import
from gmgnapi import GmGnClient
print("β
GmGnAPI installed successfully!")
Or from the command line:
python -c "from gmgnapi import GmGnClient; print('β
GmGnAPI ready!')"Troubleshooting
Python version too old
GmGnAPI requires Python 3.8+. Update Python or use pyenv to manage versions:
pyenv install 3.11.0
pyenv local 3.11.0Permission errors on install
Use the --user flag or a virtual environment:
pip install --user gmgnapiPydantic v1 conflict
GmGnAPI requires Pydantic v2. Upgrade with:
pip install --upgrade "pydantic>=2.0"Still having issues?
Get help from the community or report a bug:
Ready to Start Building?
Create your free GMGN account to get API access, then continue with the Getting Started guide. For a faster workflow, build your bots in ChipaEditor β the AI-powered strategy editor β and join the Chipa Discord for tips, support, and updates.