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.
To install the client, you can use pip:
pip install standardweb3
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"
)
The StandardClient
class provides the following asynchronous methods:
orderbook = await client.fetch_orderbook(base="BASE_TOKEN", quote="QUOTE_TOKEN")
order_history = await client.fetch_user_account_order_history_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
account_orders = await client.fetch_user_account_orders_paginated_with_limit(
address="USER_ADDRESS", limit=10, page=1
)
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)
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 = 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
)
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.
You can find example code in the examples
folder. Here are some examples:
# 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="Story Odyssey Testnet",
api_key="your_api_key"
)
orderbook = await client.fetch_orderbook(base="BASE_TOKEN", quote="QUOTE_TOKEN")
print(orderbook)
asyncio.run(main())
# 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="Story Odyssey 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())
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
For the guide, check CONTRIBUTING.md.
This project is licensed under the MIT License.