|
1 | | -# BitQuant by OpenGradient |
| 1 | +<p align="center"> |
| 2 | + <img src="https://raw.githubusercontent.com/OpenGradient/public_images/refs/heads/main/bitquant_readme_banner.png" alt="BitQuant Banner"/> |
| 3 | +</p> |
2 | 4 |
|
3 | | -BitQuant is an open-source AI agent framework for building AI Quant agents for quantitative DeFi including ML-powered analytics, trading, portfolio management, and more all through a natural language interface. It exposes a REST API that turns user inputs like "deposit 20k" or "optimize my portfolio" into concrete DeFi actions. |
| 5 | +<p align="center"> |
| 6 | + <a href="https://github.com/OpenGradient/BitQuant/stargazers"><img src="https://img.shields.io/github/stars/OpenGradient/BitQuant?style=social" alt="GitHub stars"></a> |
| 7 | + <a href="https://www.bitquant.io/"><img src="https://img.shields.io/badge/Try%20BitQuant-bitquant.io-blue?logo=chrome-browser" alt="Try BitQuant"></a> |
| 8 | + <a href="https://docs.opengradient.ai/"><img src="https://img.shields.io/badge/Documentation-OpenGradient%20Docs-orange?logo=readthedocs" alt="Documentation"></a> |
| 9 | +</p> |
4 | 10 |
|
5 | | -## Structure |
| 11 | +--- |
6 | 12 |
|
7 | | -- `agent`: contains the agent logic and tool definitions |
8 | | -- `api`: Server API input/output types |
9 | | -- `onchain`: Contains all classes that pull data about tokens, pools, etc |
10 | | -- `server`: contains Flask server that exposes API to interact with agent |
11 | | -- `static`: Static assets for the web interface |
12 | | -- `subnet`: Bittensor Subnet-related functionality |
13 | | -- `templates`: LLM prompt templates for agent |
14 | | -- `testclient`: Client for testing the API |
15 | | -- `testutils`: Utility functions for testing |
| 13 | +# 🚀 BitQuant by OpenGradient |
16 | 14 |
|
17 | | -## Agents |
| 15 | +**BitQuant** is a open-source AI agent framework for building quantitative AI agents. It leverages specialized models for ML-powered analytics, trading, portfolio management, and more—all through a natural language interface. BitQuant exposes a REST API that turns user inputs like "What is the current risk profile on Bitcoin?" or "Optimize my portfolio for maximum risk-adjusted returns" into actionable insights. |
18 | 16 |
|
19 | | -Behind the scenes there are 2 agents with distinct responsibilities: |
20 | | -- `analytics agent`: responsible for crypto analytics, such as price trends, risks, trending tokens etc |
21 | | -- `investment agent`: currently responsible for helping users select a lending/amm pool to maximize returns on their tokens on Solana |
| 17 | +--- |
22 | 18 |
|
23 | | -Inside `server.py` there is a router prompt that decides which agent the user's query should go to. |
| 19 | +## 📑 Table of Contents |
24 | 20 |
|
25 | | -## Setup |
| 21 | +- [Features](#features) |
| 22 | +- [Architecture](#architecture) |
| 23 | +- [Installation](#installation) |
| 24 | +- [Usage](#usage) |
| 25 | +- [Configuration](#configuration) |
| 26 | +- [Integrations](#integrations) |
| 27 | +- [Testing](#testing) |
| 28 | +- [Deployment](#deployment) |
| 29 | +- [Contributing](#contributing) |
| 30 | +- [License](#license) |
| 31 | +- [Contact](#contact) |
26 | 32 |
|
27 | | -1. `make venv` |
28 | | -2. Activate virtual environment - `source venv/bin/activate` |
29 | | -3. `make install` |
30 | | -4. Create `.env` file and add `OG_PRIVATE_KEY` set to your OpenGradient private key |
31 | | -5. `make run` |
32 | | -6. (Optional) Run `make sample` for a sample query |
| 33 | +--- |
33 | 34 |
|
34 | | -## Testing |
| 35 | +## ✨ Features |
35 | 36 |
|
36 | | -To run all tests, run `make test` |
| 37 | +- 🤖 Build and deploy quantitative AI agents for analytics, trading, and portfolio management |
| 38 | +- 🧠 Natural language interface for complex financial queries |
| 39 | +- 🔌 Modular architecture with agent and tool plug-ins |
| 40 | +- 📈 Real-time crypto analytics and risk profiling |
| 41 | +- 🌐 REST API for seamless integration |
| 42 | +- ⚡ Fast setup and extensible codebase |
37 | 43 |
|
38 | | -## Deployment |
| 44 | +## 🏗️ Architecture |
39 | 45 |
|
40 | | -1. `make docker` |
41 | | -2. `make prod` |
| 46 | +<p align="center"> |
| 47 | + <img src="https://raw.githubusercontent.com/OpenGradient/public_images/refs/heads/main/bitquant_architecture.png" alt="BitQuant Architecture Diagram" width="100%"/> |
| 48 | +</p> |
| 49 | + |
| 50 | +``` |
| 51 | +agent/ # Agent logic and tool definitions |
| 52 | +api/ # Server API input/output types |
| 53 | +onchain/ # Classes for on-chain data (tokens, pools, etc.) |
| 54 | +server/ # Flask server exposing the API |
| 55 | +static/ # Static assets for web interface |
| 56 | +subnet/ # Bittensor Subnet-related functionality |
| 57 | +templates/ # LLM prompt templates for agent |
| 58 | +testclient/ # Client for testing the API |
| 59 | +testutils/ # Utility functions for testing |
| 60 | +``` |
| 61 | + |
| 62 | +### Agents |
| 63 | + |
| 64 | +- **Analytics Agent**: Handles crypto analytics (price trends, risks, trending tokens, etc.) |
| 65 | +- **Investment Agent**: Helps users select lending/AMM pools to maximize returns on Solana |
| 66 | + |
| 67 | +> The router in `server.py` decides which agent to use for each user query. |
| 68 | +
|
| 69 | +## ⚙️ Installation |
| 70 | + |
| 71 | +```bash |
| 72 | +make venv |
| 73 | +source venv/bin/activate |
| 74 | +make install |
| 75 | +``` |
| 76 | + |
| 77 | +## 🚦 Usage |
| 78 | + |
| 79 | +1. Copy the example environment file and fill out your credentials: |
| 80 | + ```bash |
| 81 | + cp .env.example .env |
| 82 | + # Edit .env and fill in the required values |
| 83 | + ``` |
| 84 | +2. Run the server: |
| 85 | + ```bash |
| 86 | + make run |
| 87 | + ``` |
| 88 | +3. (Optional) Try a sample query: |
| 89 | + ```bash |
| 90 | + make sample |
| 91 | + ``` |
| 92 | + |
| 93 | +<p align="center"> |
| 94 | + <img src="https://raw.githubusercontent.com/OpenGradient/public_images/refs/heads/main/bitquant_example_image_2.png" alt="BitQuant Example Query" width="100%"/> |
| 95 | +</p> |
| 96 | + |
| 97 | +You can also try BitQuant instantly on the <a href="https://www.bitquant.io/">production server</a>. |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +## 💡 Sample Questions |
| 102 | + |
| 103 | +Here are some example queries you can try with BitQuant: |
| 104 | + |
| 105 | +### 🏦 DeFi Interactions |
| 106 | +- Which protocols are delivering the best risk-adjusted yields right now? |
| 107 | +- What's my potential impermanent loss risk if I provide liquidity to the USDC-SOL pool under different market scenarios? |
| 108 | +- Calculate a comprehensive risk score for the top 5 Solana DeFi protocols based on TVL trends, code audits, and historical performance |
| 109 | +- Compare the TVL growth, volatility, and stability metrics for Kamino vs Orca vs Raydium |
| 110 | +- Which lending protocols have maintained the most stable yields over the past 3 months? |
| 111 | + |
| 112 | +### 📊 Portfolio Analytics |
| 113 | +- Can you analyze my portfolio's rolling volatility and identify which assets are contributing most to risk? |
| 114 | +- How do the volatility trends of my top portfolio assets compare over the last 90 days? |
| 115 | +- Show me the correlation between my holdings and provide insights on how to better diversify? |
| 116 | +- What's my current portfolio risk assessment and how can I optimize for a better risk-return ratio? |
| 117 | +- What's the maximum drawdown for my current portfolio and how does it compare to market benchmarks? |
| 118 | + |
| 119 | +### 📈 Market Insights |
| 120 | +- Based on current volatility trends and price patterns, what phase of the market cycle are we likely in? |
| 121 | +- Based on historical data, what's the volatility forecast for BTC and ETH in the coming month? |
| 122 | + |
| 123 | +--- |
| 124 | + |
| 125 | +## 🧑💻 Types of Agents You Can Build |
| 126 | + |
| 127 | +BitQuant is designed to support a wide range of quantitative and DeFi-focused AI agents. Out of the box, the framework includes: |
| 128 | + |
| 129 | +### 1. Analytics Agent |
| 130 | +- **Purpose:** Provides deep analytics on portfolios, tokens, protocols, and market trends. |
| 131 | +- **Capabilities:** |
| 132 | + - Analyze portfolio volatility, drawdowns, and diversification |
| 133 | + - Evaluate token and protocol risks |
| 134 | + - Track TVL, yield, and performance metrics |
| 135 | + - Identify trends and generate actionable market insights |
| 136 | +- **Example Use Cases:** |
| 137 | + - "Analyze my portfolio’s risk profile." |
| 138 | + - "Show TVL trends for Solana DeFi protocols." |
| 139 | + |
| 140 | +### 2. Investor Agent |
| 141 | +- **Purpose:** Helps users find and act on yield opportunities and optimize DeFi strategies. |
| 142 | +- **Capabilities:** |
| 143 | + - Recommend optimal pools and lending opportunities |
| 144 | + - Compare APRs, TVL, and risk across protocols |
| 145 | + - Guide users through liquidity provision, lending, and yield farming |
| 146 | +- **Example Use Cases:** |
| 147 | + - "Which pools offer the best stablecoin yields?" |
| 148 | + - "Compare Kamino and Orca for USDC/SOL." |
| 149 | + |
| 150 | +### 3. Custom Agents |
| 151 | +- **Purpose:** The framework is extensible—developers can build agents for: |
| 152 | + - Automated trading strategies |
| 153 | + - On-chain data monitoring and alerting |
| 154 | + - NFT analytics |
| 155 | + - Cross-chain portfolio management |
| 156 | + - Any custom DeFi or analytics workflow |
| 157 | + |
| 158 | +> **Tip:** Agents are modular and can be combined, routed, or extended to suit your specific use case. See the `agent/` directory and templates for examples and customization. |
| 159 | +
|
| 160 | +--- |
| 161 | + |
| 162 | +## 🛠️ Configuration |
| 163 | + |
| 164 | +- All configuration is handled via the `.env` file, which you can generate from `.env.example`. |
| 165 | +- Fill in all required secrets and keys as described in `.env.example`. |
| 166 | + |
| 167 | +## 🔌 Integrations |
| 168 | + |
| 169 | +- **REST API**: Exposes endpoints for agent interaction |
| 170 | +- **Bittensor Subnet**: For decentralized compute |
| 171 | +- **Custom LLM Prompts**: In `templates/` |
| 172 | + |
| 173 | +## 🧪 Testing |
| 174 | + |
| 175 | +To run all tests: |
| 176 | +```bash |
| 177 | +make test |
| 178 | +``` |
| 179 | + |
| 180 | +## 🚀 Deployment |
| 181 | + |
| 182 | +Build and run in production: |
| 183 | +```bash |
| 184 | +make docker |
| 185 | +make prod |
| 186 | +``` |
| 187 | + |
| 188 | +## 🤝 Contributing |
| 189 | + |
| 190 | +Contributions are welcome! Please open issues or pull requests for features, bugs, or documentation improvements. |
| 191 | + |
| 192 | +1. Fork the repo |
| 193 | +2. Create your feature branch (`git checkout -b feature/AmazingFeature`) |
| 194 | +3. Commit your changes (`git commit -m 'Add some AmazingFeature'`) |
| 195 | +4. Push to the branch (`git push origin feature/AmazingFeature`) |
| 196 | +5. Open a Pull Request |
| 197 | + |
| 198 | +## 📄 License |
| 199 | + |
| 200 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 201 | + |
| 202 | +## 💬 Contact |
| 203 | + |
| 204 | +- Powered by [OpenGradient](https://opengradient.ai) |
| 205 | +- Try Bitquant at [bitquant.io](https://www.bitquant.io/) |
| 206 | +- OpenGradient Documentation: [OpenGradient Docs](https://docs.opengradient.ai/) |
| 207 | +- Join the discussion: [GitHub Discussions](https://github.com/OpenGradient/BitQuant/discussions) |
| 208 | +- Support: [BitQuant Discord](https://discord.com/channels/1132794141403791483/1377340212576911410) |
| 209 | + |
| 210 | +--- |
| 211 | + |
| 212 | +<p align="center"> |
| 213 | + <em>Empowering next-gen quantitative AI agents with OpenGradient.</em> |
| 214 | +</p> |
0 commit comments