Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class SecurityPricingActor(exchange: Exchange, backOffice: BackOffice) extends Actor {
- def receive = {
- case GetPricingInfo(security: Security) =>
- val originalSender = sender
- val bidAndAskFuture = Future { exchange.getBidAndAsk(security.id) }
- val lastPriceFuture = Future { backOffice.getLastPrice(security.id) }
- val response = for {
- (bid, ask) = bidAndAskFuture
- lastPrice = lastPriceFuture
- } yield SecurityPricing(bid, ask, lastPrice)
- response map (originalSender ! _)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement