Skip to content

Commit

Permalink
Merge pull request #225 from wwweert123/changesDG
Browse files Browse the repository at this point in the history
Final Final FInal Final changes
  • Loading branch information
wwweert123 authored Nov 14, 2023
2 parents 30ef4ff + c4a964a commit 2de04b7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -561,8 +561,8 @@ Format of watchlist output:
|--------------------------------------------------------|---------------------------------------|------------------------------------------------|--------------------------------|-------------------------------|------------------------|-------------------------------------------------------------------------|
| Ticker Symbol<br/>(Abbreviation for Company 's Stocks) | Exchange at which the stock is traded | Current latest price of stock (before closing) | Intraday Highest trading price | Intraday Lowest trading price | Name of equity product | Last time at which the information of the stocks was updated by the API |

- Note: To prevent overloading of the stock API, we will only be making watchlist updates every 5 minutes.
Any request within the 5-minute window will only show the last updated watchlist
- Note: To prevent overloading of the stock API, we will only be making watchlist updates every 10 minutes.
Any request within the 10-minute window will only show the last updated watchlist

### Adding Stock to Watchlist: `addstock`

Expand Down
4 changes: 3 additions & 1 deletion docs/diagrams/investments/watchlistSequence.puml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ activate WatchListCommand
WatchList -> WatchList : getExpiredStocks()
activate WatchList
return queryStocks
WatchList -> WatchList : fetchLatestWatchListInfo()
WatchList -> WatchList : fetchFMPStockPrices()
activate WatchList
return
return
WatchListCommand -> Ui: printStocksInfo(watchlist)
activate Ui
Expand Down
Binary file modified docs/images/investments/watchlistSequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,10 @@ public void getLatestWatchlistInfo() throws FinancialPlannerException {
public StringBuilder getExpiredStocks() {
StringBuilder queryStocks = new StringBuilder();
long currentTime = System.currentTimeMillis();
long fiveMin = 300000;
long tenMin = 600000;
for (Map.Entry<String, Stock> set: stocks.entrySet()) {
Stock currentStock = set.getValue();
if (currentStock.getLastFetched() + fiveMin < currentTime) {
if (currentStock.getLastFetched() + tenMin < currentTime) {
queryStocks.append(set.getKey());
queryStocks.append(",");
}
Expand Down Expand Up @@ -241,8 +241,6 @@ public void setLastFetched(long fetchTime) {
* @param stockLocal
*/
public void extractStockInfoFromJSONObject(JSONObject stock, Stock stockLocal) {
//stockLocal.setLastFetched(fetchTime);

String price = stock.get("price").toString();
assert price != null;
stockLocal.setPrice(price);
Expand Down

0 comments on commit 2de04b7

Please sign in to comment.