Stock Exchange API - Ruby Gem
Stock Exchange is a tool for retrieving information about stock exchanges and trading venues worldwide using ISO 10383 Market Identifier Codes (MIC). It returns exchange details including name, location, website, and classification.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_stockexchange'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_stockexchange
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_stockexchange'
# Initialize the client
client = APIVerve::Stockexchange::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ mic: "XNYS" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ mic: "XNYS" })
puts response["data"]
rescue APIVerve::Stockexchange::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Stockexchange::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Stockexchange::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"count": 1,
"exchanges": [
{
"mic": "XNYS",
"operatingMic": "XNYS",
"type": "OPRT",
"name": "NEW YORK STOCK EXCHANGE, INC.",
"acronym": "NYSE",
"category": "RMKT",
"country": "US",
"city": "NEW YORK",
"website": "WWW.NYSE.COM",
"lei": "549300HIIRNWMO0MKS45",
"creationDate": "2005-05-23"
}
]
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://apiverve.com/marketplace/stockexchange?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.