Class: Gtmtech::Crypto::Subcommands::Reconcile

Inherits:
Gtmtech::Crypto::Subcommand show all
Defined in:
lib/gtmtech/crypto/subcommands/reconcile.rb

Class Method Summary collapse

Methods inherited from Gtmtech::Crypto::Subcommand

all_options, error, find, hidden?, parse, prettyname, validate

Class Method Details

.descriptionObject



9
10
11
# File 'lib/gtmtech/crypto/subcommands/reconcile.rb', line 9

def self.description
  "reconcile transactions"
end

.executeObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/gtmtech/crypto/subcommands/reconcile.rb', line 35

def self.execute
  values = {}
  while ARGV.length > 0
    current_valuation = ARGV.shift
    currency = current_valuation.split("=")[0]
    gbp_equiv = current_valuation.split("=")[1]
    values[ currency ] = gbp_equiv
  end
  self.reconcile values
end

.optionsObject



26
27
28
# File 'lib/gtmtech/crypto/subcommands/reconcile.rb', line 26

def self.options
  []
end

.reconcile(values) ⇒ Object



30
31
32
33
# File 'lib/gtmtech/crypto/subcommands/reconcile.rb', line 30

def self.reconcile values
  Data.load
  Data.reconcile_transactions values
end

.usageObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/gtmtech/crypto/subcommands/reconcile.rb', line 13

def self.usage
  <<-EOS
Usage (crypto #{self.prettyname}) [BTC=<current btc price> ETH=<current eth price> .... etc ...]

crypto #{self.prettyname}
  - reconcile all transactions

If you specify the current price (in GBP) of each coin, the summary will become more illuminating

Options:
EOS
end