{"id":50470499,"url":"https://github.com/standarddotim/standard.py","last_synced_at":"2026-06-01T10:02:39.949Z","repository":{"id":271891176,"uuid":"774907076","full_name":"standarddotim/standard.py","owner":"standarddotim","description":"python API client library for standard exchange","archived":false,"fork":false,"pushed_at":"2025-09-23T20:06:42.000Z","size":618,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T22:09:40.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/standarddotim.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-03-20T12:17:43.000Z","updated_at":"2025-09-23T20:06:46.000Z","dependencies_parsed_at":"2025-01-10T15:37:46.842Z","dependency_job_id":"a0592be6-203f-403f-95e3-de54845a26ac","html_url":"https://github.com/standarddotim/standard.py","commit_stats":null,"previous_names":["standardweb3/standard.py","standarddotim/standard.py"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/standarddotim/standard.py","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standarddotim%2Fstandard.py","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standarddotim%2Fstandard.py/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standarddotim%2Fstandard.py/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standarddotim%2Fstandard.py/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/standarddotim","download_url":"https://codeload.github.com/standarddotim/standard.py/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/standarddotim%2Fstandard.py/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33769492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-01T02:00:06.963Z","response_time":115,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-01T10:02:39.129Z","updated_at":"2026-06-01T10:02:39.942Z","avatar_url":"https://github.com/standarddotim.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"./media/standard_profile.jpeg\" width=100/\u003e\n\n  \u003ch1\u003e\u003ccode\u003eStandard Python Client\u003c/code\u003e\u003c/h1\u003e\n\n  \u003cp\u003e\n    \u003cstrong\u003eA Python API client for Standard Exchange\u003c/strong\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://t.me/standard_protocol\"\u003e\u003cimg alt=\"Telegram Chat\" src=\"https://img.shields.io/badge/telegram-chat-blue?logo=telegram\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n# Standard Exchange Python API Client\n\nThis 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.\n\n## Installation\n\nTo install the client, you can use pip:\n\n```bash\npip install standardweb3\n```\n\n## Quick Start\n\n### Environment Setup\n\n1. Create a `.env` file in your project root:\n\n```bash\n# Copy the example environment file\ncp env.example .env\n```\n\n2. Edit `.env` with your actual values:\n\n```bash\n# Your Ethereum private key (without 0x prefix)\nPRIVATE_KEY=your_actual_private_key_here\n\n# RPC URL for your network\nRPC_URL=https://rpc.testnet.mode.network\n\n# Network name (must match supported networks)\nNETWORK=Somnia Testnet\n```\n\n3. Install python-dotenv for environment variable loading:\n\n```bash\npip install python-dotenv\n```\n\n### Basic Trading Example\n\n```python\nimport asyncio\nimport os\nfrom dotenv import load_dotenv\nfrom standardweb3 import StandardClient\n\nasync def quick_trade():\n    load_dotenv()\n\n    client = StandardClient(\n        private_key=os.getenv(\"PRIVATE_KEY\"),\n        http_rpc_url=os.getenv(\"RPC_URL\"),\n        networkName=os.getenv(\"NETWORK\"),\n        api_url=None,\n        websocket_url=None\n    )\n\n    # Market buy example\n    tx_receipt = await client.market_buy(\n        base=\"0xTokenAddress1\",\n        quote=\"0xTokenAddress2\",\n        quote_amount=client.w3.to_wei(0.01, \"ether\"),\n        is_maker=False,\n        n=1,\n        recipient=client.address,\n        slippage_limit=1000000\n    )\n    print(f\"Trade successful: {tx_receipt['transactionHash'].hex()}\")\n\nasyncio.run(quick_trade())\n```\n\n## Usage\n\nFirst, import the necessary modules and initialize the `StandardClient`:\n\n```python\nfrom standardweb3 import StandardClient\n\n# Initialize the client\nclient = StandardClient(\n    private_key=\"your_private_key\",\n    http_rpc_url=\"https://your_rpc_url\",\n    networkName=\"Monad Devnet\",\n    api_key=\"your_api_key_from_standard\"\n)\n```\n\n## Methods\n\nThe `StandardClient` class provides the following asynchronous methods:\n\n### Order Book\n\n```python\norderbook = await client.fetch_orderbook(base=\"BASE_TOKEN\", quote=\"QUOTE_TOKEN\")\n```\n\n### Account Order History\n\n```python\norder_history = await client.fetch_user_account_order_history_paginated_with_limit(\n    address=\"USER_ADDRESS\", limit=10, page=1\n)\n```\n\n### Account Orders\n\n```python\naccount_orders = await client.fetch_user_account_orders_paginated_with_limit(\n    address=\"USER_ADDRESS\", limit=10, page=1\n)\n```\n\n### Pairs\n\n```python\nall_pairs = await client.fetch_all_pairs(limit=10, page=1)\nnew_listing_pairs = await client.fetch_new_listing_pairs(limit=10, page=1)\npair_info = await client.fetch_pair_info(base=\"BASE_TOKEN\", quote=\"QUOTE_TOKEN\")\ntop_gainer_pairs = await client.fetch_top_gainer_pairs(limit=10, page=1)\ntop_loser_pairs = await client.fetch_top_loser_pairs(limit=10, page=1)\n```\n\n### Tokens\n\n```python\nall_tokens = await client.fetch_all_tokens(limit=10, page=1)\nnew_listing_tokens = await client.fetch_new_listing_tokens(limit=10, page=1)\ntoken_info = await client.fetch_token_info(address=\"TOKEN_ADDRESS\")\ntop_gainer_tokens = await client.fetch_top_gainer_tokens(limit=10, page=1)\ntop_loser_tokens = await client.fetch_top_loser_tokens(limit=10, page=1)\n```\n\n### Trade History\n\n```python\ntrade_history = await client.fetch_account_trade_history_paginated_with_limit(\n    address=\"USER_ADDRESS\", limit=10, page=1\n)\nrecent_overall_trades = await client.fetch_recent_overall_trades_paginated(limit=10, page=1)\nrecent_pair_trades = await client.fetch_recent_pair_trades_paginated(\n    base=\"BASE_TOKEN\", quote=\"QUOTE_TOKEN\", limit=10, page=1\n)\n```\n\n### Trading Operations\n\nThe client supports both market and limit orders for buying and selling tokens:\n\n#### Market Orders\n\nMarket orders execute immediately at the current market price:\n\n```python\n# Market Buy - Buy tokens immediately at market price\ntx_receipt = await client.market_buy(\n    base=\"0x1234...\",  # Base token address\n    quote=\"0x5678...\", # Quote token address\n    quote_amount=1000000000000000000,  # Amount in wei (1 ETH)\n    is_maker=False,\n    n=1,\n    recipient=client.address,\n    slippage_limit=1000000  # 10% slippage tolerance\n)\n\n# Market Sell - Sell tokens immediately at market price\ntx_receipt = await client.market_sell(\n    base=\"0x1234...\",  # Base token address\n    quote=\"0x5678...\", # Quote token address\n    base_amount=1000000000000000000,  # Amount in wei (1 token)\n    is_maker=False,\n    n=1,\n    recipient=client.address,\n    slippage_limit=1000000  # 10% slippage tolerance\n)\n```\n\n#### Limit Orders\n\nLimit orders are placed at a specific price and execute when the market reaches that price:\n\n```python\n# Limit Buy - Buy tokens at or below specified price\ntx_receipt = await client.limit_buy(\n    base=\"0x1234...\",  # Base token address\n    quote=\"0x5678...\", # Quote token address\n    price=2000000000000000000,  # Price in wei (2 ETH per token)\n    quote_amount=1000000000000000000,  # Amount in wei (1 ETH worth)\n    is_maker=True,\n    n=1,\n    recipient=client.address\n)\n\n# Limit Sell - Sell tokens at or above specified price\ntx_receipt = await client.limit_sell(\n    base=\"0x1234...\",  # Base token address\n    quote=\"0x5678...\", # Quote token address\n    price=3000000000000000000,  # Price in wei (3 ETH per token)\n    base_amount=1000000000000000000,  # Amount in wei (1 token)\n    is_maker=True,\n    n=1,\n    recipient=client.address\n)\n```\n\n#### Helper Functions for Wei Conversion\n\nUse the Web3 instance to convert between ETH and wei:\n\n```python\n# Convert ETH to wei\namount_wei = client.w3.to_wei(1.5, \"ether\")  # 1.5 ETH\n\n# Convert wei to ETH\namount_eth = client.w3.from_wei(1500000000000000000, \"ether\")  # Returns \"1.5\"\n```\n\n## Use Cases\n\nThe Standard Exchange Python API Client can be used for various purposes, including but not limited to:\n\n- **Trade Automation**: Automate your trading strategies by interacting with the exchange's API to place and manage orders programmatically.\n- **AI Trading Agent**: Develop AI-driven trading agents that can analyze market data, make trading decisions, and execute trades autonomously.\n- **Market Research**: Gather and analyze market data such as order books, trade histories, and token information to conduct in-depth market research and analysis.\n\n## Examples\n\nYou can find example code in the `examples` folder. Here are some examples:\n\n### Complete Trading Example\n\n```python\n# examples/complete_trading.py\nimport asyncio\nimport os\nfrom dotenv import load_dotenv\nfrom standardweb3 import StandardClient\n\nasync def main():\n    # Load environment variables\n    load_dotenv()\n\n    # Initialize the client\n    client = StandardClient(\n        private_key=os.getenv(\"PRIVATE_KEY\"),\n        http_rpc_url=os.getenv(\"RPC_URL\", \"https://rpc.testnet.mode.network\"),\n        networkName=os.getenv(\"NETWORK\", \"Somnia Testnet\"),\n        api_url=None,\n        websocket_url=None\n    )\n\n    # Example token addresses (replace with actual addresses)\n    base_token = \"0x1234567890123456789012345678901234567890\"\n    quote_token = \"0x0987654321098765432109876543210987654321\"\n\n    try:\n        # 1. Market Buy Example\n        print(\"Executing market buy...\")\n        quote_amount = client.w3.to_wei(0.1, \"ether\")  # 0.1 ETH\n        tx_receipt = await client.market_buy(\n            base=base_token,\n            quote=quote_token,\n            quote_amount=quote_amount,\n            is_maker=False,\n            n=1,\n            recipient=client.address,\n            slippage_limit=1000000  # 10% slippage\n        )\n        print(f\"Market buy successful! TX: {tx_receipt['transactionHash'].hex()}\")\n\n        # 2. Limit Sell Example\n        print(\"Placing limit sell order...\")\n        price = client.w3.to_wei(2.0, \"ether\")  # 2 ETH per token\n        base_amount = client.w3.to_wei(0.5, \"ether\")  # 0.5 tokens\n        tx_receipt = await client.limit_sell(\n            base=base_token,\n            quote=quote_token,\n            price=price,\n            base_amount=base_amount,\n            is_maker=True,\n            n=1,\n            recipient=client.address\n        )\n        print(f\"Limit sell placed! TX: {tx_receipt['transactionHash'].hex()}\")\n\n    except Exception as e:\n        print(f\"Trading failed: {e}\")\n\nasyncio.run(main())\n```\n\n### Fetch Order Book\n\n```python\n# examples/fetch_orderbook.py\nimport asyncio\nfrom standardweb3 import StandardClient\n\nasync def main():\n    client = StandardClient(\n        private_key=\"your_private_key\",\n        http_rpc_url=\"https://your_rpc_url\",\n        networkName=\"Somnia Testnet\",\n        api_key=\"your_api_key\"\n    )\n    orderbook = await client.fetch_orderbook(base=\"BASE_TOKEN\", quote=\"QUOTE_TOKEN\")\n    print(orderbook)\n\nasyncio.run(main())\n```\n\n### Fetch User Account Order History\n\n```python\n# examples/fetch_user_account_order_history.py\nimport asyncio\nfrom standardweb3 import StandardClient\n\nasync def main():\n    client = StandardClient(\n        private_key=\"your_private_key\",\n        http_rpc_url=\"https://your_rpc_url\",\n        networkName=\"Somnia Testnet\",\n        api_key=\"your_api_key\"\n    )\n    order_history = await client.fetch_user_account_order_history_paginated_with_limit(\n        address=\"USER_ADDRESS\", limit=10, page=1\n    )\n    print(order_history)\n\nasyncio.run(main())\n```\n\n## Contributing\n\nContributions are welcome! Please open an issue or submit a pull request on GitHub.\n\nFor the guide, check [CONTRIBUTING.md](./CONTRIBUTING.md).\n\n## License\n\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstandarddotim%2Fstandard.py","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstandarddotim%2Fstandard.py","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstandarddotim%2Fstandard.py/lists"}