Skip to content

Simple stock API for fetching information related to stocks.

Notifications You must be signed in to change notification settings

sethjones348/stocks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stocks!

Simple stock API for fetching information related to stocks.

What you will need:

  • The code: git clone https://github.com/sethjones348/stocks
  • The following software installed on your computer:
    • Java 8 or higher
    • Docker
    • Maven

Acquiring an API key for the Polygon Stock API

Build and Execution of Web App

Once the code is downloaded on your computer

  • Open a terminal
  • Navigate to the home directory of the project

Using maven:

  • Run the following: export POLYGON_API_KEY=<INSERT_YOUR_API_KEY_HERE>
  • Verify the previous command by running echo $POLYGON_API_KEY
  • Execute the command: ./mvnw clean package
  • Execute the command java -jar target/stocks-0.0.1-SNAPSHOT.jar

Using Docker:

  • Execute the command: ./mvnw clean package
  • Run the following from the root: echo ENV POLYGON_API_KEY="<INSERT_YOUR_API_KEY>" >> Dockerfile
  • Run the following: docker build -t <INSERT_WHAT_YOU_WANT_TO_CALL_THIS_IMAGE> .
  • Run the following: docker run -e POLYGON_API_KEY=<your key> -p 8080:8080 -t <THE_NAME_YOU_MADE_UP_IN_THE_PREVIOUS_COMMAND>

Using Docker, batteries included approach:

Note: For those that do not have Maven or appropriate Java prereqs, feel free to use the following commands to build inside docker, for a "batteries included" approach:

  • Execute the command: docker build -f Dockerfile.Maven -t <your image> .
  • Run the following: docker run -e POLYGON_API_KEY=<your key> -p 8080:8080 -t <your image>:latest

Usage

  • Open a separate terminal
  • Run the following: curl localhost:8080/stocks/AAPL
  • Congrats you just ran your first test!
  • Replace AAPL with any stock symbol you want information on and execute the command again.

Endpoints

  • GET /stocks/{symbol}
    • symbol is of type String
    • symbol should be a valid stock exchange symbol (e.g., AAPL, IBM..)

Note

  • If you try and execute the command more than 1 time in a minute span it will not work since we are using the free version of the API :(

About

Simple stock API for fetching information related to stocks.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages