Skip to content

dongxulee/GoogleFinanceWebApp

Repository files navigation

Stock Info database for S&P 500 stock:

For this project, my purpose is to create a stock infomation database for all the stock in s&p 500. Through SQL language to retrieve information from the database, I can apply some basic stock price data visulization methods: pricing plot through a certain time window, and correlation table for chosen stocks. And I also developed a web running on the local server. User can select the stock they are interested in and get more infomation from the stock open high low close price for most recent 3 month.

Run the application

Step 1: Created a virtual environment

  • Download or clone the repo into a local pc.
  • Open Terminal (OSX or Unix), set the current folder to be the final project folder.
  • If you are a anaconda user you can type conda create --name myenv, if not you can use pip to create the environment.
  • Activate the environment by typing source active myenv.
  • Install all the required package by typing pip install -r requirements.txt.

Step 2: Database table creating and first visualization

  • Assume you are a PostgreSQL user, Edit config.py by including the database name and user/password required to connect to the database. An example is as follow:
db_name = 'finalProject'
db_user = 'lee'
db_password = ' '
  • Start the database server, for example: pg_ctl -D /usr/local/var/postgres start, check if the server is running.
  • Start running the SI507F17_finalproject.py file: python SI507F17_finalproject.py, this program will construct the database on the caching data(using all the csv file under the stock_dfs folder).
  • If you want to update the caching data, you can open SI507F17_finalproject.py file and follow the instruction for dataBaseConstuct() function. If you want to cache the new data from the web, please be patient, because this may take up to 4 minutes, since there are 3 month data for 505 stocks. You can keep track of the process in the command window output.
  • After successfully ran the program, you can get an correlation_table.html file, you can use the web browser to open the file and you get something like this:

screen shot 2017-12-14 at 21 19 49

- The image above is a correlation table visualization of the stocks specified in the __SI507F17_finalproject.py__ file, you can select the stock you like by make change in this file. The default stock list: stocks = ['GOOG','MSFT','IBM','AAPL','FB','ORCL','AMZN'].

Step 3: Runing the Web App using flask framework

  • In the terminal, typing python webApp.py runserver to start the web application.
  • Once the web server is runing, go the browser and go to the default local server address http://localhost:5000/, you should see something like this:

screen shot 2017-12-14 at 21 30 23

- This the web which list all the stocks in the S&P 500, and you can see, at the left corner of the page, there is a selecting menu, you can type the stock ticker you are interested or you can also scrow down to selet one. Then hit the submit bottom, and you will see some thing like this: here we select BRK.B(Berkshire Hathaway Inc)

screen shot 2017-12-14 at 21 35 06

- This is the daily stock price visualization for BRK.B(Berkshire Hathaway Inc), the data traces back to three month, and when you move you cursor on the graph, the nicely plotly feature will show the open high low close price at a specific day.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published