class RbtcArbitrage::Clients::CampbxClient
Public Instance Methods
address()
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 43 def address @address ||= interface.get_btc_address end
balance()
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 10 def balance return @balance if @balance funds = interface.my_funds [funds["Total BTC"].to_f, funds["Total USD"].to_f] end
exchange()
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 6 def exchange :campbx end
interface()
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 16 def interface @interface ||= CampBX::API.new(ENV['CAMPBX_KEY'],ENV['CAMPBX_SECRET']) end
price(action)
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 30 def price action return @price if @price action = { buy: "Best Ask", sell: "Best Bid", }[action] @price = interface.xticker[action].to_f end
trade(action)
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 25 def trade action trade_mode = "Quick#{action.to_s.capitalize}" interface.trade_enter trade_mode, @options[:volume], price(action) end
transfer(client)
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 39 def transfer client interface.send_btc client.address, @options[:volume] end
validate_env()
click to toggle source
# File lib/rbtc_arbitrage/clients/campbx_client.rb, line 20 def validate_env validate_keys :campbx_key, :campbx_secret end