private DalAccountGroup(ITradeSharpDictionary dic) { proxyDic = dic; try { Groups = dic.GetAccountGroupsWithSessionInfo().ToArray(); } catch (Exception ex) { Logger.Error("Ошибка инициализации словаря групп счетов", ex); } }
private TradeSharpDictionary(ITradeSharpDictionary proxyOrStub = null) { if (proxyOrStub != null) { proxy = proxyOrStub; return; } try { proxy = ProxyBuilder.Instance.GetImplementer<ITradeSharpDictionary>(); } catch (Exception ex) { Logger.Error("TradeSharpDictionary ctor", ex); } }
private TradeSharpDictionary(ITradeSharpDictionary proxyOrStub = null) { if (proxyOrStub != null) { proxy = proxyOrStub; return; } try { proxy = ProxyBuilder.Instance.GetImplementer <ITradeSharpDictionary>(); } catch (Exception ex) { Logger.Error("TradeSharpDictionary ctor", ex); } }
private void RenewFactory() { try { if (factory != null) { factory.Abort(); } factory = new ChannelFactory <ITradeSharpDictionary>(endpointName); channel = factory.CreateChannel(); } catch (Exception ex) { Logger.Error("TradeSharpDictionaryProxy: невозможно создать прокси", ex); channel = null; } }
private void FillDictionaries(ITradeSharpDictionary dict) { // прочитать локальную копию настроек группа - лот dictionaryGroupLot = LotByGroupDictionary.LoadFromFile(lotDicPath); if (dict != null) { try { long lotByGroupHashCode; tickers = dict.GetTickers(out lotByGroupHashCode).ToDictionary(t => t.Title, t => t); if (tickers.Count > 0) { // контракты прочитаны, проверить словарь группа - лот if (lotByGroupHashCode == 0) { dictionaryGroupLot.Clear(); } else { if (dictionaryGroupLot.calculatedHashCode != lotByGroupHashCode) { var newDictionaryGroupLot = dict.GetLotByGroup(); if (newDictionaryGroupLot != null) { dictionaryGroupLot = newDictionaryGroupLot; dictionaryGroupLot.SaveInFile(lotDicPath); } } } ConnectionWasEstablished = true; return; } else { Logger.ErrorFormat("DalSpot: тикеры не получены"); } } catch (Exception ex) { Logger.Error("Ошибка в DalSpot ctor (доступ к БД)", ex); } } InitializeDefault(); }
public static void Instantiate(ITradeSharpDictionary dict) { instance = new DalSpot(dict); }
private void FillDictionaries(ITradeSharpDictionary dict) { // прочитать локальную копию настроек группа - лот dictionaryGroupLot = LotByGroupDictionary.LoadFromFile(lotDicPath); if (dict != null) try { long lotByGroupHashCode; tickers = dict.GetTickers(out lotByGroupHashCode).ToDictionary(t => t.Title, t => t); if (tickers.Count > 0) { // контракты прочитаны, проверить словарь группа - лот if (lotByGroupHashCode == 0) dictionaryGroupLot.Clear(); else { if (dictionaryGroupLot.calculatedHashCode != lotByGroupHashCode) { var newDictionaryGroupLot = dict.GetLotByGroup(); if (newDictionaryGroupLot != null) { dictionaryGroupLot = newDictionaryGroupLot; dictionaryGroupLot.SaveInFile(lotDicPath); } } } ConnectionWasEstablished = true; return; } else { Logger.ErrorFormat("DalSpot: тикеры не получены"); } } catch (Exception ex) { Logger.Error("Ошибка в DalSpot ctor (доступ к БД)", ex); } InitializeDefault(); }
private DalSpot(ITradeSharpDictionary dict) { FillDictionaries(dict); }
public static void Initialize(ITradeSharpDictionary proxyOrStub) { instance = new TradeSharpDictionary(proxyOrStub); }
private void RenewFactory() { try { if (factory != null) factory.Abort(); factory = new ChannelFactory<ITradeSharpDictionary>(endpointName); channel = factory.CreateChannel(); } catch (Exception ex) { Logger.Error("TradeSharpDictionaryProxy: невозможно создать прокси", ex); channel = null; } }