Module: RbtcArbitrage::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#balance=(value) ⇒ Object (writeonly)

Sets the attribute balance

Parameters:

  • value

    the value to set the attribute balance to.



4
5
6
# File 'lib/rbtc_arbitrage/client.rb', line 4

def balance=(value)
  @balance = value
end

#optionsObject

Returns the value of attribute options.



3
4
5
# File 'lib/rbtc_arbitrage/client.rb', line 3

def options
  @options
end

Instance Method Details

#addressObject



34
35
36
# File 'lib/rbtc_arbitrage/client.rb', line 34

def address
  ENV["#{exchange.to_s.upcase}_ADDRESS"]
end

#buyObject



26
27
28
# File 'lib/rbtc_arbitrage/client.rb', line 26

def buy
  trade :buy
end

#initialize(config = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/rbtc_arbitrage/client.rb', line 6

def initialize config={}
  @options = config
  @options = {}
  set_key config, :volume, 0.01
  set_key config, :cutoff, 2
  set_key config, :logger, Logger.new(STDOUT)
  set_key config, :verbose, true
  set_key config, :live, false
  self
end

#loggerObject



38
39
40
# File 'lib/rbtc_arbitrage/client.rb', line 38

def logger
  @options[:logger]
end

#sellObject



30
31
32
# File 'lib/rbtc_arbitrage/client.rb', line 30

def sell
  trade :sell
end

#validate_keys(*args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/rbtc_arbitrage/client.rb', line 17

def validate_keys *args
  args.each do |key|
    key = key.to_s.upcase
    if ENV[key].blank?
      raise ArgumentError, "Exiting because missing required ENV variable $#{key}."
    end
  end
end