示例#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);
     }
 }
 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);
 }
 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);
 }
 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;
     }
 }