Пример #1
0
 private DalAccountGroup(ITradeSharpDictionary dic)
 {
     proxyDic = dic;
     try
     {
         Groups = dic.GetAccountGroupsWithSessionInfo().ToArray();
     }
     catch (Exception ex)
     {
         Logger.Error("Ошибка инициализации словаря групп счетов", ex);
     }
 }
Пример #2
0
 private DalAccountGroup(ITradeSharpDictionary dic)
 {
     proxyDic = dic;
     try
     {
         Groups = dic.GetAccountGroupsWithSessionInfo().ToArray();
     }
     catch (Exception ex)
     {
         Logger.Error("Ошибка инициализации словаря групп счетов", ex);
     }
 }
Пример #3
0
 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;
     }
 }
Пример #6
0
        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();
        }
Пример #7
0
 public static void Instantiate(ITradeSharpDictionary dict)
 {
     instance = new DalSpot(dict);
 }
Пример #8
0
        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();
        }
Пример #9
0
 private DalSpot(ITradeSharpDictionary dict)
 {
     FillDictionaries(dict);
 }
Пример #10
0
 public static void Initialize(ITradeSharpDictionary proxyOrStub)
 {
     instance = new TradeSharpDictionary(proxyOrStub);
 }
Пример #11
0
 public static void Instantiate(ITradeSharpDictionary dict)
 {
     instance = new DalSpot(dict);
 }
Пример #12
0
 private DalSpot(ITradeSharpDictionary dict)
 {
     FillDictionaries(dict);
 }
Пример #13
0
 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;
     }
 }