/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			Address = storage.GetValue<Uri>("Address");
			CustomDateFormat = storage.GetValue<string>("CustomDateFormat");
		}
Ejemplo n.º 2
0
		/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public void Load(SettingsStorage storage)
		{
			Rules.AddRange(storage.GetValue<IList<AlertRule>>("Rules"));
			AlertType = storage.GetValue<string>("AlertType").To<AlertTypes?>();
			Caption = storage.GetValue<string>("Caption");
			Message = storage.GetValue<string>("Message");
		}
Ejemplo n.º 3
0
		void IPersistable.Load(SettingsStorage storage)
		{
			Address = storage.GetValue<EndPoint>(nameof(Address));
			Login = storage.GetValue<string>(nameof(Login));
			Password = storage.GetValue<string>(nameof(Password));
			Type = storage.GetValue<ProxyTypes>(nameof(Type));
		}
		/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			Key = storage.GetValue<SecureString>("Key");
			Secret = storage.GetValue<SecureString>("Secret");
		}
		/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			Login = storage.GetValue<string>("Login");
			Password = storage.GetValue<SecureString>("Password");
		}
Ejemplo n.º 6
0
		public override void Load(SettingsStorage storage)
		{
			var panelSettings = storage.GetValue<SettingsStorage>("PositionsPanel");
			if (panelSettings != null)
				((IPersistable)PositionsPanel).Load(panelSettings);

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSettings");
			if (alertSettings != null)
				AlertBtn.Load(alertSettings);
		}
Ejemplo n.º 7
0
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			SubscribeNews = storage.GetValue("SubscribeNews", false);
			NewsGrid.Load(storage.GetValue<SettingsStorage>("NewsGrid"));

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSettings");
			if (alertSettings != null)
				AlertBtn.Load(alertSettings);
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			var portfolio = storage.GetValue<string>("Portfolio");
			if (!portfolio.IsEmpty())
				Portfolio = ConfigManager.GetService<StrategyConnector>().LookupPortfolio(portfolio);

			var security = storage.GetValue<string>("Security");
			if (!security.IsEmpty())
				Security = ConfigManager.GetService<StrategyConnector>().LookupById(security);
		}
Ejemplo n.º 9
0
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			SubscribeNews = storage.GetValue("SubscribeNews", false);

			NewsGrid.NewsProvider = ConfigManager.GetService<INewsProvider>();
			NewsGrid.Load(storage.GetValue<SettingsStorage>("NewsGrid"));

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSettings");
			if (alertSettings != null)
				AlertBtn.Load(alertSettings);
		}
Ejemplo n.º 10
0
		public override void Load(SettingsStorage storage)
		{
			var compositionId = storage.GetValue<Guid>("CompositionId");
			var registry = ConfigManager.GetService<StrategiesRegistry>();
			var composition = (CompositionDiagramElement)registry.Strategies.FirstOrDefault(c => c.TypeId == compositionId);

			Composition = registry.Clone(composition);
			Id = storage.GetValue<Guid>("StrategyId");

			var emulationSettings = storage.GetValue<SettingsStorage>("EmulationSettings");

			if (emulationSettings != null)
				EmulationSettings.Load(emulationSettings);

			base.Load(storage);
		}
Ejemplo n.º 11
0
		public void Load(SettingsStorage storage)
		{
			var settings = storage
				.GetValue<IEnumerable<SettingsStorage>>("Settings", new SettingsStorage[0])
				.Select(s => s.Load<MarketDataSettings>());

			Settings.Clear();
			Settings.AddRange(settings);
		}
Ejemplo n.º 12
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Settings storage.</param>
		public void Load(SettingsStorage storage)
		{
			if (_alertSchema == null)
				return;

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSchema");
			if (alertSettings != null)
				_alertSchema.Load(alertSettings);

			TryRegisterAlertSchema();
			IsChecked = _alertSchema.AlertType != null;
		}
Ejemplo n.º 13
0
		public override void Load(SettingsStorage storage)
		{
			var values = storage.GetValue<KeyValuePair<string, decimal>[]>("InnerPortfolios");
			if (values != null)
			{
				var pairs = values
					.Select(v => new KeyValuePair<Portfolio, decimal>(ConfigManager.GetService<IConnector>().Portfolios.FirstOrDefault(p => p.Name == v.Key), v.Value))
					.ToArray();

				InnerPortfolios.AddRange(pairs);
			}
		}
Ejemplo n.º 14
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Interval = storage.GetValue <TimeSpan>(nameof(Interval));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     Login     = storage.GetValue <string>(nameof(Login));
     Password  = storage.GetValue <SecureString>(nameof(Password));
     AutoLogon = storage.GetValue <bool>(nameof(AutoLogon));
 }
Ejemplo n.º 16
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Settings storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            UserName = storage.GetValue <string>("UserName");
            Password = storage.GetValue <SecureString>("Password");
            TransactionalUserName      = storage.GetValue <string>("TransactionalUserName");
            TransactionalPassword      = storage.GetValue <SecureString>("TransactionalPassword");
            AdminConnectionPoint       = storage.GetValue <string>("AdminConnectionPoint");
            MarketDataConnectionPoint  = storage.GetValue <string>("MarketDataConnectionPoint");
            TransactionConnectionPoint = storage.GetValue <string>("TransactionConnectionPoint");
            PositionConnectionPoint    = storage.GetValue <string>("PositionConnectionPoint");
            HistoricalConnectionPoint  = storage.GetValue <string>("HistoricalConnectionPoint");
            CertFile             = storage.GetValue <string>("CertFile");
            DomainServerAddress  = storage.GetValue <string>("DomainServerAddress");
            DomainName           = storage.GetValue <string>("DomainName");
            LicenseServerAddress = storage.GetValue <string>("LicenseServerAddress");
            LocalBrokerAddress   = storage.GetValue <string>("LocalBrokerAddress");
            LoggerAddress        = storage.GetValue <string>("LoggerAddress");
            LogFileName          = storage.GetValue <string>("LogFileName");
        }
Ejemplo n.º 17
0
        /// <summary>
        /// Восстановить состояние стратегии.
        /// </summary>
        /// <remarks>
        /// Данный метод используется для загрузки статистики, заявок и сделок.
        ///
        /// Хранилище данных должно содержать следующие параметры:
        /// 1. Settings (SettingsStorage) - настройки стратегии.
        /// 2. Statistics(SettingsStorage) - сохраненное состояние статистики.
        /// 3. Orders (IDictionary[Order, IEnumerable[MyTrade]]) - заявки и сделки по ним.
        /// 4. Positions (IEnumerable[Position]) - позиции стратегии.
        ///
        /// При отсутствии одного из параметров соответствующие данные восстанавливаться не будут.
        /// </remarks>
        /// <param name="strategy">Стратегия.</param>
        /// <param name="storage">Хранилище данных.</param>
        public static void LoadState(this Strategy strategy, SettingsStorage storage)
        {
            if (strategy == null)
            {
                throw new ArgumentNullException("strategy");
            }

            if (storage == null)
            {
                throw new ArgumentNullException("storage");
            }

            var settings = storage.GetValue <SettingsStorage>("Settings");

            if (settings != null && settings.Count != 0)
            {
                var connector = strategy.Connector ?? ConfigManager.TryGetService <IConnector>();

                if (connector != null && settings.Contains("security"))
                {
                    strategy.Security = connector.LookupById(settings.GetValue <string>("security"));
                }

                if (connector != null && settings.Contains("portfolio"))
                {
                    strategy.Portfolio = connector.Portfolios.FirstOrDefault(p => p.Name == settings.GetValue <string>("portfolio"));
                }

                var id = strategy.Id;

                strategy.Load(settings);

                if (strategy.Id != id)
                {
                    throw new InvalidOperationException(LocalizedStrings.Str1404);
                }
            }

            var statistics = storage.GetValue <SettingsStorage>("Statistics");

            if (statistics != null)
            {
                foreach (var parameter in strategy.StatisticManager.Parameters.Where(parameter => statistics.ContainsKey(parameter.Name)))
                {
                    parameter.Load(statistics.GetValue <SettingsStorage>(parameter.Name));
                }
            }

            var orders = storage.GetValue <IDictionary <Order, IEnumerable <MyTrade> > >("Orders");

            if (orders != null)
            {
                foreach (var pair in orders)
                {
                    strategy.AttachOrder(pair.Key, pair.Value);
                }
            }

            var positions = storage.GetValue <IEnumerable <Position> >("Positions");

            if (positions != null)
            {
                strategy.PositionManager.Positions = positions;
            }
        }
		public override void Load(SettingsStorage storage)
		{
			var gridSettings = storage.GetValue<SettingsStorage>("SecurityPicker");
			if (gridSettings != null)
				SecurityPicker.Load(gridSettings);

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSettings");
			if (alertSettings != null)
				AlertBtn.Load(alertSettings);

			_securityIds.SyncDo(list =>
			{
				list.Clear();
				list.AddRange(storage.GetValue("Securities", ArrayHelper.Empty<string>()));
			});

			SecurityPicker.SecurityProvider = ConfigManager.GetService<ISecurityProvider>();
		}
Ejemplo n.º 19
0
        /// <summary>
        /// Загрузить настройки.
        /// </summary>
        /// <param name="storage">Хранилище настроек.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            RealTimeCandleOffset = storage.GetValue <TimeSpan>("RealTimeCandleOffset");
        }
Ejemplo n.º 20
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     StockSharpId = storage.GetValue <SettingsStorage>(nameof(StockSharpId)).Load <SecurityId>();
     AdapterId    = storage.GetValue <SettingsStorage>(nameof(AdapterId)).Load <SecurityId>();
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public virtual void Load(SettingsStorage storage)
 {
     DateFormat = storage.GetValue <string>(nameof(DateFormat));
     TimeFormat = storage.GetValue <string>(nameof(TimeFormat));
 }
Ejemplo n.º 22
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     Account     = storage.GetValue <string>(nameof(Account));
     AccountName = storage.GetValue <string>(nameof(AccountName));
     Name        = storage.GetValue <string>(nameof(Name));
     Address     = storage.GetValue <string>(nameof(Address));
     Country     = storage.GetValue <string>(nameof(Country));
     City        = storage.GetValue <string>(nameof(City));
     Bic         = storage.GetValue <string>(nameof(Bic));
     Swift       = storage.GetValue <string>(nameof(Swift));
     Iban        = storage.GetValue <string>(nameof(Iban));
     PostalCode  = storage.GetValue <string>(nameof(PostalCode));
     Currency    = storage.GetValue <CurrencyTypes>(nameof(Currency));
 }
Ejemplo n.º 23
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="settings">Settings storage.</param>
 public override void Load(SettingsStorage settings)
 {
     base.Load(settings);
     SqrtPeriod = settings.GetValue <int>(nameof(SqrtPeriod));
 }
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="settings">Settings storage.</param>
        public override void Load(SettingsStorage settings)
        {
            base.Load(settings);

            Multiple = settings.GetValue <decimal>(nameof(Multiple));
        }
Ejemplo n.º 25
0
        public static void LoadState(this Strategy strategy, SettingsStorage storage)
        {
            if (strategy == null)
            {
                throw new ArgumentNullException(nameof(strategy));
            }

            if (storage == null)
            {
                throw new ArgumentNullException(nameof(storage));
            }

            var settings = storage.GetValue <SettingsStorage>("Settings");

            if (settings != null && settings.Count != 0)
            {
                var connector = strategy.Connector ?? ServicesRegistry.Connector;

                if (connector != null && settings.Contains("security"))
                {
                    strategy.Security = connector.LookupById(settings.GetValue <string>("security"));
                }

                if (connector != null && settings.Contains("portfolio"))
                {
                    strategy.Portfolio = connector.LookupByPortfolioName(settings.GetValue <string>("portfolio"));
                }

                var id = strategy.Id;

                strategy.Load(settings);

                if (strategy.Id != id)
                {
                    throw new InvalidOperationException(LocalizedStrings.Str1404);
                }
            }

            var statistics = storage.GetValue <SettingsStorage>("Statistics");

            if (statistics != null)
            {
                foreach (var parameter in strategy.StatisticManager.Parameters.Where(parameter => statistics.ContainsKey(parameter.Name)))
                {
                    parameter.Load(statistics.GetValue <SettingsStorage>(parameter.Name));
                }
            }

            var orders = storage.GetValue <IDictionary <Order, IEnumerable <MyTrade> > >("Orders");

            if (orders != null)
            {
                foreach (var pair in orders)
                {
                    strategy.AttachOrder(pair.Key, pair.Value);
                }
            }

            //var positions = storage.GetValue<IEnumerable<KeyValuePair<Tuple<SecurityId, string>, decimal>>>("Positions");
            //if (positions != null)
            //{
            //	strategy.PositionManager.Positions = positions;
            //}
        }
Ejemplo n.º 26
0
 void IPersistable.Load(SettingsStorage storage)
 {
     _monitor.Load(storage);
     BringToFrontOnError = storage.GetValue <bool>("BringToFrontOnError");
 }
Ejemplo n.º 27
0
			public void Load(SettingsStorage storage)
			{
				Name = storage.GetValue<string>("Name");
				Number = storage.GetValue<int>("Number");
				Values.AddRange(storage.GetValue<SettingsStorage[]>("Values").Select(s => s.Load<ImportEnumMappingWindow.MappingValue>()));
				DefaultValue = storage.GetValue<object>("DefaultValue");
				Format = storage.GetValue<string>("Format");
			}
Ejemplo n.º 28
0
        /// <summary>
        /// To load the state of paper trading parameters.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public virtual void Load(SettingsStorage storage)
        {
            DepthExpirationTime       = storage.GetValue("DepthExpirationTime", DepthExpirationTime);
            MatchOnTouch              = storage.GetValue("MatchOnTouch", MatchOnTouch);
            Failing                   = storage.GetValue("Failing", Failing);
            Latency                   = storage.GetValue("Latency", Latency);
            IsSupportAtomicReRegister = storage.GetValue("IsSupportAtomicReRegister", IsSupportAtomicReRegister);
            BufferTime                = storage.GetValue("BufferTime", BufferTime);
            //UseCandlesTimeFrame = storage.GetValue("UseCandlesTimeFrame", UseCandlesTimeFrame);
            InitialOrderId          = storage.GetValue("InitialOrderId", InitialOrderId);
            InitialTradeId          = storage.GetValue("InitialTradeId", InitialTradeId);
            InitialTransactionId    = storage.GetValue("InitialTransactionId", InitialTransactionId);
            SpreadSize              = storage.GetValue("SpreadSize", SpreadSize);
            MaxDepth                = storage.GetValue("MaxDepth", MaxDepth);
            VolumeMultiplier        = storage.GetValue("VolumeMultiplier", VolumeMultiplier);
            PortfolioRecalcInterval = storage.GetValue("PortfolioRecalcInterval", PortfolioRecalcInterval);
            ConvertTime             = storage.GetValue("ConvertTime", ConvertTime);
            PriceLimitOffset        = storage.GetValue("PriceLimitOffset", PriceLimitOffset);
            IncreaseDepthVolume     = storage.GetValue("IncreaseDepthVolume", IncreaseDepthVolume);

            if (storage.Contains("TimeZone"))
            {
                TimeZone = TimeZoneInfo.FromSerializedString(storage.GetValue <string>("TimeZone"));
            }
        }
Ejemplo n.º 29
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Settings storage.</param>
		public void Load(SettingsStorage storage)
		{
			Login = storage.GetValue<string>("Login");
			Password = storage.GetValue<SecureString>("Password");
			AutoLogon = storage.GetValue<bool>("AutoLogon");
		}
Ejemplo n.º 30
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Storage.</param>
 public void Load(SettingsStorage storage)
 {
     Rules.AddRange(storage.GetValue <SettingsStorage[]>("Rules").Select(s => s.LoadEntire <IRiskRule>()));
 }
Ejemplo n.º 31
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public virtual void Load(SettingsStorage storage)
 {
     Path = storage.GetValue <string>("Path");
 }
Ejemplo n.º 32
0
 /// <inheritdoc />
 public override void Load(SettingsStorage storage)
 {
     _firstPnL = storage.GetValue <decimal?>("FirstPnL");
     base.Load(storage);
 }
Ejemplo n.º 33
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     Type  = storage.GetValue <UnitTypes>("Type");
     Value = storage.GetValue <decimal>("Value");
 }
Ejemplo n.º 34
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Settings storage.</param>
		public override void Load(SettingsStorage storage)
		{
			HeartbeatInterval = storage.GetValue<TimeSpan>(nameof(HeartbeatInterval));
			SupportedMessages = storage.GetValue<string[]>(nameof(SupportedMessages)).Select(i => i.To<MessageTypes>()).ToArray();
			AssociatedBoardCode = storage.GetValue(nameof(AssociatedBoardCode), AssociatedBoardCode);

			base.Load(storage);
		}
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="storage">Settings storage.</param>
 public void Load(SettingsStorage storage)
 {
     SetBoardCode(storage.GetValue("SelectedBoard", ExchangeBoard.Nasdaq.Code));
 }
Ejemplo n.º 36
0
		/// <summary>
		/// To load the state of paper trading parameters.
		/// </summary>
		/// <param name="storage">Storage.</param>
		public virtual void Load(SettingsStorage storage)
		{
			DepthExpirationTime = storage.GetValue("DepthExpirationTime", DepthExpirationTime);
			MatchOnTouch = storage.GetValue("MatchOnTouch", MatchOnTouch);
			Failing = storage.GetValue("Failing", Failing);
			Latency = storage.GetValue("Latency", Latency);
			IsSupportAtomicReRegister = storage.GetValue("IsSupportAtomicReRegister", IsSupportAtomicReRegister);
			BufferTime = storage.GetValue("BufferTime", BufferTime);
			//UseCandlesTimeFrame = storage.GetValue("UseCandlesTimeFrame", UseCandlesTimeFrame);
			InitialOrderId = storage.GetValue("InitialOrderId", InitialOrderId);
			InitialTradeId = storage.GetValue("InitialTradeId", InitialTradeId);
			InitialTransactionId = storage.GetValue("InitialTransactionId", InitialTransactionId);
			SpreadSize = storage.GetValue("SpreadSize", SpreadSize);
			MaxDepth = storage.GetValue("MaxDepth", MaxDepth);
			VolumeMultiplier = storage.GetValue("VolumeMultiplier", VolumeMultiplier);
			PortfolioRecalcInterval = storage.GetValue("PortfolioRecalcInterval", PortfolioRecalcInterval);
			ConvertTime = storage.GetValue("ConvertTime", ConvertTime);
			PriceLimitOffset = storage.GetValue("PriceLimitOffset", PriceLimitOffset);
			IncreaseDepthVolume = storage.GetValue("IncreaseDepthVolume", IncreaseDepthVolume);

			if (storage.Contains("TimeZone"))
				TimeZone = TimeZoneInfo.FromSerializedString(storage.GetValue<string>("TimeZone"));
		}
        /// <summary>
        /// Загрузить настройки.
        /// </summary>
        /// <param name="storage">Хранилище настроек.</param>
        public override void Load(SettingsStorage storage)
        {
            Login              = storage.GetValue <string>("Login");
            Password           = storage.GetValue <SecureString>("Password");
            Address            = storage.GetValue <EndPoint>("Address");
            DllPath            = storage.GetValue <string>("DllPath");
            ApiLogsPath        = storage.GetValue <string>("ApiLogsPath");
            ApiLogLevel        = storage.GetValue <ApiLogLevels>("ApiLogLevel");
            IsHFT              = storage.GetValue <bool>("IsHFT");
            MarketDataInterval = storage.GetValue <TimeSpan?>("MarketDataInterval");

            if (storage.GetValue <bool>("HasProxy"))
            {
                Proxy = new Proxy
                {
                    Address  = storage.GetValue <EndPoint>("ProxyAddress"),
                    Login    = storage.GetValue <string>("ProxyLogin"),
                    Password = storage.GetValue <string>("ProxyPassword"),
                    Type     = storage.GetValue <ProxyTypes>("ProxyType"),
                };
            }

            //ShowChangePasswordWindowOnConnect = storage.GetValue<bool>("ChangePasswordOnConnect");

            MicexRegisters = storage.GetValue("MicexRegisters", true);
            OverrideDll    = storage.GetValue <bool>("OverrideDll");

            base.Load(storage);
        }
		public override void Load(SettingsStorage storage)
		{
			base.Load(storage);

			FindedOrderLog.Load(storage.GetValue<SettingsStorage>("FindedOrderLog"));
			IsNonSystem.IsChecked = storage.GetValue<bool>("IsNonSystem");
		}
Ejemplo n.º 39
0
		void IPersistable.Load(SettingsStorage storage)
		{
			var layout = storage.GetValue<string>("Layout");
			if (layout != null)
				DockSite.LoadLayout(layout);

			var parameters = storage.GetValue<IEnumerable<SettingsStorage>>("Parameters");
			if (parameters != null)
			{
				_parameters.Clear();
				_parameters.AddRange(parameters.Select(p => p.Load<ParameterInfo>()));
			}

			if (Strategy != null && Strategy.Strategy != null)
				OnStrategyAssigned(Strategy.Strategy);
		}
Ejemplo n.º 40
0
			public void Load(SettingsStorage storage)
			{
				Path = storage.GetValue<string>("Path");
				ColumnSeparator = storage.GetValue<string>("ColumnSeparator");
				//RowSeparator = storage.GetValue<string>("RowSeparator");
				SkipFromHeader = storage.GetValue<int>("SkipFromHeader");
				//SkipFromFooter = storage.GetValue<int>("SkipFromFooter");
				Format = storage.GetValue<StorageFormats>("Format");

				if (storage.ContainsKey("Drive"))
					Drive = DriveCache.Instance.GetDrive(storage.GetValue<string>("Drive"));

				TimeZone = TimeZoneInfo.FindSystemTimeZoneById(storage.GetValue<string>("TimeZone"));

				CandleSettings = storage.GetValue("CandleSettings", CandleSettings);
			}
Ejemplo n.º 41
0
 public void Load(SettingsStorage storage)
 {
     EmulationSettings.Load(storage.GetValue <SettingsStorage>("EmulationSettings"));
 }
Ejemplo n.º 42
0
 /// <inheritdoc />
 public override void Load(SettingsStorage storage)
 {
     _maxEquity = storage.GetValue <decimal>("MaxEquity");
     base.Load(storage);
 }
Ejemplo n.º 43
0
		/// <summary>
		/// Загрузить настройки.
		/// </summary>
		/// <param name="storage">Хранилище настроек.</param>
		public void Load(SettingsStorage storage)
		{
			TemplateTxtDepth = storage.GetValue("TemplateTxtDepth", TemplateTxtDepth);
			TemplateTxtTick = storage.GetValue("TemplateTxtTick", TemplateTxtTick);
			TemplateTxtCandle = storage.GetValue("TemplateTxtCandle", TemplateTxtCandle);
			TemplateTxtLevel1 = storage.GetValue("TemplateTxtLevel1", TemplateTxtLevel1);
			TemplateTxtOrderLog = storage.GetValue("TemplateTxtOrderLog", TemplateTxtOrderLog);
			TemplateTxtTransaction = storage.GetValue("TemplateTxtTransaction", TemplateTxtTransaction);
			TemplateTxtSecurity = storage.GetValue("TemplateTxtSecurity", TemplateTxtSecurity);
			TemplateTxtNews = storage.GetValue("TemplateTxtNews", TemplateTxtNews);
		}
Ejemplo n.º 44
0
 /// <summary>
 /// Load settings.
 /// </summary>
 /// <param name="settings">Settings storage.</param>
 public override void Load(SettingsStorage settings)
 {
     base.Load(settings);
     Length = settings.GetValue <int>(nameof(Length));
 }
Ejemplo n.º 45
0
		public override void Load(SettingsStorage storage)
		{
			_storage = storage;

			var strategyInfoId = storage.GetValue<long?>("StrategyInfoId");

			if (Strategy == null && strategyInfoId != null)
			{
				StrategyInfo = ConfigManager
					.GetService<IStudioEntityRegistry>()
					.Strategies.ReadById(strategyInfoId);

				this.InitStrategy();
			}

			if (Strategy != null)
			{
				Strategy.Id = storage.GetValue<Guid>("StrategyContainerId");
				Strategy.Load(storage);
			}

			var marketDataSettings = storage.GetValue<string>("MarketDataSettings");
			if (marketDataSettings != null)
			{
				var id = marketDataSettings.To<Guid>();
				var settings = ConfigManager.GetService<MarketDataSettingsCache>().Settings.FirstOrDefault(s => s.Id == id);

				if (settings != null)
					MarketDataSettings = settings;
			}

			HistoryDaysCount = storage.GetValue("HistoryDaysCount", _defaultHistoryDaysCount);
		}
Ejemplo n.º 46
0
 /// <summary>
 /// To load the state of statistic parameter.
 /// </summary>
 /// <param name="storage">Storage.</param>
 public virtual void Load(SettingsStorage storage)
 {
     Value = storage.GetValue("Value", default(TValue));
 }
Ejemplo n.º 47
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Settings storage.</param>
		public virtual void Load(SettingsStorage storage)
		{
			DateFormat = storage.GetValue<string>("DateFormat");
			TimeFormat = storage.GetValue<string>("TimeFormat");
		}
Ejemplo n.º 48
0
        public static void LoadUISettings(this SettingsStorage storage, DockSite dockSite, PairSet <Tuple <string, Type>, IContentWindow> contents)
        {
            var controlsSettings = storage.GetValue <SettingsStorage[]>("Content");

            foreach (var ctrlSettings in controlsSettings)
            {
                try
                {
                    var id                = ctrlSettings.GetValue <string>("Id");
                    var ctrlType          = ctrlSettings.GetValue <string>("Type").To <Type>();
                    var isToolWindow      = ctrlSettings.GetValue <bool>("IsToolWindow");
                    var dockingWindowName = ctrlSettings.GetValue <string>("DockingWindowName");
                    var controlSettings   = ctrlSettings.GetValue <SettingsStorage>("Settings");
                    var tagType           = ctrlSettings.GetValue <string>("TagType").To <Type>();

                    var    canClose = true;
                    object tag      = null;

                    if (tagType == typeof(StrategyInfo))
                    {
                        tag = ConfigManager.GetService <IStudioEntityRegistry>().Strategies.ReadById(id.To <long>());

                        if (tag == null)
                        {
                            continue;
                        }
                    }
                    else if (tagType != null && tagType.IsSubclassOf(typeof(Strategy)))
                    {
                        var sessionStrategy = ConfigManager.GetService <IStudioEntityRegistry>().ReadSessionStrategyById(id.To <Guid>());

                        if (sessionStrategy != null)
                        {
                            tag = sessionStrategy.Strategy;
                        }

                        if (tag == null)
                        {
                            continue;
                        }
                    }
                    else if (tagType == typeof(CompositionDiagramElement))
                    {
                        tag = ConfigManager.GetService <CompositionRegistry>().DiagramElements.FirstOrDefault(c => c.TypeId == id.To <Guid>());

                        if (tag == null)
                        {
                            continue;
                        }
                    }
                    else if (tagType == typeof(ExpressionIndexSecurity) || tagType == typeof(ContinuousSecurity))
                    {
                        tag = ConfigManager.GetService <IStudioEntityRegistry>().Securities.ReadById(id);

                        if (tag == null)
                        {
                            continue;
                        }
                    }

                    var control = ctrlType.CreateInstance <IStudioControl>();

                    var info = tag as StrategyInfo;
                    if (info != null)
                    {
                        control.DoIf <IStudioControl, StrategyInfoCodeContent>(c =>
                        {
                            canClose       = false;
                            c.StrategyInfo = info;
                        });
                        control.DoIf <IStudioControl, DiagramPanel>(c =>
                        {
                            canClose       = false;
                            c.StrategyInfo = info;
                        });
                        control.DoIf <IStudioControl, StrategyInfoContent>(c => c.StrategyInfo = info);

                        ConfigManager
                        .GetService <IStudioCommandService>()
                        .Bind(control.GetKey(), (IStudioCommandScope)control);
                    }

                    var strategy = tag as StrategyContainer;
                    if (strategy != null)
                    {
                        control.DoIf <IStudioControl, StrategyContent>(c => c.SetStrategy(strategy));
                        control.DoIf <IStudioControl, DiagramDebuggerPanel>(c => c.Strategy = strategy);
                        control.DoIf <IStudioControl, OptimizatorContent>(c => c.SetStrategy(strategy));
                    }

                    var composition = tag as CompositionDiagramElement;
                    if (composition != null)
                    {
                        ((DiagramPanel)control).Composition = composition;
                    }

                    var security = tag as Security;
                    if (security != null)
                    {
                        ((CompositeSecurityPanel)control).Security = security;
                    }

                    var window = isToolWindow
                                                ? (IContentWindow) new ContentToolWindow {
                        Id = id, Tag = tag, Control = control, Name = dockingWindowName, CanClose = canClose
                    }
                                                : new ContentDocumentWindow {
                        Id = id, Tag = tag, Control = control, Name = dockingWindowName, CanClose = canClose
                    };

                    if (isToolWindow)
                    {
                        dockSite.ToolWindows.Add((ToolWindow)window);
                    }
                    else
                    {
                        dockSite.DocumentWindows.Add((DocumentWindow)window);
                    }

                    ((DockingWindow)window).Activate();

                    if (controlSettings != null)
                    {
                        control.Load(controlSettings);
                    }

                    contents.Add(Tuple.Create(id, ctrlType), window);
                }
                catch (Exception e)
                {
                    e.LogError();
                }
            }

            var layout = storage.GetValue <string>("Layout");

            if (layout != null)
            {
                try
                {
                    dockSite.LoadLayout(layout);
                }
                catch (Exception ex)
                {
                    ex.LogError();
                }
            }

            var activeWindow = storage.GetValue <string>("ActiveWindow");

            if (activeWindow != null)
            {
                var id = activeWindow.To <Guid>();

                var window = dockSite
                             .ToolWindows
                             .OfType <DockingWindow>()
                             .Concat(dockSite.DocumentWindows)
                             .FirstOrDefault(w => w.UniqueId == id);

                if (window != null)
                {
                    window.Activate();
                }
            }
        }
Ejemplo n.º 49
0
			public void Load(SettingsStorage storage)
			{
				Name = storage.GetValue<string>("Name");
				Type = storage.GetValue<Type>("Type");
				IsEnabled = storage.GetValue<bool>("IsEnabled");
				From = storage.GetValue<decimal>("From");
				To = storage.GetValue<decimal>("To");
				Step = storage.GetValue<decimal>("Step");
			}
Ejemplo n.º 50
0
 /// <summary>
 /// Загрузить настройки.
 /// </summary>
 /// <param name="storage">Хранилище.</param>
 public virtual void Load(SettingsStorage storage)
 {
     Action = storage.GetValue <RiskActions>("Action");
 }
Ejemplo n.º 51
0
		public override void Load(SettingsStorage storage)
		{
			TradesGrid.Load(storage.GetValue<SettingsStorage>("GridSettings"));

			_securityIds.SyncDo(list =>
			{
				list.Clear();
				list.AddRange(storage.GetValue("Securities", ArrayHelper.Empty<string>()));
			});

			var alertSettings = storage.GetValue<SettingsStorage>("AlertSettings");
			if (alertSettings != null)
				AlertBtn.Load(alertSettings);

			VolumeFilter.Value = storage.GetValue<decimal?>("VolumeFilter");
		}
Ejemplo n.º 52
0
        /// <summary>
        /// Загрузить настройки.
        /// </summary>
        /// <param name="storage">Хранилище.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Volume = storage.GetValue <decimal>("Volume");
        }
Ejemplo n.º 53
0
		void IPersistable.Load(SettingsStorage storage)
		{
			DataType = storage.GetValue<Type>("DataType");
			ExecutionType = storage.GetValue<ExecutionTypes?>("ExecutionType");

			foreach (var fieldSettings in storage.GetValue<SettingsStorage[]>("Fields"))
			{
				var fieldName = fieldSettings.GetValue<string>("Name");
				var field = _fields.FirstOrDefault(f => f.Name.CompareIgnoreCase(fieldName));

				if (field != null)
					field.Load(fieldSettings);
			}

			_settings.Load(storage.GetValue<SettingsStorage>("Settings"));
		}
Ejemplo n.º 54
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Position = storage.GetValue <decimal>("Position");
        }
Ejemplo n.º 55
0
 void IPersistable.Load(SettingsStorage storage)
 {
     Year = storage.GetValue<DateTime>("Year");
     Trader = storage.GetValue<string>("Trader");
     From = storage.GetValue<DateTime?>("From");
     To = storage.GetValue<DateTime?>("To");
     Security1 = storage.GetValue<string>("Security1");
     Security2 = storage.GetValue<string>("Security2");
     Security3 = storage.GetValue<string>("Security3");
     Security4 = storage.GetValue<string>("Security4");
     TimeFrame = storage.GetValue<TimeSpan>("TimeFrame");
 }
Ejemplo n.º 56
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Time = storage.GetValue <TimeSpan>("Time");
        }
			void IPersistable.Load(SettingsStorage storage)
			{
				ValueFile = storage.GetValue<string>("ValueFile");
				ValueStockSharp = storage.GetValue<object>("ValueStockSharp");
			}
Ejemplo n.º 58
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Commission = storage.GetValue <decimal>("Commission");
        }
Ejemplo n.º 59
0
		/// <summary>
		/// Load settings.
		/// </summary>
		/// <param name="storage">Settings storage.</param>
		public void Load(SettingsStorage storage)
		{
			ErrorsGrid.Load(storage.GetValue<SettingsStorage>("ErrorsGrid"));

			var layout = storage.GetValue<string>("Layout");
			if (layout != null)
				DockSite.LoadLayout(layout, true);
		}
Ejemplo n.º 60
0
        /// <summary>
        /// Load settings.
        /// </summary>
        /// <param name="storage">Storage.</param>
        public override void Load(SettingsStorage storage)
        {
            base.Load(storage);

            Slippage = storage.GetValue <decimal>("Slippage");
        }