aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 42781a4370974a9a3033f2b50bde66cad3699946 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# Stock Picker

This program was developed in Java by Michael Hunteman. It is inspired by
algorithms and design patterns taught in SOFT260 at UNL. The application uses a
dynamic programming approach to maximize the value determined by the user. The
problem is framed as a directed acyclic graph, so the vertices can be explored
in topological order. The vertices represent the money spent in USD up to that
point in time. The root vertex is $0 and the last child visited is the total
amount of money the user has to spend. With the dynamic programming approach,
the algorithm breaks down the largest problem "maximize for value up to the
buying power of the user" into smaller problems where the value is maximized for
buying power less than what the user entered.

## Setup

- OpenJDK 18 or Java SE
- Clone the repository

## Usage

Since the value is defined by the user, it should be kept consistent. The same
financial metric should be used for every stock. Being user-defined allows for
flexibilty as to which financial metric should be maximized. For example, the
value could be Sales/Revenue, Cost of Goods Sold, or EBITDA.

Run the stock picker:

```sh
java picker.java
```

### Keybindings

- Press 1 to add a stock.
- Press 2 to add buying power.
- Press 3 to display stocks and buying power.
- Press 4 to run.
- Press 5 to exit.

### Output

The list of stocks picked by the algorithm for the max value are displayed
first, followed by the buying power and total value accrued.