{"id":50672953,"url":"https://github.com/oasisprotocol/wt3","last_synced_at":"2026-06-08T13:02:31.235Z","repository":{"id":321188396,"uuid":"999462061","full_name":"oasisprotocol/wt3","owner":"oasisprotocol","description":"An autonomous trading AI agent built on Oasis secure TEE infrastructure.","archived":false,"fork":false,"pushed_at":"2026-04-28T11:03:28.000Z","size":623,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-28T13:07:21.555Z","etag":null,"topics":["agent","ai","oasis","tee"],"latest_commit_sha":null,"homepage":"https://wt3.ai/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oasisprotocol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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":"2025-06-10T09:34:24.000Z","updated_at":"2026-04-28T11:03:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"deac41ce-dbab-40fb-915c-80cf7580bdca","html_url":"https://github.com/oasisprotocol/wt3","commit_stats":null,"previous_names":["oasisprotocol/wt3"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/oasisprotocol/wt3","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fwt3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fwt3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fwt3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fwt3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oasisprotocol","download_url":"https://codeload.github.com/oasisprotocol/wt3/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oasisprotocol%2Fwt3/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34063159,"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-08T02:00:07.615Z","response_time":111,"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":["agent","ai","oasis","tee"],"created_at":"2026-06-08T13:02:30.432Z","updated_at":"2026-06-08T13:02:31.227Z","avatar_url":"https://github.com/oasisprotocol.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WT3 (Wolf of Trading Tokens in TEE)\n\nAn autonomous trading AI agent powered by Oasis secure TEE infrastructure, executing strategies on Hyperliquid with integrated social intelligence.\n\n## Overview\n\nWT3 is a sophisticated trading system that combines:\n- Secure execution within Intel TDX trusted enclaves via the Oasis ROFL framework\n- Automated trading strategies with risk management\n- AI-powered social media integration for market commentary\n- Hourly trading cycles with position management\n- Real-time market analysis and signal generation\n\nThe system operates autonomously, executing trades based on proprietary signals while maintaining an active social media presence to share trading insights and market analysis.\n\n## Architecture\n\nWT3 consists of two main components running as containerized services:\n\n### Signal Service\n- Generates trading signals based on market analysis\n- Provides REST API endpoints for signal consumption\n- Integrates with Predictoor for AI-driven market predictions\n- Includes both encrypted proprietary strategy and open-source example\n- Automatic fallback to example service if primary is unavailable\n\n### WT3 Main Agent\n- Executes trades on Hyperliquid exchange\n- Manages positions with automated stop-loss and take-profit\n- Posts hourly trading recaps on Twitter/X\n- Responds to social media mentions\n- Maintains persistent trade and conversation history\n\nBoth services run within the Oasis ROFL framework, ensuring secure key management and trusted execution.\n\n## Prerequisites\n\n- Docker and Docker Compose\n- Python 3.11.11\n- [uv](https://docs.astral.sh/uv/) (modern Python package manager)\n- Oasis CLI tools (`oasis` command)\n- Age encryption tool (for signal service decryption)\n- Understanding of trading, blockchain and TEEs\n\n## Installation\n\n### Local Development Setup\n\nFor local development without Docker or ROFL/TEE requirements:\n\n1. Install uv (if not already installed):\n```bash\ncurl -LsSf https://astral.sh/uv/install.sh | sh\n```\n\n2. Clone the repository:\n```bash\ngit clone https://github.com/oasisprotocol/wt3.git\ncd wt3\n```\n\n3. Install dependencies (uv will automatically create a virtual environment):\n```bash\nuv sync\n```\n\n4. Modify the ROFL clients to use local keypairs:\n   - In `src/wt3/clients/rofl.py` and `src/signal_service_example/clients/rofl.py`\n   - Replace the `get_keypair` function to return a private key from environment:\n   ```python\n   import os\n\n   def get_keypair(key_id: str = WT3_TRADING_KEY):\n       private_key = os.getenv(\"PRIVATE_KEY\")\n       if not private_key:\n           raise ValueError(\"PRIVATE_KEY environment variable not set\")\n\n       account = Account.from_key(private_key)\n       return private_key, account.address\n   ```\n\n5. Create a `.env` file with your configuration:\n\n```bash\n# Private key for local development (use a test key, never real funds!)\nPRIVATE_KEY=0xYOUR_PRIVATE_KEY_HERE\n\n# Signal Service URL\nSIGNAL_SERVICE_URL=http://localhost:8001\n\n# API Keys\nGROK_API_KEY=your_grok_api_key\nTWITTER_BEARER_TOKEN=your_twitter_bearer_token\nTWITTER_API_KEY=your_twitter_api_key\nTWITTER_API_SECRET=your_twitter_api_secret\nTWITTER_ACCESS_TOKEN=your_twitter_access_token\nTWITTER_ACCESS_TOKEN_SECRET=your_twitter_access_token_secret\n```\n\n6. Run the signal service in one terminal:\n```bash\nuv run python -m src.signal_service_example\n```\n\n7. Run the main WT3 agent in another terminal:\n```bash\nuv run python -m src.wt3\n```\n\n**Note**: For local development, you'll need to bypass the ROFL socket connection. The easiest way is to modify the `rofl.py` files as described above.\n\n### Production Deployment\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/oasisprotocol/wt3.git\ncd wt3\n```\n\n2. Set up environment variables:\n```bash\ncp .env.example .env\n# Edit .env with your configuration\n```\n\n3. Build Docker images:\n```bash\ndocker build -t yourusername/wt3:latest .\ndocker build -t yourusername/wt3-signal:latest -f Dockerfile.signal .\n```\n\n4. Push images to Docker Hub and update compose.yaml:\n```bash\n# Push images\ndocker push yourusername/wt3\ndocker push yourusername/wt3-signal\n\n# Get the image digests\ndocker inspect --format='{{index .RepoDigests 0}}' yourusername/wt3:latest\ndocker inspect --format='{{index .RepoDigests 0}}' yourusername/wt3-signal:latest\n\n# Update compose.yaml with your images and sha256 digests\n# Example:\n# wt3:\n#   image: docker.io/yourusername/wt3@sha256:YOUR_DIGEST_HERE\n# signal-service:\n#   image: docker.io/yourusername/wt3-signal@sha256:YOUR_DIGEST_HERE\n```\n\n5. Initialize and create ROFL app:\n```bash\n# Initialize ROFL\noasis rofl init\n\n# Create ROFL app\noasis rofl create\n```\n\n6. Build and update ROFL deployment:\n```bash\n# Build ROFL app\noasis rofl build\n\n# Update ROFL deployment\noasis rofl update\n```\n\n7. Deploy to ROFL node:\n```bash\n# The build process creates a .orc file\n# Deploy this file to your Oasis node following the node operator guide\n# See: https://docs.oasis.io/node/run-your-node/rofl-node\n```\n\n## Configuration\n\n### Environment Variables\n\nRequired variables in `.env`:\n\n- `GROK_API_KEY` - API key for AI content generation\n- `TWITTER_BEARER_TOKEN` - Twitter API bearer token\n- `TWITTER_API_KEY` - Twitter API key\n- `TWITTER_API_SECRET` - Twitter API secret\n- `TWITTER_ACCESS_TOKEN` - Twitter access token\n- `TWITTER_ACCESS_TOKEN_SECRET` - Twitter access token secret\n- `SIGNAL_SERVICE_URL` - Internal signal service endpoint\n- `AGE_PRIVATE_KEY` - Private key for signal service decryption\n\n### Social Media Configuration\n\n1. Copy the template file:\n```bash\ncp social_prompts_template.py social_prompts.py\n```\n\n2. Edit `social_prompts.py` to customize AI-generated content prompts\n\n\n## Deployment\n\n### Local Development\n\nUse the provided Docker script for local development:\n\n```bash\n# Build images\n./scripts/docker-run.sh build\n\n# Start containers\n./scripts/docker-run.sh start\n\n# View logs\n./scripts/docker-run.sh logs\n\n# Stop containers\n./scripts/docker-run.sh stop\n```\n\n## Signal Service Example\n\nThe `signal_service_example` provides an open-source momentum-based trading strategy that serves as:\n- A fallback when the primary encrypted signal service is unavailable\n- A template for developing custom trading strategies\n- A demonstration of the signal service API implementation\n\n### Strategy Details\nThe example strategy combines:\n- 14-period RSI for overbought/oversold conditions\n- 20-period and 50-period SMAs for trend confirmation\n- Dynamic position sizing based on account balance\n- Maximum 5x leverage with minimum $100 trade size\n\n### Running the Example Service\nThe signal_service_example automatically runs when:\n1. The encrypted signal service fails to decrypt (missing AGE_PRIVATE_KEY)\n2. The primary service is unavailable or unhealthy\n3. You explicitly start it without the encrypted service\n\n## API Reference\n\n### Signal Service Endpoints\n\n#### Health Check\n```\nGET /health\n```\nReturns service status.\n\n#### Get Trading Signal\n```\nGET /signal\n```\nReturns trading signal for specified cryptocurrency.\n\n**Response Format:**\n```json\n{\n    \"timestamp\": 1234567890,\n    \"trade_decision\": {\n        \"action\": \"open\",\n        \"direction\": \"long\",\n        \"confidence\": 0.85,\n        \"coin\": \"BTC\",\n        \"strategy\": {\n            \"position_size_coin\": 0.1,\n            \"leverage\": 2.0,\n            \"stop_loss\": 50000.0,\n            \"take_profit\": 55000.0\n        }\n    },\n    \"current_position\": {\n        \"size\": 0.1,\n        \"direction\": \"LONG\",\n        \"entry_price\": 50000.0\n    }\n}\n```\n\n## Security\n\n### Trusted Execution Environment\n\nWT3 runs within Intel TDX enclaves via the Oasis ROFL framework, providing:\n- Secure key management\n- Protected execution environment\n- Attestation capabilities\n- Isolation from host system\n\n### Encryption\n\n- Signal service code is encrypted using Age encryption\n- Secrets are encrypted in ROFL configuration\n- All sensitive API keys are stored as encrypted secrets\n- Private keys never leave the TEE environment\n\n### Signal Service Protection\n\nThe trading strategy within the signal service is encrypted to protect proprietary algorithms. An open-source example strategy (`signal_service_example`) is included as a fallback and template for custom implementations.\n\n## Project Structure\n\n```\nwt3/\n├── src/\n│   ├── wt3/                        # Main trading agent\n│   │   ├── __main__.py             # Entry point and main loop\n│   │   ├── core/                   # Core trading logic\n│   │   ├── clients/                # API clients\n│   │   └── prompts/                # Social media templates\n│   ├── signal_service/             # Signal generation (encrypted)\n│   └── signal_service_example/     # Open-source example strategy\n├── scripts/                        # Deployment and utility scripts\n├── data/                           # Configuration and deployment files\n├── tests/                          # Testing utilities\n├── pyproject.toml                  # Python project configuration\n├── uv.lock                         # Locked dependency versions\n├── Dockerfile                      # Main agent container definition\n├── Dockerfile.signal               # Signal service container definition\n├── compose.yaml                    # Docker Compose configuration\n├── rofl.yaml                       # ROFL deployment configuration\n├── signal_service.tar.gz.age       # Encrypted signal service archive\n├── .env.example                    # Environment variables template\n└── social_prompts_template.py      # Social media prompts template\n```\n\n## Data Persistence\n\nWT3 maintains the following persistent data:\n- `conversation_history.json` - Social media interactions\n- Position state and market data\n\n## License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis software is for educational purposes only. Use at your own risk. The authors are not responsible for any financial losses incurred through the use of this software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fwt3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foasisprotocol%2Fwt3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foasisprotocol%2Fwt3/lists"}