GTE Python SDK
Project description
from hexbytes import HexBytesfrom eth_utils import to_checksum_addressfrom gte_py.api.chain.utils import make_web3
GTE-PY
A Python SDK for interacting with the GTE decentralized exchange on MegaETH.
Overview
gte-py provides a robust interface to interact with GTE's decentralized exchange protocol, allowing developers to:
- Query market information
- Execute trades
- Manage token operations
- Monitor orderbooks
- Interact with CLOB (Central Limit Order Book) contracts
- Listen to blockchain events
What is GTE?
GTE is the world's fastest decentralized exchange, covering the entire lifecycle of a token – from its initial launch to sophisticated perpetuals trading – all on a single, high-performance platform. Unlike traditional approaches that force users to navigate separate launchpads (like PumpFun), DEXs (like Raydium), and CLOBs (like Binance or Hyperliquid) for different stages of an asset's journey, GTE unifies these critical market structures.
This integration is achieved through:
- Token Launchpad & Launcher: The starting point for new tokens, bootstrapping initial liquidity.
- Classic AMM: Facilitating price discovery and trading for newer or long-tail assets.
- Spot and Perpetual CLOBs: Offering CEX-level liquidity and advanced trading features for more established assets, powered by a crankless onchain design.
- Best-Price Aggregator: Ensuring optimal trade execution across GTE's integrated venues (AMM & CLOB) and potentially the wider MegaETH ecosystem.
By unifying these components, GTE eliminates the fragmentation and friction common in the crypto space. Users no longer need to bridge assets or manage accounts across disparate protocols. They can seamlessly follow a token's journey from a fair launch, through AMM price discovery, onto the spot CLOB, and finally trade its perpetuals contract (priced off the GTE spot index) — all within the unified GTE interface.
What is MegaETH?
GTE is built on MegaETH. MegaETH is the first real-time blockchain. As an EVM-compatible Layer-2 on Ethereum, it achieves unparalleled performance through:
- Streamlined consensus with a single real-time sequencer for fast, reliable transaction ordering
- Parallel transaction processing for maximum throughput
- EigenDA integration for secure, decentralized data availability, preventing any single point of failure
These optimizations result in 100,000 transactions per second and single-digit millisecond latency, making MegaETH the fastest blockchain with Ethereum-level security.
Why MegaETH?
MegaETH's architecture enables GTE to offer unique advantages:
- CEX-level performance, onchain: MegaETH's 100k TPS and 1ms block times allow GTE to run a fully onchain order book that matches centralized exchange speeds.
- True market efficiency: Extremely cheap gas enables GTE's crankless design. Market makers can place and cancel orders freely, leading to tighter spreads and more liquid markets.
- Fair and familiar trading: MegaETH's centralized sequencer allows GTE to implement true price-time-priority matching, mirroring traditional markets.
- Ecosystem integration: As an Ethereum L2, GTE's smart contracts on MegaETH are EVM-compatible, maximizing composability with other DeFi protocols.
Installation
You can install the package directly from github:
# Clone the repository
git clone https://github.com/liquid-labs-inc/gte-python-sdk/
cd gte-py
# Install the package
pip install -e .
# Install with development dependencies
pip install -e ".[dev]"
Or include it in your requirements.txt:
git+https://github.com/liquid-labs-inc/gte-python-sdk#egg=gte-py
Or include it in your pyproject.toml:
dependencies = [
"gte_py@git+https://github.com/liquid-labs-inc/gte-python-sdk#egg=gte-py"
]
Project Structure
The SDK is organized into two main layers:
Low-Level API
Located in src/gte_py/api/:
- Chain API (
api/chain/): Direct blockchain interactions using Web3.py - REST API (
api/rest/): HTTP-based API interactions - WebSocket API (
api/ws/): WebSocket-based real-time data streams - OpenAPI (
api/openapi/): Auto-generated OpenAPI client
High-Level Clients
Located in src/gte_py/clients/:
- Account: User account management
- CLOB: Central Limit Order Book operations
- Token: ERC20 token operations
- Trades: Trading functions
- Info: Market information
- Orderbook: Order book queries and monitoring
- Execution: Order execution handling
Quick Start
import asyncio
from web3 import AsyncWeb3
from eth_utils import to_checksum_address
from hexbytes import HexBytes
from gte_py.clients import Client
from gte_py.configs import TESTNET_CONFIG
from gte_py.api.chain.utils import make_web3
WALLET_ADDRESS = to_checksum_address("0xYourWalletAddress")
PRIVATE_KEY = HexBytes("0xYourPrivateKey")
async def main():
# Initialize AsyncWeb3
config = TESTNET_CONFIG
web3 = await make_web3(config, WALLET_ADDRESS, PRIVATE_KEY)
# Initialize the client
client = Client(
web3=web3,
config=config
)
# Query available markets
markets = await client.clob.get_markets()
print(f"Available markets: {len(markets)}")
# Get more information
for market in markets[:3]: # Print first 3 markets
market_info = await client.clob.get_market_info(market.address)
print(f"Market: {market_info.name} ({market_info.symbol})")
print(f" Address: {market_info.address}")
print(f" Base token: {market_info.base_token_symbol}")
print(f" Quote token: {market_info.quote_token_symbol}")
if __name__ == "__main__":
asyncio.run(main())
Check the examples/ directory for more sample code.
Configuration
The SDK uses the NetworkConfig class for configuration settings:
from gte_py.configs import TESTNET_CONFIG
# Default config for MegaETH Testnet is provided
print(TESTNET_CONFIG.name) # "MegaETH Testnet"
print(TESTNET_CONFIG.chain_id) # 6342
# You can customize RPC endpoints using environment variables
# MEGAETH_TESTNET_RPC_HTTP and MEGAETH_TESTNET_RPC_WS
Development
For detailed development instructions, please refer to the Developer Guide.
Running Tests
pytest
Linting
ruff check .
Type Checking
pyright
License
[License information]
Contributing
Contributions are welcome! Please check out our Developer Guide for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gte_py-0.1.1.tar.gz.
File metadata
- Download URL: gte_py-0.1.1.tar.gz
- Upload date:
- Size: 80.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6fa92897d0937ef92f2ce28e5ac4f63e3b65ccf4243028fd8f8b969c93923c40
|
|
| MD5 |
dbc81582a438cf3b2c1d084de4fbf199
|
|
| BLAKE2b-256 |
07423a72a02aa1bbb1695c1175455b191342d9ab4c58563f95996d36a371f917
|
File details
Details for the file gte_py-0.1.1-py3-none-any.whl.
File metadata
- Download URL: gte_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 131.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
038c8f7dd54099fd22f6a3c087361e63c2641cd8e1c0ebfb19f2c5b6341dc491
|
|
| MD5 |
4725d8421c5020f2b22d2db30a6571fe
|
|
| BLAKE2b-256 |
4dcd99292d142330befa3d6f4ab1541bee0174857259a501cfde18468fc15c1a
|