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.

https://ichart.finance.yahoo.com/table.csv?s=AAPL&a=04&b=9&c=2013&d=04&e=9&f=2014&g=d&ignore=.csv

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

    • 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

  • Miroslav B.

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

    May 15

  • 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. http://www.questpoint.com/ :)

    1 · May 8

9 went

Our Sponsors

People in this
Meetup are also in:

Create your own Meetup Group

Get started Learn more
Bill

I started the group because there wasn't any other type of group like this. I've met some great folks in the group who have become close friends and have also met some amazing business owners.

Bill, started New York City Gay Craft Beer Lovers

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