commit
216300e60c
|
@ -63,7 +63,7 @@ namespace Core.Main
|
|||
private Dictionary<string, List<MarketTrendChange>> _globalMarketTrendChanges = new Dictionary<string, List<MarketTrendChange>>();
|
||||
private Dictionary<string, int> _singleMarketSettingsCount = new Dictionary<string, int>();
|
||||
Dictionary<string, List<SingleMarketSetting>> _triggeredSingleMarketSettings = new Dictionary<string, List<SingleMarketSetting>>();
|
||||
private static readonly object _lockObj = new object();
|
||||
private static volatile object _lockObj = new object();
|
||||
|
||||
public LogHelper Log
|
||||
{
|
||||
|
|
|
@ -26,43 +26,53 @@ namespace Core.MarketAnalyzer
|
|||
request.ContentType = "application/json";
|
||||
request.UserAgent = "PTMagic.Import";
|
||||
request.KeepAlive = true;
|
||||
request.Timeout = 60000;
|
||||
|
||||
HttpWebResponse httpResponse = null;
|
||||
string jsonString = string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
httpResponse = (HttpWebResponse)request.GetResponse();
|
||||
|
||||
StreamReader jsonReader = new StreamReader(httpResponse.GetResponseStream());
|
||||
string jsonString = jsonReader.ReadToEnd();
|
||||
using (StreamReader jsonReader = new StreamReader(httpResponse.GetResponseStream()))
|
||||
{
|
||||
jsonString = jsonReader.ReadToEnd();
|
||||
jsonReader.Close();
|
||||
}
|
||||
|
||||
jsonObject = JsonConvert.DeserializeObject<Dictionary<string, dynamic>>(jsonString);
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
log.DoLogCritical(string.Format("Error whilst calling {0} \nError: {1}", url, ex.Message), ex);
|
||||
|
||||
if (ex.Response != null)
|
||||
{
|
||||
// Error calling the service but we got a response so dump it.
|
||||
string responseString = string.Empty;
|
||||
var encoding = httpResponse.CharacterSet == "" ? Encoding.UTF8 : Encoding.GetEncoding(httpResponse.CharacterSet);
|
||||
var response = ((HttpWebResponse)ex.Response);
|
||||
var encoding = response.CharacterSet == "" ? Encoding.UTF8 : Encoding.GetEncoding(response.CharacterSet);
|
||||
|
||||
using (var stream = httpResponse.GetResponseStream())
|
||||
using (var stream = response.GetResponseStream())
|
||||
{
|
||||
var reader = new StreamReader(stream, encoding);
|
||||
responseString = reader.ReadToEnd();
|
||||
}
|
||||
|
||||
log.DoLogCritical(String.Format("{0} - Response: ({1}) {2} : {3}", ex.Message, httpResponse.StatusCode, httpResponse.StatusDescription, responseString), ex);
|
||||
log.DoLogCritical(String.Format("{0} - Response: ({1}) {2} : {3}", ex.Message, response.StatusCode, response.StatusDescription, responseString), ex);
|
||||
}
|
||||
|
||||
throw ex;
|
||||
throw;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
log.DoLogCritical(ex.Message, ex);
|
||||
}
|
||||
|
||||
return jsonObject;
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public static Newtonsoft.Json.Linq.JObject GetSimpleJsonObjectFromURL(string url, LogHelper log, bool swallowException)
|
||||
|
|
|
@ -416,7 +416,7 @@ namespace Core.MarketAnalyzer
|
|||
Dictionary<string, Market> tickMarkets = new Dictionary<string, Market>();
|
||||
foreach (string key in markets.Keys)
|
||||
{
|
||||
List<MarketTick> tickRange = marketTicks[key].FindAll(t => t.Time <= tickTime);
|
||||
List<MarketTick> tickRange = marketTicks[key] != null ? marketTicks[key].FindAll(t => t.Time <= tickTime) : new List<MarketTick>();
|
||||
|
||||
if (tickRange.Count > 0)
|
||||
{
|
||||
|
|
|
@ -7,7 +7,7 @@ using Core.Helper;
|
|||
using Core.Main.DataObjects.PTMagicData;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
[assembly: AssemblyVersion("2.2.6")]
|
||||
[assembly: AssemblyVersion("2.2.7")]
|
||||
[assembly: AssemblyProduct("PT Magic")]
|
||||
|
||||
namespace PTMagic
|
||||
|
|
Loading…
Reference in New Issue