lib/wash_trade.rb in SimBot-0.1.12 vs lib/wash_trade.rb in SimBot-0.1.13
- old
+ new
@@ -3,10 +3,11 @@
# Simple process to add wash trades to a market in order to simulate trade matching for QA and dev
class WashTrade
require 'utils'
def initialize(api, market, freq)
@g_count = 1
+ @range = 1.015
@api = api
@market = market
@freq = freq
Process.fork do
Process.daemon(true)
@@ -33,16 +34,15 @@
rescue ::StandardError => e
puts e
end
def move_price
- range = 1.015
if @g_count > 60
- range = rand(1.003...1.010)
+ @range = rand(1.003...1.010)
@g_count = 0
end
@g_count += 1
- Utils.quote(@market) * rand(1.002...range)
+ Utils.quote(@market) * rand(1.002...@range)
end
# Attempts to write the pid of the forked process to the pid file.
def write_pid_file(pid, pidfile)
File.open pidfile, "w" do |f|
\ No newline at end of file