Advertisement
Guest User

Untitled

a guest
Jun 20th, 2014
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Scala 0.28 KB | None | 0 0
  1. val rateQuote = future {
  2.   connection.getCurrentValue(USD)
  3. }
  4. val purchase = rateQuote map { quote =>
  5.   if (isProfitable(quote)) connection.buy(amount, quote)
  6.   else throw new Exception("not profitable")
  7. }
  8. purchase onSuccess {
  9.   case _ => println("Purchased " + amount + " USD")
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement