Home » Courses » COMS 4156: ASE » COMS W4156 Fall 2013 Programming Assignment 1

COMS W4156 Fall 2013 Programming Assignment 1

Project Description

You will write a web application exposing an interface that satisfies the Java Play routes file that can be downloaded here.
The stock related questions you will need to answer are the following:

  • What is the record high close for a stock given its ticker symbol?
    • Example Ticker: NVDA
    • Example Response: 172.94
    • On an error return 0.00
  • What is the record low close for a stock given its ticker symbol?
    • Example Ticker: NVDA
    • Example Response: 5.90
    • On an error return 0.00
  • What is the open price for a stock given a ticker symbol and a date?
    • Example Ticker: NVDA
    • Example Date: 2013-07-15
    • Example Response: 14.67
    • On an error return 0.00
    • If we request a data where the stock was not traded return the error value.
  • What is the close price for a stock given a ticker symbol and a date?
    • Example Ticker: NVDA
    • Example Date: 2013-07-15
    • Example Response: 14.61
    • On an error return 0.00
    • If we request a data where the stock was not traded return the error value.

The logging related questions you will need to answer are the following:

  • How many valid requests has the application received?
  • What was the ticker symbol for the most recent valid request?
  • What is the Xth ticker symbol requested with a valid request where X can be replaced with any integer and do not count ticker symbols for invalid requests.
    If X is 2 then return the second ticker symbol requested.
  • Of the stocks that have been queried with a valid request, what is the highest close?
  • Of the stocks that have been queried with a valid request, what is the lowest close?

You should not need to log invalid requests.

This Yahoo finance HTTP API is very simple and shown below:

  • http://ichart.yahoo.com/table.csv?s=<tickerSymbol>
  • Example retrieving historical information about NVIDIA: http://ichart.yahoo.com/table.csv?s=nvda
  • We will be using only the historical quotes portion.
    We will not be using this specific wrapper because it is written in .Net but you can find a good summary of the API’s URL structure here.

Other Requirements

  • For this assignment you are to use the Java Play Framework.
  • You may not hard code ANY data or turn your project in with any data files.
    Your application must fetch all data from Yahoo.
  • You may encode the structure of the data into your application but not the data itself.
  • To test the project we will use the play run command so all set up must be encapsulated.
  • For any invalid routes return the error value 0.00.
  • For the index.html request return an empty http response.

Notes

  • A ticker symbol is a short code used to refer to a company traded on a stock exchange.
    As an example, NVIDIA’s ticker symbol is nvda and Apple’s ticker symbol.
    You do not need to handle ticker symbols containing non alphabetical characters such as periods.
  • You will want to extensively test your assignment before submitting.
    We will be testing with both valid and invalid input.
    Java Play provides nice unit testing functionality.

Tutorials

  • There will be a tutorial on Java Play and Git on Friday September 6 in the CLIC Lab at 4:30 PM.

Resources