Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Why choosing good metrics is important.
require 'csv'
def percent_support_tickets(time)
1.0 - ((time + 5) / 200.0)
end
seed = Random.new_seed
prng = Random.new(seed)
puts "Seed: #{seed}"
primary_amounts = []
metrics = []
(1..100).each do |t|
num_trades = prng.rand(100...500)
dollar_revenue = prng.rand(1_000...1_000_000)
num_support_tickets = num_trades * percent_support_tickets(t)
dollars_per_ticket = dollar_revenue / num_support_tickets
tickets_per_trade = num_support_tickets / num_trades
primary_amounts << [num_trades, dollar_revenue, num_support_tickets]
metrics << [dollars_per_ticket, tickets_per_trade]
puts "#{t}:"
puts "\t#{num_trades}\t$#{dollar_revenue}\t#{num_support_tickets}"
puts "\t#{dollars_per_ticket}\t#{tickets_per_trade}"
end
CSV.open("fluctuation_data.csv", "wb") do |csv|
metrics.each do |metric|
csv << metric
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.