Finance / Arbitrage logic in ruby