Skip to content

Commit

Permalink
handle 15 min delay for quotes. onpropertychange for investment.
Browse files Browse the repository at this point in the history
  • Loading branch information
rrelyea committed Mar 28, 2024
1 parent f89ab47 commit bbad078
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions library/Models/FamilyData/FamilyData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -795,16 +795,16 @@ public async Task RefreshPrices(HttpClient http)
var nextMarketClose = NextMarketClose(now).ToLocalTime();
var nextMarketOpen = new DateTime(nextMarketClose.Year, nextMarketClose.Month, nextMarketClose.Day, 13, 30, 00).ToLocalTime();
var marketIsBeforeOpen = DateTime.Now < nextMarketOpen;
bool marketIsOpen = DateTime.Now >= nextMarketOpen && DateTime.Now <= nextMarketClose;
var marketIsAfterClose = DateTime.Now > nextMarketClose;
bool marketIsOpen = DateTime.Now >= nextMarketOpen && DateTime.Now <= nextMarketClose.AddMinutes(15);
var marketIsAfterClose = DateTime.Now > nextMarketClose.AddMinutes(15);
foreach (var account in this.Accounts)
{
foreach (var investment in account.Investments)
{
bool fetchQuote = false;
if (investment.IsStock || investment.IsETF)
{
fetchQuote = investment.LastUpdated == null || (marketIsBeforeOpen && investment.LastUpdated < previousMarketClose) || marketIsOpen || (marketIsAfterClose && investment.LastUpdated < nextMarketClose);
fetchQuote = investment.LastUpdated == null || (marketIsBeforeOpen && investment.LastUpdated < previousMarketClose) || marketIsOpen || (marketIsAfterClose && investment.LastUpdated < nextMarketClose.AddMinutes(15));
}
else if (investment.IsFund)
{
Expand Down
1 change: 1 addition & 0 deletions library/Models/FamilyData/Investment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ public double? Shares {
}
set {
_Shares = value;
OnPropertyChanged();
UpdateValue();
}
}
Expand Down

0 comments on commit bbad078

Please sign in to comment.