Bitcoin Price API - Ruby Gem
Bitcoin Price is a simple tool for getting the current price of Bitcoin. It returns the current price, market cap, 24-hour trading volume, and 24-hour price change in any currency.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_bitcoin'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_bitcoin
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_bitcoin'
# Initialize the client
client = APIVerve::Bitcoin::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
currency: "USD",
hourly: true
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ currency: "USD", hourly: true })
puts response["data"]
rescue APIVerve::Bitcoin::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Bitcoin::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Bitcoin::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"currency": "USD",
"price": 97250.43,
"marketCap": 1928000000000,
"volume24h": 35420000000,
"change24h": -1.52,
"lastUpdated": "2026-02-07T12:00:00.000Z",
"high24h": 98750.21,
"low24h": 96125.88,
"changeDirection": "down",
"formatted": {
"price": "$97,250.43",
"marketCap": "$1.93T",
"volume": "$35.42B",
"priceWords": "ninety-seven thousand two hundred fifty dollars"
}
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://bitcoin.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.