Sha256: e86b91e1d6617ecf76c98ed084f60a65874eb92a3b8b9061d1bd6899f0889284
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
require "SimBot/version" require 'thor' module SimBot class CLI < Thor require 'utils' require 'api_controller' desc 'start', 'Start simulation bot parsing in base-url and auth token.' method_option :base_url, type: :string, required: true, desc: 'API base URL' method_option :jwt, type: :string, required: true, desc: 'JWT to be used' method_option :freq, type: :numeric, default: 1, desc: 'Frequency for trades to be added' def start count = 0 api = ApiController.new(options[:base_url], options[:jwt]) loop do vol = rand(0.2...2.9) price = Utils.get_bchxrp_price api.post_order('bchxrp', price, vol, 'sell') sleep (1/options[:freq]) api.post_order('bchxrp', price, vol, 'buy') puts "order ##{count} placed" count += 1 end end desc 'bchxrp_price', 'get the price of BCH in XRP' def bchxrp_price puts Utils.get_bchxrp_price end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
SimBot-0.1.1 | lib/SimBot.rb |