A Python SDK for the Vyper API
Project description
Vyper API Python SDK
A Python SDK for interacting with the Vyper API. This library allows developers to integrate Vyper's http and websocket api into their Python applications with ease.
Table of Contents
Installation
To install the Vyper API Python SDK, use pip:
pip install vyper-client-py
Quick Start
Here's a simple example to get you started:
from vyper_client import VyperClient
# Initialize the client with your API key
client = VyperClient(api_key="your_api_key_here")
# Get the list of chain IDs supported by Vyper
chain_ids = client.get_chain_ids()
print("Supported chain IDs:", chain_ids)
Usage
Client Initialization
The VyperClient
class provides access to the RESTful API endpoints:
from vyper_client import VyperClient
# Create a client instance
client = VyperClient(api_key="your_api_key_here")
REST API Example
Retrieve the market data for a specific token:
# Fetch the All-Time High (ATH) data for a token
token_ath = client.get_token_ath(chain_id=1, market_id="AVs9TA4nWDzfPJE9gGVNJMVhcQy3V9PGazuz33BfG2RA")
print(f"Market Cap USD: {token_ath.market_cap_usd}")
print(f"Timestamp: {token_ath.timestamp}")
WebSocket API Example
import asyncio
from vyper_client import VyperWebsocketClient, FeedType, SubscriptionType
async def main():
# Create a websocket client instance
ws_client = VyperWebsocketClient(api_key="your_api_key_here")
# Define a message handler
async def message_handler(message):
print("Received message:", message)
ws_client.set_message_handler(message_handler)
# Connect to the WebSocket and subscribe to token events
await ws_client.connect(FeedType.TOKEN_EVENTS)
await ws_client.subscribe(
FeedType.TOKEN_EVENTS,
subscription_message={
"action": "subscribe",
"types": [SubscriptionType.PUMPFUN_TOKENS.value]
}
)
# Listen for incoming messages
await ws_client.listen()
# Run the asyncio event loop
asyncio.run(main())
API Documentation
For detailed information on the Vyper API, refer to the official documentation:
- API Dashboard: Vyper Dashboard
- API Documentation: Vyper API Docs
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vyper_client_py-0.1.1.tar.gz
(14.7 kB
view details)
Built Distribution
File details
Details for the file vyper_client_py-0.1.1.tar.gz
.
File metadata
- Download URL: vyper_client_py-0.1.1.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 302e19e64f0daa79dcadfe4761d5e4c16aa197883171d4387a3d60ab565b5495 |
|
MD5 | 47d0e6bf2b62e05d4cbf4e9ddd0cc632 |
|
BLAKE2b-256 | e08cc17a0749b7021717bc58680a9ca64f925512315f3d65a965ea8ce12ce2b1 |
File details
Details for the file vyper_client_py-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: vyper_client_py-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec780913c02b364f1447ceb6aa83615b5ce785b165fbc849c2afb1960ccb7405 |
|
MD5 | 273e28c182194532af2bfb57df99263f |
|
BLAKE2b-256 | a4c24515f1d365833bc1a5bc01335823f6834237bb26a3bf20796b82d77c06c3 |