Skip to content

HanSoBored/CryptoScope

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

CryptoScope πŸ”

Multi-exchange crypto symbols intelligence tool

Fetch and analyze perpetual/derivative symbols from crypto exchanges with a clean, modular CLI interface.

Features

  • βœ… Fetch all perpetual and derivative symbols from Bybit V5 API
  • βœ… Support for both linear (USDT) and inverse categories
  • βœ… Automatic pagination handling
  • βœ… Filter by symbol name or status
  • βœ… Multiple output formats (text, JSON, interactive TUI)
  • βœ… Modular architecture - easy to add new exchanges
  • βœ… Fast execution (< 3 seconds for all symbols)

Installation

# Clone and build
git clone https://github.com/HanSoBored/CryptoScope
cd cryptoscope
cargo build --release

# Or install directly
cargo install --path .

Usage

Basic Usage

# Fetch all symbols from Bybit (linear + inverse)
cryptoscope

# Fetch only linear (USDT perpetual) symbols
cryptoscope --category linear

# Fetch only inverse perpetual symbols
cryptoscope --category inverse

Output Formats

# Human-readable text output (default)
cryptoscope --output text

# Machine-readable JSON output
cryptoscope --output json > symbols.json

# Interactive terminal UI (TUI)
cryptoscope --output tui

Filtering

# Search for symbols containing "BTC"
cryptoscope --search BTC

# Combine filters
cryptoscope --search ETH --category linear

Other Options

# Enable verbose logging
cryptoscope --verbose

# See all available options
cryptoscope --help

Example Output

Text Output

=== CryptoScope: BYBIT Perpetual Symbols ===

Exchange: BYBIT
Categories: linear, inverse

πŸ“Š Statistics:
  Total Symbols: 669

  By Category:
    INVERSE (Inverse Perpetual): 27
    LINEAR (USDT Perpetual): 642

  By Contract Type:
    LinearPerpetual: 606
    LinearFutures: 36
    InversePerpetual: 23
    InverseFutures: 4

πŸ“‹ Sample Symbols (first 20):
  0GUSDT, 1000000BABYDOGEUSDT, 1000000CHEEMSUSDT, ...
  ... and 649 more

βœ… Fetch completed in 3.1s

TUI Output

Launch the interactive terminal UI:

cryptoscope --output tui

The TUI features:

  • Symbol table - Scrollable list with selection highlighting
  • Stats dashboard - Toggle with Tab to view statistics
  • Search - Press / to filter symbols in real-time
  • Refresh - Press r to re-fetch symbols from the API
  • Cyberpunk theme - Dark UI with neon accent colors

Key bindings:

Key Action
q / Esc Quit
j / ↓ Next symbol
k / ↑ Previous symbol
/ Toggle search mode
Tab Toggle symbol list / stats view
r Refresh data

Architecture

CryptoScope uses a trait-based architecture for easy extensibility:

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚           CLI Layer                 β”‚
β”‚  (main.rs + cli.rs)                 β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚
                 β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚      Exchange Trait                 β”‚
β”‚  (exchange/exchange_trait.rs)       β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β–²                  β–²
         β”‚                  β”‚
  β”Œβ”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”
  β”‚ BybitClient β”‚   β”‚ BinanceClient  β”‚ (future)
  β”‚  (v1.0)     β”‚   β”‚  (v2.0)        β”‚
  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Adding a New Exchange

To add support for a new exchange (e.g., Binance):

  1. Create src/exchange/binance.rs
  2. Implement the Exchange trait
  3. Add to the factory in src/exchange/factory.rs

That's it! No changes to existing code required.

Project Structure

cryptoscope/
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ main.rs                 # Entry point
β”‚   β”œβ”€β”€ cli.rs                  # CLI argument parsing
β”‚   β”œβ”€β”€ error.rs                # Error types
β”‚   β”œβ”€β”€ models/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ symbol.rs           # Symbol struct
β”‚   β”‚   β”œβ”€β”€ response.rs         # API responses
β”‚   β”‚   └── statistics.rs       # Statistics aggregation
β”‚   β”œβ”€β”€ exchange/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ exchange_trait.rs   # Exchange trait
β”‚   β”‚   β”œβ”€β”€ bybit.rs            # Bybit implementation
β”‚   β”‚   └── factory.rs          # Exchange factory
β”‚   β”œβ”€β”€ fetcher/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   └── instrument_fetcher.rs
β”‚   β”œβ”€β”€ output/
β”‚   β”‚   β”œβ”€β”€ mod.rs
β”‚   β”‚   β”œβ”€β”€ formatter.rs        # Text output
β”‚   β”‚   └── json_output.rs      # JSON output
β”‚   └── tui/
β”‚       β”œβ”€β”€ mod.rs
β”‚       β”œβ”€β”€ app.rs              # App state management
β”‚       β”œβ”€β”€ runner.rs           # TUI event loop
β”‚       β”œβ”€β”€ theme.rs            # Cyberpunk color theme
β”‚       └── widgets/
β”‚           β”œβ”€β”€ mod.rs
β”‚           β”œβ”€β”€ header.rs       # Header widget
β”‚           β”œβ”€β”€ footer.rs       # Footer widget
β”‚           β”œβ”€β”€ popup.rs        # Popup/notification widget
β”‚           β”œβ”€β”€ stats_panel.rs  # Stats dashboard widget
β”‚           └── symbol_table.rs # Symbol table widget
└── tests/

Tech Stack

  • tokio - Async runtime
  • reqwest - HTTP client
  • serde + serde_json - JSON serialization
  • clap - CLI framework
  • thiserror + anyhow - Error handling
  • tracing - Logging
  • ratatui - Terminal UI framework
  • crossterm - Terminal manipulation
  • unicode-width - Unicode string width calculation

Current Status

Supported Exchanges

  • βœ… Bybit V5 (linear + inverse perpetual/futures)

Planned

  • ⏳ Binance Futures
  • ⏳ OKX Derivatives
  • ⏳ Symbol comparison across exchanges

License

GNU General Public License v3.0 (GPL-3.0)

Contributing

Contributions welcome! Please feel free to submit a Pull Request.