
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Nomics is an API-first cryptoasset data company delivering professional-grade market data APIs to institutional crypto investors & exchanges. This gem provides Ruby bindings to its V1 API.
Add this line to your application's Gemfile:
gem 'nomics'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install nomics
First, configure Nomics. You can use the NOMICS_API_KEY
env var or using a block:
Nomics.configure do |config|
# Get an API key at https://p.nomics.com/pricing
# This defaults to ENV['NOMICS_API_KEY']
config.api_key = 'abcd1234'.freeze
# If you have a free API key that is limited to one call per second,
# you can add 2 seconds before network calls:
config.wait_time_in_between_calls = 2
end
Create a currency object and fetch some data on it
btc = Nomics::Currency.new('BTC') # also supports symbols like Nomics::Currency.new(:BTC)
Let's see some data!
btc.price
btc.name
Get all the known attributes (casted for convenience) for a given currency:
btc.attributes
You can reload the data from the Nomics API with a single call. Here's how you'd get an up-to-date price:
btc.reload.price
If a currency cannot be found, it will raise an error (once we fetch any data):
bazinga = Nomics::Currency.new('BAZINGA')
bazinga.price
# => Cannot find currency with id: BAZINGA (Nomics::UnknownCurrencyError)
You can fetch multiple currencies using a single call and fetch all attributes:
currencies = Nomics::Currencies.new(*%w[BTC XRP ETH])
currencies.map &:attributes
If you want to view a specific set of attributes for the currencies provided, you can map over them:
currencies = Nomics::Currencies.new(*%w[ETH BTC])
currencies.map &:circulating_supply
currencies.map &:name
currencies.map &:symbol
currencies.map &:price
Alternatively you simply just pluck these (similar to how ActiveRecord works)
currencies.pluck :circulating_supply, :name, :symbol, :price
Retrieving a specific cryptocurrency in a specific fiat currency can also be done. This will quote ticker price, market cap, and volume in the specified currency:
btc_in_zar = Nomics::Currency.new('BTC', convert: 'EUR')
eth_in_usd = Nomics::Currency.new('ETH', convert: 'USD')
eth_in_usd = Nomics::Currency.new('ETH') # convert defaults to USD
Advanced calculations are yet under consideration for this gem, but you can calculate prices in relation to their dollar value. For example:
btc_price_in_usd = Nomics::Currency.new('BTC').price.to_f # Nomics API defaults to USD
eth_price_in_usd = Nomics::Currency.new('ETH').price.to_f # Nomics API defaults to USD
eth_price_in_btc = eth_price_in_usd / btc_price_in_usd
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/attilagyorffy/nomics.rb.
FAQs
Unknown package
We found that nomics demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.