Skip to content

Repository files navigation

Command Line Interface for Stock Price information

A Java CLI for getting stock information. This is a Command Line Interface application which generates up-to-date stock information The application utilized eodhd.com finance API.

Help Message from the above command line

Table of Contents

About

A command line interface for easily getting the latest stock price. This application also enables you to get the change in stock price and percentage between two dates.

Usage:

Usage: stock-cli [-hp] [-ed=<end_date>] -s=<symbol> [-sd=<start_date>]

Option arguments:

-h, --help             Show help message
-s=<symbol>            Stock symbol/ticker (Required)
-sd=<start_date>       Stock price start date. Format: yyyy-mm-dd
-ed=<end_date>         Stock price end date. Format: yyyy-mm-dd
-p                     Use if you want to see a percentage change

Example Usage in CMD:

1. Sample Command 1 - Return the latest stock price of NVidia (NVDA):
$ C\Users\stock-cli> stock-cli -s NVDA
2. Sample Command 2 - Return the change in price between two dates:
$ C\Users\stock-cli> stock-cli -s MSFT -sd 2024-02-10 -ed 2024-02-19
3. Sample Command 3 - Display the change in percentage between the two dates also:
$ C\Users\stock-cli> stock-cli -s MSFT -sd 2024-02-10 -ed 2024-02-19 -p
4. Sample Command 4 - Display the change in price and percentage from a starting date to current date
$ C\Users\stock-cli> stock-cli -s AAPL -sd 2024-02-10 -p
5. Sample Command 5 - Show help
$ C\Users\stock-cli> stock-cli -h

Getting Started

The following instructions will get you the copy of the project set up in your local machine to start running the command line interface stock-cli and getting stock prices quickly!

Prerequisites

You will need to have Java >= 11 installed in your local machine.

Finance API

The stock-cli project requires you to have a Finance API from eodhd.com. Below are the steps to get a free API.

  1. Navigate to https://eodhd.com/
  2. On the top bar, go to Documentation > End of Day API
  3. Click on Register and Get Data to sign up
  4. You will receive a free API key. See below instructions on how to configure the API Key in the project file
  5. The free API key has a limit of 20 API calls per day. Each call will consume 1 API limit. See your eodhd.com dashboard for more information.

Project Setup

This section goes through configuring your API key, and building the project.

Clone the repository

Clone the repository from github to your local machine.

Create the configuration file

To successfully make the API call for the stock-cli application, we need to set up a configuration file that can use your free API key you received from eodhd.com.

Using the IDE of your choice, navigate to src/main/java/config folder. Create a new file config.properties (please make sure the file name is called exactly this). Open the config.properties file and add an entry:

API_KEY = <your_free_API_Key>

where your replace the <your_free_API_key> with the API key you received. Please make sure you do not add any qoutations around the API key.

Example:

API_KEY = A123bCD45EF6

Run Application

Now you are ready to run the application.

Go to your command prompt and run the following:

$ C\Users> stock-cli -h

You should see the output: Help Message from the above command line

License

The project is licensed under the MIT license. View the License File for details.

About

A Java CLI for getting stock information

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages