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.
- Features
- Architecture
- Installation
- Usage
- Configuration
- Integrations
- Testing
- Deployment
- Contributing
- License
- Contact
- π€ Build and deploy quantitative AI agents for analytics, trading, and portfolio management
- π§ Natural language interface for complex financial queries
- π Modular architecture with agent and tool plug-ins
- π Real-time crypto analytics and risk profiling
- π REST API for seamless integration
- β‘ Fast setup and extensible codebase
agent/ # Agent logic and tool definitions
api/ # Server API input/output types
onchain/ # Classes for on-chain data (tokens, pools, etc.)
server/ # Flask server exposing the API
static/ # Static assets for web interface
subnet/ # Bittensor Subnet-related functionality
templates/ # LLM prompt templates for agent
testclient/ # Client for testing the API
testutils/ # Utility functions for testing
- Analytics Agent: Handles crypto analytics (price trends, risks, trending tokens, etc.)
- Investment Agent: Helps users select lending/AMM pools to maximize returns on Solana
The router in
server.py
decides which agent to use for each user query.
make venv
source venv/bin/activate
make install
Before running the service, you need to set up the following environment variables. Create a .env
file in the root directory with the following variables:
Firebase Authentication:
FIREBASE_PROJECT_ID=your_firebase_project_id
FIREBASE_PRIVATE_KEY_ID=your_private_key_id
FIREBASE_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----\nYour private key here\n-----END PRIVATE KEY-----"
FIREBASE_CLIENT_EMAIL=your_service_account_email
FIREBASE_CLIENT_ID=your_client_id
FIREBASE_CLIENT_X509_CERT_URL=your_cert_url
Solana RPC:
SOLANA_RPC_URL=your_solana_rpc_endpoint
API Keys:
OPENROUTER_API_KEY=your_openrouter_api_key
GEMINI_API_KEY=your_gemini_api_key
COINGECKO_API_KEY=your_coingecko_api_key
AWS (for DynamoDB):
AWS_ACCESS_KEY_ID=your_aws_access_key
AWS_SECRET_ACCESS_KEY=your_aws_secret_key
AWS_REGION=your_aws_region
Datadog Monitoring:
DD_API_KEY=your_datadog_api_key
DD_APP_KEY=your_datadog_app_key
DD_HOSTNAME=your_hostname
Cloudflare Turnstile (for CAPTCHA):
CLOUDFLARE_TURNSTILE_SECRET_KEY=your_turnstile_secret_key
Environment:
ENVIRONMENT=development
-
Create your
.env
file with the required variables:# Copy and edit the environment variables above
-
Build the server:
make docker
-
Start the server:
make prod
You can also try BitQuant instantly on the production server.
Here are some example queries you can try with BitQuant:
- Which protocols are delivering the best risk-adjusted yields right now?
- What's my potential impermanent loss risk if I provide liquidity to the USDC-SOL pool under different market scenarios?
- Calculate a comprehensive risk score for the top 5 Solana DeFi protocols based on TVL trends, code audits, and historical performance
- Compare the TVL growth, volatility, and stability metrics for Kamino vs Orca vs Raydium
- Which lending protocols have maintained the most stable yields over the past 3 months?
- Can you analyze my portfolio's rolling volatility and identify which assets are contributing most to risk?
- How do the volatility trends of my top portfolio assets compare over the last 90 days?
- Show me the correlation between my holdings and provide insights on how to better diversify?
- What's my current portfolio risk assessment and how can I optimize for a better risk-return ratio?
- What's the maximum drawdown for my current portfolio and how does it compare to market benchmarks?
- Based on current volatility trends and price patterns, what phase of the market cycle are we likely in?
- Based on historical data, what's the volatility forecast for BTC and ETH in the coming month?
BitQuant is designed to support a wide range of quantitative and DeFi-focused AI agents. Out of the box, the framework includes:
- Purpose: Provides deep analytics on portfolios, tokens, protocols, and market trends.
- Capabilities:
- Analyze portfolio volatility, drawdowns, and diversification
- Evaluate token and protocol risks
- Track TVL, yield, and performance metrics
- Identify trends and generate actionable market insights
- Example Use Cases:
- "Analyze my portfolioβs risk profile."
- "Show TVL trends for Solana DeFi protocols."
- Purpose: Helps users find and act on yield opportunities and optimize DeFi strategies.
- Capabilities:
- Recommend optimal pools and lending opportunities
- Compare APRs, TVL, and risk across protocols
- Guide users through liquidity provision, lending, and yield farming
- Example Use Cases:
- "Which pools offer the best stablecoin yields?"
- "Compare Kamino and Orca for USDC/SOL."
- Purpose: The framework is extensibleβdevelopers can build agents for:
- Automated trading strategies
- On-chain data monitoring and alerting
- NFT analytics
- Cross-chain portfolio management
- Any custom DeFi or analytics workflow
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.
- All configuration is handled via the
.env
file, which you can generate from.env.example
. - Fill in all required secrets and keys as described in
.env.example
.
- REST API: Exposes endpoints for agent interaction
- Bittensor Subnet: For decentralized compute
- Custom LLM Prompts: In
templates/
To run all tests:
make test
Build and run in production:
make docker
make prod
Contributions are welcome! Please open issues or pull requests for features, bugs, or documentation improvements.
- Fork the repo
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for details.
- Powered by OpenGradient
- Try Bitquant at bitquant.io
- OpenGradient Documentation: OpenGradient Docs
- Join the discussion: GitHub Discussions
- Support: BitQuant Discord
Empowering next-gen quantitative AI agents with OpenGradient.