Skip to content

Commit

Permalink
Enhanced detailed (-d) company information
Browse files Browse the repository at this point in the history
  • Loading branch information
frossm committed Jun 30, 2021
1 parent 6e9082c commit 0eec129
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Note that if Quoter has been installed via a snap, `quoter -c` is all that is ne
#### Security Information
|Option|Description|
|------|-----------|
|-d | Display detailed stock information for the symbols provided. This is simply additional information retreived from IEXCloud|
|-d | Display detailed information on the company as well as enhanced stock information for the symbols provided. This is simply additional information retrieved from IEXCloud|
|-t | After the initial quote information, display a three month historical view of close prices. Please see the discussion on trending below. Please note that this call is heavily weighted by IEXCLOUD and will use quite a few credits|
|-x FileName| Export the results into the specified file in CSV format. Note it needs to be a location can can be written to by the user|

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

<groupId>org.fross</groupId>
<artifactId>quoter</artifactId>
<version>2.7.2</version>
<version>2.7.3</version>
<packaging>jar</packaging>

<name>quoter</name>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: quoter
version: '2.7.2'
version: '2.7.3'
summary: Command line utility to pull stock and index quotes
description: |
Quote fetches stock quotes and index data from IEXCloud.IO.
Expand Down
31 changes: 21 additions & 10 deletions src/main/java/org/fross/quoter/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,27 +480,38 @@ public static void main(String[] args) {
// Display detailed stock information if selected with the -d switch
if (detailedFlag == true && !symbolList.isEmpty()) {
final int HEADERWIDTH = 80;
String[] detailedFields = { "symbol", "companyName", "primaryExchange", "open", "openTime", "close", "closeTime", "high", "highTime", "low",
"lowTime", "latestPrice", "latestVolume", "previousClose", "previousVolume", "change", "changePercent", "agTotalVolume", "marketCap",
"peRatio", "week52High", "week52Low" };
String[] companyFields = { "symbol", "companyName", "exchange", "industry", "website", "description", "CEO", "securityName", "issueType", "sector",
"primarySicCode", "employees", "address", "address2", "city", "state", "zip", "country", "phone" };

String[] symbolFields = { "open", "openTime", "close", "closeTime", "high", "highTime", "low", "lowTime", "latestPrice", "latestVolume",
"previousClose", "previousVolume", "change", "changePercent", "agTotalVolume", "marketCap", "peRatio", "week52High", "week52Low" };

Output.printColorln(Ansi.Color.WHITE, "\nDetailed Security Information:");

// Loop through each symbol and show the detailed display
// Display detail of each symbol provided on command line
for (String symb : symbolList) {
// Create the symbol data object
Symbol symbolData = new Symbol(symb, IEXCloudToken);
// Query company data
IEXCloudAPICall companyDetail = new IEXCloudAPICall(Main.IEXCloudBaseURL + "/stable/stock/" + symb + "/company", IEXCloudToken);

// Query symbol data
Symbol symbolDetail = new Symbol(symb, IEXCloudToken);

// Display Header
Output.printColorln(Ansi.Color.CYAN, "-".repeat(HEADERWIDTH));
Output.printColorln(Ansi.Color.YELLOW, symb.toUpperCase() + " / " + symbolData.get("companyName"));
Output.printColorln(Ansi.Color.YELLOW, symb.toUpperCase() + " / " + companyDetail.get("companyName"));
Output.printColorln(Ansi.Color.CYAN, "-".repeat(HEADERWIDTH));

// Loop through each detailed field and display it
for (String field : detailedFields) {
Output.printColorln(Ansi.Color.WHITE, " " + String.format("%-16s", field) + " " + symbolData.get(field));
// Display company information
for (String field : companyFields) {
Output.printColor(Ansi.Color.WHITE, " " + String.format("%-16s", field) + ": ");
Output.printColorln(Ansi.Color.CYAN, " " + companyDetail.get(field));
}
Output.println("");

// Loop through each detailed field and display it
for (String field : symbolFields) {
Output.printColorln(Ansi.Color.WHITE, " " + String.format("%-16s", field) + " " + symbolDetail.get(field));
}
Output.println("");
}
}
Expand Down

0 comments on commit 0eec129

Please sign in to comment.