diff --git a/DataDisplay/Graph/LineGraph.cs b/DataDisplay/Graph/LineGraph.cs index 7705f45..48ba225 100644 --- a/DataDisplay/Graph/LineGraph.cs +++ b/DataDisplay/Graph/LineGraph.cs @@ -1,10 +1,8 @@ using DataDisplay.Common; using DataDisplay.DataSource; using SkiaSharp; -using System; using System.Collections.Generic; using System.Linq; -using System.Text; namespace DataDisplay.Graph { diff --git a/MarketDataLib/Service/MarketDataServiceClient.cs b/MarketDataLib/Service/MarketDataServiceClient.cs index d703512..9b69031 100644 --- a/MarketDataLib/Service/MarketDataServiceClient.cs +++ b/MarketDataLib/Service/MarketDataServiceClient.cs @@ -149,6 +149,54 @@ namespace MarketData.Service } } + +// ********************************************************** E C O N O M I C I N D I C A T O R S ************************************************* + public ServiceResult GetDistinctEconomicIndicatorCodes() + { + lock (this) + { + try + { + if (!IsNetworkAvailable()) return new ServiceResult(false, "No network."); + if (!IsAuthorized()) return new ServiceResult(false, "Unauthorized."); + StringBuilder sb = new StringBuilder(); + sb.Append("/api/EconomicIndicators/GetDistinctEconomicIndicators?").Append("token=").Append(accessToken); + String json = httpClient.GetStringAsync(sb.ToString()).Result; + List priceIndices = JsonConvert.DeserializeObject>(json); + return new ServiceResult(priceIndices); + } + catch (Exception exception) + { + exceptions.Add(exception); + Debug.WriteLine(exception.ToString()); + return new ServiceResult(false, exception.ToString()); + } + } + } + + public ServiceResult GetGetEconomicIndicators(String indicatorCode) + { + lock (this) + { + try + { + if (!IsNetworkAvailable()) return new ServiceResult(false, "No network."); + if (!IsAuthorized()) return new ServiceResult(false, "Unauthorized."); + StringBuilder sb = new StringBuilder(); + sb.Append("/api/EconomicIndicators/GetEconomicIndicators?").Append("token=").Append(accessToken).Append("&").Append("indicatorCode=").Append(HttpUtility.UrlEncode(indicatorCode)); + String json = httpClient.GetStringAsync(sb.ToString()).Result; + List priceIndices = JsonConvert.DeserializeObject>(json); + return new ServiceResult(priceIndices); + } + catch (Exception exception) + { + exceptions.Add(exception); + Debug.WriteLine(exception.ToString()); + return new ServiceResult(false, exception.ToString()); + } + } + } + // ********************************************************** C O N S U M E R P R I C E I N D E X ************************************************* public ServiceResult GetDistinctConsumerPriceIndices() { diff --git a/MarketDataLib/Utility/Utility.cs b/MarketDataLib/Utility/Utility.cs index efec0c6..bce2005 100644 --- a/MarketDataLib/Utility/Utility.cs +++ b/MarketDataLib/Utility/Utility.cs @@ -248,20 +248,20 @@ namespace MarketData.Utils public static String FormatNumberConstrain(double value,int places=1,bool commas=false) { String strValue=null; - if(value>=1000) + if(value>=1000000000) { - value/=1000; - strValue=Utility.FormatNumber(value,places,commas)+"K"; + value/=1000000000; + strValue=Utility.FormatNumber(value,places,commas)+"B"; } else if(value>=1000000) { value/=1000000; strValue=Utility.FormatNumber(value,places,commas)+"M"; } - else if(value>=1000000000) + else if(value>=1000) { - value/=1000000000; - strValue=Utility.FormatNumber(value,places,commas)+"B"; + value/=1000; + strValue=Utility.FormatNumber(value,places,commas)+"K"; } else {