Skip to content

BitQuant is an open-source AI agent framework for building quantitative AI agents, leveraging specialized models for ML-powered analytics, trading, portfolio management, and more.

License

Notifications You must be signed in to change notification settings

DevDendrite/BitQuant

Β 
Β 

Repository files navigation

BitQuant Banner

GitHub stars Try BitQuant Documentation


πŸš€ BitQuant by OpenGradient

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.


πŸ“‘ Table of Contents


✨ Features

  • πŸ€– 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

πŸ—οΈ Architecture

BitQuant Architecture Diagram

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

Agents

  • 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.

βš™οΈ Installation

make venv
source venv/bin/activate
make install

🚦 Usage

Environment Variables

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:

Required Environment 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

Optional Environment Variables

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

Running the Service

  1. Create your .env file with the required variables:

    # Copy and edit the environment variables above
  2. Build the server:

    make docker
  3. Start the server:

    make prod

BitQuant Example Query

You can also try BitQuant instantly on the production server.


πŸ’‘ Sample Questions

Here are some example queries you can try with BitQuant:

🏦 DeFi Interactions

  • 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?

πŸ“Š Portfolio Analytics

  • 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?

πŸ“ˆ Market Insights

  • 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?

πŸ§‘β€πŸ’» Types of Agents You Can Build

BitQuant is designed to support a wide range of quantitative and DeFi-focused AI agents. Out of the box, the framework includes:

1. Analytics Agent

  • 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."

2. Investor Agent

  • 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."

3. Custom Agents

  • 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.


πŸ› οΈ Configuration

  • 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.

πŸ”Œ Integrations

  • REST API: Exposes endpoints for agent interaction
  • Bittensor Subnet: For decentralized compute
  • Custom LLM Prompts: In templates/

πŸ§ͺ Testing

To run all tests:

make test

πŸš€ Deployment

Build and run in production:

make docker
make prod

🀝 Contributing

Contributions are welcome! Please open issues or pull requests for features, bugs, or documentation improvements.

  1. Fork the repo
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

πŸ’¬ Contact


Empowering next-gen quantitative AI agents with OpenGradient.

About

BitQuant is an open-source AI agent framework for building quantitative AI agents, leveraging specialized models for ML-powered analytics, trading, portfolio management, and more.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 94.9%
  • Jinja 4.1%
  • Other 1.0%