class BitexBot::Robot
Documentation here!
Public Class Methods
log(level, message)
click to toggle source
# File lib/bitex_bot/robot.rb, line 59 def self.log(level, message) logger.send(level, message) end
run!()
click to toggle source
Trade constantly respecting cooldown times so that we don't get banned by api clients.
# File lib/bitex_bot/robot.rb, line 41 def self.run! bot = start_robot self.cooldown_until = Time.now loop do start_time = Time.now next if start_time < cooldown_until self.current_cooldowns = 0 bot.trade! self.cooldown_until = start_time + current_cooldowns.seconds end end
setup()
click to toggle source
# File lib/bitex_bot/robot.rb, line 35 def self.setup self.maker = Settings.maker_class.new(Settings.maker_settings) self.taker = Settings.taker_class.new(Settings.taker_settings) end
sleep_for(seconds)
click to toggle source
# File lib/bitex_bot/robot.rb, line 54 def self.sleep_for(seconds) sleep(seconds) end
with_cooldown() { || ... }
click to toggle source
# File lib/bitex_bot/robot.rb, line 64 def self.with_cooldown yield.tap do self.current_cooldowns += 1 sleep_for(0.1) end