Skip to content

feat: add price screener with SQLite caching and refactor codebase#7

Merged
HanSoBored merged 15 commits intomainfrom
feat/screener-and-refactor
Apr 26, 2026
Merged

feat: add price screener with SQLite caching and refactor codebase#7
HanSoBored merged 15 commits intomainfrom
feat/screener-and-refactor

Conversation

@HanSoBored
Copy link
Copy Markdown
Collaborator

Summary

  • Add Price Screener — New cryptoscope screener subcommand with SQLite-backed open price caching, concurrent kline/ticker fetching, and formatted terminal output with color-coded gainers/losers
  • Add Database Layer — SQLite with schema migrations, connection pooling, and UPSERT semantics for open price storage
  • Refactor Codebase — Replace struct-based modules (TextFormatter, CyberdeckTheme, InstrumentFetcher, TuiApp) with idiomatic free functions
  • Add CLI Subcommands — Restructured CLI with screener subcommand, CommonArgs struct, and --exchange flag
  • Improve TUI — Extract LogGuard RAII struct, add popup messages, clickable header tabs, and mouse support
  • Update README — Document screener feature, all CLI flags, TUI interactions, and fix outdated paths

Changes

New Features

  • cryptoscope screener — Price screener with DB caching (kline & ticker modes)
  • --exchange / -e flag for exchange selection
  • --symbol filter for screener output
  • SQLite database with automatic migrations
  • TUI popup messages (5s timeout, dismissible)
  • Clickable header tabs in TUI

Refactoring

  • TextFormatter → free functions (src/output/)
  • CyberdeckTheme → module constants (src/tui/theme.rs)
  • InstrumentFetcher → free functions (src/fetcher/)
  • TuiAppTuiLifecycle + LogGuard (src/tui/runner.rs)
  • HasCategory trait → parse_categories_from() free function
  • Arc<Mutex<usize>>AtomicUsize for counters
  • INSERT OR REPLACEON CONFLICT DO UPDATE for true upsert

Code Quality

  • Deterministic JSON serialization (sorted keys)
  • True concurrent streaming (mpsc channel + semaphore)
  • Bounds-safe parse_kline_field with .get(idx)
  • Single-pass .fold() for group statistics
  • Added WHY comments for complex logic

Commits

# Commit Description
1 feat(db) SQLite database layer with migration support
2 feat(utils) Logging system, shared utilities, test helpers
3 feat(screener) Price fetcher with concurrent kline fetching
4 feat(screener) Screener orchestration and calculator
5 refactor(cli) Subcommands, CommonArgs, error handling
6 refactor(exchange) Simplify bybit client, free functions
7 refactor(models) Response types, deterministic serialization
8 refactor(output) Replace TextFormatter with free functions
9 refactor(tui) TuiLifecycle, LogGuard, theme constants
10 refactor(tui) Widgets, sorted stats, popup messages
11 docs README update with screener and new flags

Verification

  • Build: ✅ Pass
  • Lint (clippy): ✅ Pass
  • Tests: ✅ Pass (57/57)

- Fix status filtering: only symbol name search is supported
- Fix installation path: directory is CryptoScope (not cryptoscope)
- Add mouse support documentation (scroll, click rows, scrollbar)
Copy link
Copy Markdown
Collaborator Author

@HanSoBored HanSoBored left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, needs Update README

Copy link
Copy Markdown
Collaborator Author

@HanSoBored HanSoBored left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge!

@HanSoBored HanSoBored merged commit 5142fbb into main Apr 26, 2026
3 checks passed
@HanSoBored HanSoBored deleted the feat/screener-and-refactor branch April 26, 2026 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant