diff --git a/pom.xml b/pom.xml index 90d520a..b984cd7 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ org.fross quoter - 5.0.22 + 5.0.23 jar quoter diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index a0baacf..d84fdfd 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: quoter -version: '5.0.22' +version: '5.0.23' summary: Command line utility to pull stock and index quotes description: | Quoter fetches online stock quotes and index data for easy display on diff --git a/src/main/java/org/fross/quoter/CommandLineParser.java b/src/main/java/org/fross/quoter/CommandLineParser.java index 7da1d7b..15393a4 100644 --- a/src/main/java/org/fross/quoter/CommandLineParser.java +++ b/src/main/java/org/fross/quoter/CommandLineParser.java @@ -120,11 +120,11 @@ public void validate(String name, String value) { int intVal; try { intVal = Integer.parseInt(value); - if (intVal < 1 || intVal > 99) { - Output.fatalError("Trend duration can not be '" + value + "'. Value must be between 1 and 99", 1); + if (intVal < 1 || intVal > 365) { + Output.fatalError("Trend duration can not be '" + value + "'. Value must be between 1 and 365", 1); } } catch (Exception e) { - Output.fatalError("Trend duration can not be '" + value + "'. Value must be between 1 and 99", 1); + Output.fatalError("Trend duration can not be '" + value + "'. Value must be between 1 and 365", 1); } } } diff --git a/src/main/java/org/fross/quoter/HistoricalQuotes.java b/src/main/java/org/fross/quoter/HistoricalQuotes.java index 2a82caa..c332a3e 100644 --- a/src/main/java/org/fross/quoter/HistoricalQuotes.java +++ b/src/main/java/org/fross/quoter/HistoricalQuotes.java @@ -93,9 +93,9 @@ public Map getHistoricalQuotes(String symb) { // Loop through each day and populate the hash. Data order: Date,Open,High,Low,Close,Volume for (int rowRead = (historicalData.length - 1); rowRead > 0; rowRead--) { - // The date is not quoted. Easier to quote the data so the following split works - historicalData[rowRead] = historicalData[rowRead].replaceFirst("^", "\""); - historicalData[rowRead] = historicalData[rowRead].replaceFirst(",", "\","); + // Change the date field to be ISO format instead of US format so the sorted display works + // Also quote the date so the future split will work + historicalData[rowRead] = historicalData[rowRead].replaceFirst("^(\\d+)\\/(\\d+)\\/(\\d+),", "\"$3-$1-$2\","); // Pull the first field (date) and set as the hash key String dateKey = historicalData[rowRead].split(",")[0].replaceAll("\"", "");