Module: RbtcArbitrage::Client
- Included in:
- RbtcArbitrage::Clients::BitstampClient, RbtcArbitrage::Clients::BtceClient, RbtcArbitrage::Clients::CampbxClient, RbtcArbitrage::Clients::CoinbaseClient
- Defined in:
- lib/rbtc_arbitrage/client.rb
Instance Attribute Summary collapse
-
#balance ⇒ Object
writeonly
Sets the attribute balance.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #address ⇒ Object
- #buy ⇒ Object
- #initialize(config = {}) ⇒ Object
- #logger ⇒ Object
- #sell ⇒ Object
- #validate_keys(*args) ⇒ Object
Instance Attribute Details
#balance=(value) ⇒ Object (writeonly)
Sets the attribute balance
4 5 6 |
# File 'lib/rbtc_arbitrage/client.rb', line 4 def balance=(value) @balance = value end |
#options ⇒ Object
Returns the value of attribute options.
3 4 5 |
# File 'lib/rbtc_arbitrage/client.rb', line 3 def @options end |
Instance Method Details
#address ⇒ Object
34 35 36 |
# File 'lib/rbtc_arbitrage/client.rb', line 34 def address ENV["#{exchange.to_s.upcase}_ADDRESS"] end |
#buy ⇒ Object
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 |
#logger ⇒ Object
38 39 40 |
# File 'lib/rbtc_arbitrage/client.rb', line 38 def logger @options[:logger] end |
#sell ⇒ Object
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 |