{"id":51011346,"url":"https://github.com/xsa-dev/weex-client","last_synced_at":"2026-06-21T03:02:53.437Z","repository":{"id":334360445,"uuid":"1141082190","full_name":"xsa-dev/weex-client","owner":"xsa-dev","description":"Modern async-first Weex API client for Python 3.14+","archived":false,"fork":false,"pushed_at":"2026-01-24T08:18:31.000Z","size":6401,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-24T18:59:00.237Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xsa-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-01-24T07:57:27.000Z","updated_at":"2026-01-24T08:18:35.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/xsa-dev/weex-client","commit_stats":null,"previous_names":["xsa-dev/weex-client"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/xsa-dev/weex-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsa-dev%2Fweex-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsa-dev%2Fweex-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsa-dev%2Fweex-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsa-dev%2Fweex-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xsa-dev","download_url":"https://codeload.github.com/xsa-dev/weex-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xsa-dev%2Fweex-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34592057,"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-21T02:00:05.568Z","response_time":54,"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-21T03:02:52.650Z","updated_at":"2026-06-21T03:02:53.431Z","avatar_url":"https://github.com/xsa-dev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Weex Python API Client\n\nA secure and robust Python client for interacting with the Weex cryptocurrency exchange API.\n\n## Features\n\n- ✅ **Secure Authentication**: HMAC-SHA256 signature-based authentication with environment variable configuration\n- ✅ **Error Handling**: Comprehensive error handling with proper logging\n- ✅ **Type Hints**: Full type annotation support for better code completion\n- ✅ **Logging**: Structured logging for debugging and monitoring\n- ✅ **Timeout Protection**: Configurable request timeouts\n- ✅ **Multiple APIs**: Support for both Contract and Spot trading APIs\n\n## Installation\n\n1. Install dependencies using UV:\n```bash\nuv sync\n```\n\nOr with pip:\n```bash\npip install -r requirements.txt\n```\n\n## Configuration\n\n### 1. Create Environment File\n\nCopy the example environment file:\n```bash\ncp .env.example .env\n```\n\n### 2. Add Your API Credentials\n\nEdit the `.env` file with your actual Weex API credentials:\n\n```env\n# Your Weex API Key (starts with 'weex_')\nWEEX_API_KEY=your_actual_api_key_here\n\n# Your Weex Secret Key \nWEEX_SECRET_KEY=your_actual_secret_key_here\n\n# Your Weex API Passphrase\nWEEX_PASSPHRASE=your_actual_passphrase_here\n\n# Environment: development, staging, or production\nWEEX_ENVIRONMENT=development\n\n# Optional: Custom timeout settings (seconds)\nAPI_TIMEOUT=30\n\n# Optional: Enable debug logging\nDEBUG=false\n```\n\n### 3. Getting API Credentials\n\nTo get your Weex API credentials:\n\n1. Log into your Weex account at [weex.com](https://weex.com)\n2. Navigate to API Management in your account settings\n3. Create a new API key with the required permissions\n4. Copy the API Key, Secret Key, and Passphrase to your `.env` file\n\n## Usage\n\n### Basic Usage\n\n```python\nfrom main import WeexAPIClient\n\n# Initialize the client\nclient = WeexAPIClient()\n\n# Get position data\nposition_data = client.get_contract_data(\n    \"/capi/v2/account/position/singlePosition\", \n    \"?symbol=cmt_btcusdt\"\n)\n\nprint(position_data)\n```\n\n### Examples\n\nThe client includes example functions:\n\n```python\n# Get position data\npython main.py\n\n# This will run the example_get_position() function\n```\n\n### Available Methods\n\n#### Contract API (Futures Trading)\n```python\nclient = WeexAPIClient()\n\n# GET requests to contract API\ndata = client.get_contract_data(\"/capi/v2/account/position/singlePosition\", \"?symbol=cmt_btcusdt\")\n\n# POST requests to contract API\norder_data = client.post_contract_data(\"/capi/v2/order/placeOrder\", {\n    \"symbol\": \"cmt_btcusdt\",\n    \"client_oid\": \"unique_order_id\",\n    \"size\": \"0.01\",\n    \"type\": \"1\",\n    \"order_type\": \"0\",\n    \"match_price\": \"1\",\n    \"price\": \"80000\"\n})\n```\n\n#### Spot API (Regular Trading)\n```python\nclient = WeexAPIClient()\n\n# GET requests to spot API\ndata = client.get_spot_data(\"/api/v2/spot/account\", \"\")\n```\n\n## Security Features\n\n- ✅ **No Hardcoded Credentials**: API keys are loaded from environment variables\n- ✅ **Git Protection**: `.env` file is automatically ignored by Git\n- ✅ **Input Validation**: All inputs are validated before API calls\n- ✅ **Secure Headers**: Proper User-Agent and locale headers\n- ✅ **Logging Protection**: Sensitive data is never logged\n\n## Error Handling\n\nThe client includes comprehensive error handling:\n\n- **Connection Errors**: Network connectivity issues\n- **Timeout Errors**: Requests that exceed the timeout period\n- **Authentication Errors**: Invalid API credentials\n- **API Errors**: HTTP error responses from the API\n- **JSON Errors**: Invalid response format\n\nAll errors are logged with detailed information for debugging.\n\n## Logging\n\nThe client logs to both console and file (`weex_api.log`):\n\n- **INFO**: Successful requests and general information\n- **ERROR**: Failed requests and error details\n- **DEBUG**: Detailed request/response information (when DEBUG=true)\n\n## Development\n\n### Project Structure\n\n```\npy_startup/\n├── main.py              # Main API client implementation\n├── .env.example         # Environment file template\n├── .gitignore           # Git ignore rules\n├── pyproject.toml       # Project dependencies\n├── uv.lock              # Dependency lock file\n├── README.md            # This file\n└── weex_api.log         # Generated log file\n```\n\n### Running Tests\n\nThe example functions serve as basic integration tests:\n\n```bash\n# Test with your actual API credentials\npython main.py\n```\n\n## Troubleshooting\n\n### Common Issues\n\n1. **\"Missing required API credentials\"**\n   - Ensure your `.env` file is properly configured\n   - Check that all three values are present: API key, secret key, and passphrase\n\n2. **\"Request timeout\"**\n   - Increase the `API_TIMEOUT` value in your `.env` file\n   - Check your internet connection\n\n3. **\"Connection error\"**\n   - Verify Weex API status at [status.weex.com](https://status.weex.com)\n   - Check if your API keys have the required permissions\n\n4. **Authentication errors**\n   - Verify your API credentials are correct\n   - Ensure your API keys are enabled for the endpoints you're accessing\n\n### Debug Mode\n\nEnable debug logging by setting:\n```env\nDEBUG=true\n```\n\nThis will provide detailed request/response information for troubleshooting.\n\n## API Reference\n\nFor complete Weex API documentation, visit:\n- [Weex API Documentation](https://www.weex.com/api-doc/)\n- [API Status](https://status.weex.com)\n- [GitHub Repository](https://github.com/weex-exchange/api-docs)\n\n## Support\n\nIf you encounter issues:\n\n1. Check the log file `weex_api.log` for detailed error information\n2. Verify your API credentials and permissions\n3. Check Weex API status for any service disruptions\n4. Review the Weex API documentation for endpoint-specific requirements\n\n## License\n\nThis project is provided as-is for educational and development purposes.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsa-dev%2Fweex-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxsa-dev%2Fweex-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxsa-dev%2Fweex-client/lists"}