Global Stock Market API - Ruby Gem
Global Stock Market is a tool for comparing stock market performance across 36 countries. It returns a normalized share price index (2015=100) from OECD data, allowing you to compare market growth between countries over time.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_globalstockmarket'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_globalstockmarket
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_globalstockmarket'
# Initialize the client
client = APIVerve::Globalstockmarket::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({
country: "DE",
year: 2023,
month: 6
})
# Print the response
puts response
Error Handling
begin
response = client.execute({ country: "DE", year: 2023, month: 6 })
puts response["data"]
rescue APIVerve::Globalstockmarket::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Globalstockmarket::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Globalstockmarket::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"country": "DE",
"countryName": "Germany",
"baseline": "2015=100",
"year": 2023,
"month": 6,
"value": 154.28,
"date": "2023-06-01"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/globalstockmarket?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.