Skip to content

Conversation

@zahorodnyi
Copy link
Collaborator

@zahorodnyi zahorodnyi commented Jan 15, 2026

Usage: cargo run -p cli-client price-feed

Fix: #40

@zahorodnyi zahorodnyi self-assigned this Jan 15, 2026
@zahorodnyi zahorodnyi requested a review from KyrylR as a code owner January 15, 2026 18:25
@zahorodnyi
Copy link
Collaborator Author

@greptile review the PR according to the CONTRIBUTION.md

@greptile-apps
Copy link

greptile-apps bot commented Jan 15, 2026

Greptile Summary

Adds a new price-feed command to fetch and display the current BTC/USD price from CoinGecko API. The implementation uses a clean separation of concerns with a PriceFetcher trait, error handling via custom PriceFetcherError enum, and async/blocking task management. The feature integrates seamlessly into the existing CLI command structure.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The implementation is straightforward, uses proper error handling, follows existing codebase patterns, and introduces no breaking changes. The single commit is logical and self-contained per the repository's custom instruction.
  • No files require special attention

Important Files Changed

Filename Overview
crates/cli-client/src/price_fetcher.rs Adds CoingeckoPriceFetcher that fetches BTC/USD price from CoinGecko API with error handling and timeout
crates/cli-client/src/cli/price.rs Implements async run_price_feed() function that fetches and displays BTC/USD price using spawn_blocking

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant PriceModule as price::run_price_feed()
    participant Fetcher as CoingeckoPriceFetcher
    participant API as CoinGecko API

    User->>CLI: cargo run -p cli-client price-feed
    CLI->>PriceModule: Command::PriceFeed
    PriceModule->>Fetcher: new()
    PriceModule->>PriceModule: spawn_blocking()
    activate PriceModule
    PriceModule->>Fetcher: fetch_price()
    Fetcher->>API: GET /api/v3/simple/price?ids=bitcoin&vs_currencies=usd
    API-->>Fetcher: {"bitcoin": {"usd": 95234.56}}
    Fetcher-->>PriceModule: Ok(PriceMap)
    deactivate PriceModule
    PriceModule->>PriceModule: Extract bitcoin/usd from response
    PriceModule->>User: println!("1 BTC = $95234.56")

Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

6 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@zahorodnyi zahorodnyi marked this pull request as draft January 16, 2026 12:00
@zahorodnyi zahorodnyi added the greptile Mark this PR to be reviewed by Greptile label Jan 16, 2026
@zahorodnyi zahorodnyi marked this pull request as ready for review January 16, 2026 15:45
@greptile-apps
Copy link

greptile-apps bot commented Jan 16, 2026

Greptile's behavior is changing!

From now on, if a review finishes with no comments, we will not post an additional "statistics" comment to confirm that our review found nothing to comment on. However, you can confirm that we reviewed your changes in the status check section.

This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

greptile Mark this PR to be reviewed by Greptile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add price feed

2 participants