module RbtcArbitrage::Client
Attributes
balance[W]
options[RW]
Public Class Methods
new(config={})
click to toggle source
# 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
Public Instance Methods
address()
click to toggle source
# File lib/rbtc_arbitrage/client.rb, line 34 def address ENV["#{exchange.to_s.upcase}_ADDRESS"] end
buy()
click to toggle source
# File lib/rbtc_arbitrage/client.rb, line 26 def buy trade :buy end
logger()
click to toggle source
# File lib/rbtc_arbitrage/client.rb, line 38 def logger @options[:logger] end
sell()
click to toggle source
# File lib/rbtc_arbitrage/client.rb, line 30 def sell trade :sell end
validate_keys(*args)
click to toggle source
# 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
Private Instance Methods
set_key(config, key, default)
click to toggle source
# File lib/rbtc_arbitrage/client.rb, line 44 def set_key config, key, default @options[key] = config.has_key?(key) ? config[key] : default end