Python Client for Standard
Project description
Standard Exchange Python API Client
This is a Python API client for connecting to the Standard Exchange. It provides a set of asynchronous methods to interact with the exchange's API, allowing you to fetch order books, trade histories, token information, and more.
Installation
To install the client, you can use pip:
pip install standardweb3
Usage
First, import the necessary modules and initialize the StandardClient:
from standardweb3 import StandardClient
# Initialize the client
client = StandardClient(
private_key="your_private_key",
http_rpc_url="https://your_rpc_url",
networkName="Monad Devnet",
api_key="your_api_key_from_standard"
)
Methods
The StandardClient class provides the following asynchronous methods:
Order Book
orderbook = await client.fetch_orderbook(base="BASE_TOKEN", quote="QUOTE_TOKEN")
Account Order History
order_history = await client.fetch_user_account_order_history_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
Account Orders
account_orders = await client.fetch_user_account_orders_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
Pairs
all_pairs = await client.fetch_all_pairs(limit=10, page=1)
new_listing_pairs = await client.fetch_new_listing_pairs(limit=10, page=1)
pair_info = await client.fetch_pair_info(base="BASE_TOKEN", quote="QUOTE_TOKEN")
top_gainer_pairs = await client.fetch_top_gainer_pairs(limit=10, page=1)
top_loser_pairs = await client.fetch_top_loser_pairs(limit=10, page=1)
Tokens
all_tokens = await client.fetch_all_tokens(limit=10, page=1)
new_listing_tokens = await client.fetch_new_listing_tokens(limit=10, page=1)
token_info = await client.fetch_token_info(address="TOKEN_ADDRESS")
top_gainer_tokens = await client.fetch_top_gainer_tokens(limit=10, page=1)
top_loser_tokens = await client.fetch_top_loser_tokens(limit=10, page=1)
Trade History
trade_history = await client.fetch_account_trade_history_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
recent_overall_trades = await client.fetch_recent_overall_trades_paginated(limit=10, page=1)
recent_pair_trades = await client.fetch_recent_pair_trades_paginated(
base="BASE_TOKEN", quote="QUOTE_TOKEN", limit=10, page=1
)
Use Cases
The Standard Exchange Python API Client can be used for various purposes, including but not limited to:
- Trade Automation: Automate your trading strategies by interacting with the exchange's API to place and manage orders programmatically.
- AI Trading Agent: Develop AI-driven trading agents that can analyze market data, make trading decisions, and execute trades autonomously.
- Market Research: Gather and analyze market data such as order books, trade histories, and token information to conduct in-depth market research and analysis.
Examples
You can find example code in the examples folder. Here are some examples:
Fetch Order Book
# examples/fetch_orderbook.py
import asyncio
from standardweb3 import StandardClient
async def main():
client = StandardClient(
private_key="your_private_key",
http_rpc_url="https://your_rpc_url",
networkName="Somnia Testnet",
api_key="your_api_key"
)
orderbook = await client.fetch_orderbook(base="BASE_TOKEN", quote="QUOTE_TOKEN")
print(orderbook)
asyncio.run(main())
Fetch User Account Order History
# examples/fetch_user_account_order_history.py
import asyncio
from standardweb3 import StandardClient
async def main():
client = StandardClient(
private_key="your_private_key",
http_rpc_url="https://your_rpc_url",
networkName="Somnia Testnet",
api_key="your_api_key"
)
order_history = await client.fetch_user_account_order_history_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
print(order_history)
asyncio.run(main())
Contributing
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For the guide, check CONTRIBUTING.md.
License
This project is licensed under the MIT License.
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 standardweb3-0.0.1.tar.gz.
File metadata
- Download URL: standardweb3-0.0.1.tar.gz
- Upload date:
- Size: 361.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
105fbed7ae24bc792929b3648606ce67a80f5b577af27845812bfd5364f79c61
|
|
| MD5 |
ad6aa6101d61d1799d18ad8b7c4a57c4
|
|
| BLAKE2b-256 |
413f028cd1e21df5ffce795a0f322261980ec37ee9becd92d3612af71238561f
|
File details
Details for the file standardweb3-0.0.1-py3-none-any.whl.
File metadata
- Download URL: standardweb3-0.0.1-py3-none-any.whl
- Upload date:
- Size: 24.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f640594d48ba4b22dcdfe0437a5fe31c62e4144d201d93a083a451d7b52b604c
|
|
| MD5 |
0ab9bd9ec36d568680ca90ed8c3352e3
|
|
| BLAKE2b-256 |
0f6177ce261f2be04265792fd136d2b0a6630d4565600173b7fb558ec0b579f1
|