StocksExchange
This gem consumes the public API of stocks.exchange to give you a ruby friendly version.
Installation
Add this line to your application's Gemfile:
gem 'stocks_exchange'
And then execute:
$ bundle
Or install it yourself as:
$ gem install stocks_exchange
Usage
All currencies are converted into modules with their respective symbols(in uppercase) as the names.
For example, for a currency, Intensecoin with the symbol ITNS you access it as:
StocksExchange::ITNS
The corresponding keys are converted into methods that return their values
For example, to get the minimum withdrawal amount for Intensecoin above. You can use:
StocksExchange::ITNS.minimum_withdrawal_amount
since stocks.exchange provides "minimum_withdrawal_amount":"<some_value>"
in their API.
All markets are converted into modules with their respective market names(as in the API, in uppercase) as the names.
For example, for a market, DERO/BTC, you can access it as:
StocksExchange::DERO_BTC
The corresponding keys are converted into methods that return their values.
The values from the ticker and prices are also added to their respective market names.
Examples:
StocksExchange::DERO_BTC.buy_fee_percent
StocksExchange::DERO_BTC.vol
StocksExchange::DERO_BTC.buy
Other Methods
It is important to keep updating the values since the initital values are the values grabbed during gem load time.
To do so, use:
StocksExchange.refresh
To check whether a market or currency exists use:
StocksExchange.listed?("ITNS_BTC")
StocksExchange.listed?("dhjdcdhjcbhsjcb")
Contributing
- Fork it ( https://github.com/alabeco/stocks_exchange/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Bug reports and pull requests are welcome on GitHub at https://github.com/alabeco/stocks_exchange.
License
The gem is available as open source under the terms of the MIT License.