module MarketHelper # takes probability and returns a string giving odds def oddstring(p) q = p.to_f return "even odds" if (q-0.5).abs < 0.01 return "#{ (100*q/(1-q)).round/100.0} to 1 in favor" if q/(1-q)>=1 return "#{ (100*(1-q)/q).round/100.0} to 1 against" end end