class Decent::UpdateHodling

Public Class Methods

execute(args) click to toggle source
# File lib/decent/command/hodling/update_hodling.rb, line 3
def self.execute(args)
  hodlings = Database[:holdings]
  hodlings.each do |hodling|
    currency = hodling[:currency]
    address  = hodling[:address]
    id       = hodling[:id]
    balance  = API.currency[currency].get_balance address

    if (hodlings.where(id: id).update(balance: balance, updated_at: DateTime.now))
      StoreHodling.store hodling
    end
  end
end