EconomicIndicatorsPage
This commit is contained in:
@@ -1,10 +1,8 @@
|
|||||||
using DataDisplay.Common;
|
using DataDisplay.Common;
|
||||||
using DataDisplay.DataSource;
|
using DataDisplay.DataSource;
|
||||||
using SkiaSharp;
|
using SkiaSharp;
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace DataDisplay.Graph
|
namespace DataDisplay.Graph
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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<String> priceIndices = JsonConvert.DeserializeObject<List<String>>(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<EconomicIndicator> priceIndices = JsonConvert.DeserializeObject<List<EconomicIndicator>>(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 *************************************************
|
// ********************************************************** C O N S U M E R P R I C E I N D E X *************************************************
|
||||||
public ServiceResult GetDistinctConsumerPriceIndices()
|
public ServiceResult GetDistinctConsumerPriceIndices()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -248,20 +248,20 @@ namespace MarketData.Utils
|
|||||||
public static String FormatNumberConstrain(double value,int places=1,bool commas=false)
|
public static String FormatNumberConstrain(double value,int places=1,bool commas=false)
|
||||||
{
|
{
|
||||||
String strValue=null;
|
String strValue=null;
|
||||||
if(value>=1000)
|
if(value>=1000000000)
|
||||||
{
|
{
|
||||||
value/=1000;
|
value/=1000000000;
|
||||||
strValue=Utility.FormatNumber(value,places,commas)+"K";
|
strValue=Utility.FormatNumber(value,places,commas)+"B";
|
||||||
}
|
}
|
||||||
else if(value>=1000000)
|
else if(value>=1000000)
|
||||||
{
|
{
|
||||||
value/=1000000;
|
value/=1000000;
|
||||||
strValue=Utility.FormatNumber(value,places,commas)+"M";
|
strValue=Utility.FormatNumber(value,places,commas)+"M";
|
||||||
}
|
}
|
||||||
else if(value>=1000000000)
|
else if(value>=1000)
|
||||||
{
|
{
|
||||||
value/=1000000000;
|
value/=1000;
|
||||||
strValue=Utility.FormatNumber(value,places,commas)+"B";
|
strValue=Utility.FormatNumber(value,places,commas)+"K";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user