A Go-based application that fetches and displays cryptocurrency prices using the CoinGecko API. This project demonstrates HTTP requests, JSON parsing, caching mechanisms, and data visualization in Go.
- Fetch current prices of various cryptocurrencies.
- Support for multiple cryptocurrencies and fiat currencies.
- Caching of price data to reduce API calls.
- Visualization of cryptocurrency prices as a CSV file or a bar chart image.
- Command-line interface for easy and flexible use.
Follow these instructions to get a copy of the project up and running on your local machine for development and testing purposes.
You'll need Go installed on your machine (version 1.15 or higher). Additionally, for visualization, the Gonum Plot library is used:
go get -u gonum.org/v1/plot/...
Clone the repository to your local machine:
git clone https://github.com/[your-username]/crypto-price-checker.git
Navigate to the project directory:
cd crypto-price-checker
Run the server using:
go run . bitcoin,ethereum usd
Replace bitcoin,ethereum
with the cryptocurrencies of your choice and usd
with your preferred fiat currency.
The application can be used via command-line interface. Here are some example usages:
-
To fetch prices for Bitcoin (BTC) and Ethereum (ETH) in USD:
go run . bitcoin,ethereum usd
-
The application will generate a CSV file (
prices.csv
) or a bar chart image (prices.png
) based on the uncommented line in themain.go
file.
This application supports two types of visualizations:
- CSV Output: Generates a CSV file with cryptocurrency prices, which can be imported into tools like Excel or Google Sheets for custom visualizations.
- Bar Chart Image: Generates a bar chart image displaying the prices of the specified cryptocurrencies.
- Go - The Go Programming Language
- Gonum Plot - A plotting library for Go
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
- Berk Durmus - Initial work
This project is licensed under the MIT License - see the LICENSE.md file for details.
- Hat tip to the CoinGecko API for providing cryptocurrency data.
- Inspired by the Go community and their support for open-source development.