Skip to content

Adeebrq/SaroScope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

15 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SaroScope – A DLMM Backtesting Platform

SaroScope Demo

Overview

SaroScope is a DLMM backtesting platform for Solana's Dynamic Liquidity Market Makers. Built with the Saros Finance SDK, it enables users to backtest strategies against historical data, compare performance, and optimize liquidity provision decisions through advanced analytics and real-time pool monitoring.

Features

  • πŸ“Š Advanced Backtesting Engine
    Test DLMM strategies against comprehensive historical data with precision analytics and detailed performance metrics.

  • 🎯 Smart Range Optimization

  • Our analysis identifies the most profitable price ranges for liquidity positions.

  • πŸ“ˆ Real-Time Analytics
    Monitor DLMM positions with live data feeds, instant performance tracking, and real-time market insights.

  • πŸ”„ Strategy Comparison
    Compare multiple DLMM strategies side-by-side with detailed performance metrics, APY calculations, and risk assessments.

  • πŸ’§ Pool Health Monitoring
    Track pool liquidity, volume, and activity levels to identify optimal entry points.

  • 🎨 Interactive Visualizations
    Beautiful charts and graphs powered by Recharts and custom Rive animations for enhanced user experience.

  • πŸ“± Mobile responsive
    SarosScope supports accesibility across all devices.

πŸŽ₯ Demo Video

SaroScope Demo

Click the thumbnail above to watch the full demo (3:53)

Tech Stack

  • Frontend: Next.js 15, React 19, TypeScript, Tailwind CSS
  • Animations: Rive (interactive animations), Custom CSS animations
  • Charts & Visualizations: Recharts, Custom chart components
  • Blockchain Integration: @saros-finance/dlmm-sdk, @solana/web3.js
  • Data Services: Custom price data services, Jupiter API integration
  • UI Components: Lucide React icons, Custom component library

Setup Instructions

Prerequisites

  • Node.js (v18+ recommended)
  • npm or yarn package manager
  • Solana RPC endpoint (recommended: Helius)
  • Basic understanding of DeFi and liquidity provision

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/soradlmm.git
    cd soradlmm/app
  2. Install Dependencies

    npm install
  3. Environment Configuration

    Create a .env.local file in the app directory:

    # Solana RPC Configuration
    NEXT_PUBLIC_SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
    NEXT_PUBLIC_SOLANA_NETWORK=mainnet-beta
    
    # Optional: Custom RPC endpoints for better performance
    NEXT_PUBLIC_HELIUS_RPC_URL=your_helius_endpoint
    NEXT_PUBLIC_QUICKNODE_RPC_URL=your_quicknode_endpoint
    
    # Price Data APIs
    NEXT_PUBLIC_JUPITER_API_URL=https://price.jup.ag/v4
    NEXT_PUBLIC_BIRDEYE_API_URL=https://public-api.birdeye.so/public
  4. Start Development Server

    npm run dev
  5. Build for Production

    npm run build
    npm start

πŸ“ Project Structure

soradlmm/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ app/
β”‚   β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”‚   └── price-data/
β”‚   β”‚   β”‚       └── route.ts
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ sections/
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ bentoGrid.tsx          # Interactive feature cards
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ heroSection.tsx        # Landing page hero
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ problemStatement.tsx   # Problem/solution section
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ saros.tsx              # Saros protocol info
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ faq.tsx                # FAQ section
β”‚   β”‚   β”‚   β”‚   └── footer.tsx             # Footer component
β”‚   β”‚   β”‚   β”œβ”€β”€ BacktesterForm.tsx         # Main backtesting form
β”‚   β”‚   β”‚   β”œβ”€β”€ ResultsDisplay.tsx         # Results visualization
β”‚   β”‚   β”‚   β”œβ”€β”€ ComparisonChart.tsx        # Strategy comparison charts
β”‚   β”‚   β”‚   β”œβ”€β”€ PerformanceChart.tsx       # Performance line charts
β”‚   β”‚   β”‚   β”œβ”€β”€ RangeVisualization.tsx     # Price range visualization
β”‚   β”‚   β”‚   └── StrategyComparison.tsx     # Strategy comparison logic
β”‚   β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”‚   └── page.tsx                   # Dashboard page
β”‚   β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”‚   β”œβ”€β”€ sarosService.ts            # Saros SDK integration
β”‚   β”‚   β”‚   β”œβ”€β”€ backtester.ts              # Backtesting engine
β”‚   β”‚   β”‚   β”œβ”€β”€ priceDataService.ts        # Price data fetching
β”‚   β”‚   β”‚   └── utils.ts                   # Utility functions
β”‚   β”‚   β”œβ”€β”€ types/
β”‚   β”‚   β”‚   └── index.ts                   # TypeScript definitions
β”‚   β”‚   β”œβ”€β”€ globals.css                    # Global styles
β”‚   β”‚   β”œβ”€β”€ layout.tsx                     # Root layout
β”‚   β”‚   └── page.tsx                       # Home page
β”‚   β”œβ”€β”€ public/
β”‚   β”‚   β”œβ”€β”€ assets/                        # Static assets
β”‚   β”‚   β”œβ”€β”€ *.riv                          # Rive animation files
β”‚   β”‚   └── *.svg                          # SVG icons
β”‚   β”œβ”€β”€ package.json
β”‚   β”œβ”€β”€ next.config.ts
β”‚   β”œβ”€β”€ tsconfig.json
β”‚   └── tailwind.config.js
└── README.md

πŸš€ Key Features Deep Dive

Advanced Backtesting Engine

  • Historical Data Analysis: Uses real Solana network price data for accurate backtesting
  • Multiple Strategy Types: Concentrated, Wide Range, and Active Rebalancing strategies
  • Performance Metrics: ROI, APY, time in range, impermanent loss calculations
  • Risk Assessment: Pool health monitoring and liquidity analysis.

Real-Time Data Integration

  • Live Price Feeds: Jupiter and Birdeye API integration for real-time market data
  • Pool Monitoring: Real-time tracking of Saros DLMM pool metrics
  • Dynamic Calculations: SDK-powered fee and liquidity calculations

Interactive Visualizations

  • Strategy Comparison Charts: Side-by-side performance comparison
  • Price Range Visualization: Interactive charts showing optimal liquidity ranges
  • Performance Tracking: Historical performance with detailed metrics
  • Rive Animations: Smooth, interactive animations for enhanced UX

πŸ”§ Configuration

Solana Network Configuration

The platform supports both mainnet and devnet configurations:

// Mainnet pools (production)
const MAINNET_POOLS = {
  'SOL/USDC': {
    address: '8vZHTVMdYvcPFUoHBEbcFyfSKnjWtvbNgYpXg1aiC2uS',
    baseTicker: 'SOL',
    quoteTicker: 'USDC'
  }
  // Add more pools as needed
};

Custom RPC Endpoints

For better performance, configure custom RPC endpoints in your environment variables:

# High-performance RPC endpoints
NEXT_PUBLIC_HELIUS_RPC_URL=https://mainnet.helius-rpc.com/?api-key=your-key
NEXT_PUBLIC_QUICKNODE_RPC_URL=https://your-endpoint.solana-mainnet.quiknode.pro/your-key/

πŸ“Š Supported Strategies

1. Concentrated Strategy

  • Description: High-yield strategy with tight price ranges
  • Best For: Experienced users with high risk tolerance
  • Features: Custom range selection, high APY potential

2. Wide Range Strategy

  • Description: Conservative strategy with broader price ranges
  • Best For: Beginners and risk-averse users
  • Features: Lower risk, more stable returns

3. Active Rebalancing Strategy

  • Description: Dynamic strategy that adjusts ranges based on market conditions
  • Best For: Active traders who can monitor positions
  • Features: Automated rebalancing, threshold-based adjustments

🎯 Usage Examples

Basic Backtesting

// Example backtest configuration
const backtestParams = {
  investmentAmount: 5000,
  strategyType: StrategyType.CONCENTRATED,
  tokenPair: 'SOL/USDC',
  concentrationRange: { min: 49, max: 52 },
  timePeriod: 30 // days
};

Strategy Comparison

// Compare multiple strategies
const strategies = [
  StrategyType.CONCENTRATED,
  StrategyType.WIDE,
  StrategyType.ACTIVE_REBALANCING
];

// Get comparative results
const results = await compareStrategies(backtestParams, strategies);

πŸ› οΈ Development

Running Tests

npm run lint          # ESLint checking
npm run build         # Production build
npm run dev           # Development server

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run tests and ensure build passes
  5. Submit a pull request

πŸ“ˆ Performance Optimization

  • Lazy Loading: Components are loaded on demand
  • Data Caching: Price data is cached for better performance
  • Optimized RPC Calls: Batched requests and connection pooling
  • Bundle Optimization: Next.js automatic code splitting

πŸ”’ Security Considerations

  • RPC Endpoint Security: Use secure, private RPC endpoints for production
  • API Key Management: Store sensitive keys in environment variables
  • Input Validation: All user inputs are validated and sanitized
  • Error Handling: Comprehensive error handling prevents data leaks

πŸ“š Documentation

🀝 Support

For technical support or questions:

  • Create an issue in the GitHub repository
  • Join our Discord community
  • Check the FAQ section in the application

πŸ“„ License

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

πŸ™ Acknowledgments

  • Saros Finance for the DLMM SDK and protocol
  • Solana Foundation for the blockchain infrastructure
  • Jupiter and Birdeye for price data APIs
  • Rive for the interactive animations

Built with ❀️ for the DeFi community

About

A DLMM backtesting platform, Transform speculation into strategy. Backtest DLMM positions and maximize Saros yields with proven analytics.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors