Concurrency Show and Tell

Your mission, should you choose to accept it is fetch stock data for multiple stocks and compute a simple moving average for each one concurrently. Doing this sequentially is a fine first step but the goal is to do it concurrently using your abstraction of choice. Actors, Futures,  Threads and Locks, or any other concurrency abstraction is ok to use.

Yahoo provides an HTTP link to download CSV data where s is the symbol and a,b,c,d,e, and f are the start and end dates. The link below downloads a years worth of daily data in CSV fomat from May 9th 2013 to May 9th 2014. The symbols and timeframe aren't that important as long as you obtain data. Some other symbols to use are NFLX, TWTR, AMZN, MSFT, ADBE, CSCO, EBAY, GOOG, TSLA, and so on.

A reasonable input for your program is a list of ticker symbols.

    tickers: Seq[String]

     e.g. Seq("AAPL", "GOOG", "TWTR")

A reasonable output could be a list of list of doubles

    averages: Seq[Seq[Double]]

   e.g. Seq(Seq[masked],[masked],...), Seq([masked],[masked],...), Seq(35.55, 36.62,...)) where Seq(0) is the average or AAPL and so on. A Tuple or a map with symbol/average is ok too.

Bonus points for:

• Handling HTTP request timeouts or failures. 

• Handling partial failures. If one HTTP request fails, then still return data for the other valid requests. An invalid ticker symbol or network bug could cause this.

• Chaining indicators. e.g. Using the simple moving average compute the standard deviation.  See this page on Stock Indicators for other formulas to use.

Leave a comment if you want to show and discuss your code with the group for about 20 minutes. I think we'll have time for a maximum of four demos including setup and discussion.

Join or login to comment.

  • Brian B.

    A week to go and I'll have a simple version using Actors to share. Anyone else?

    May 15, 2014

    • A former member
      A former member

      I've hacked something together using Futures - and organized a baby-sitter - so I'll be there :-)

      May 15, 2014

  • Miroslav B.

    I can give a try - I can possibly come up with an actors/futures version to show

    May 15, 2014

  • Kimberly G.

    Good Morning! I received an email from a recruiter at QuestPoint. I guess they are utilizing Scala and Play. They have at least one opening if anyone is looking for a new gig. :)

    1 · May 8, 2014

9 went

Our Sponsors

Create a Meetup Group and meet new people

Get started Learn more

Meetup has allowed me to meet people I wouldn't have met naturally - they're totally different than me.

Allison, started Women's Adventure Travel

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy