/// <summary> /// To load the state of paper trading parameters. /// </summary> /// <param name="storage">Storage.</param> public virtual void Load(SettingsStorage storage) { DepthExpirationTime = storage.GetValue(nameof(DepthExpirationTime), DepthExpirationTime); MatchOnTouch = storage.GetValue(nameof(MatchOnTouch), MatchOnTouch); Failing = storage.GetValue(nameof(Failing), Failing); Latency = storage.GetValue(nameof(Latency), Latency); IsSupportAtomicReRegister = storage.GetValue(nameof(IsSupportAtomicReRegister), IsSupportAtomicReRegister); BufferTime = storage.GetValue(nameof(BufferTime), BufferTime); //UseCandlesTimeFrame = storage.GetValue(nameof(UseCandlesTimeFrame), UseCandlesTimeFrame); InitialOrderId = storage.GetValue(nameof(InitialOrderId), InitialOrderId); InitialTradeId = storage.GetValue(nameof(InitialTradeId), InitialTradeId); InitialTransactionId = storage.GetValue(nameof(InitialTransactionId), InitialTransactionId); SpreadSize = storage.GetValue(nameof(SpreadSize), SpreadSize); MaxDepth = storage.GetValue(nameof(MaxDepth), MaxDepth); VolumeMultiplier = storage.GetValue(nameof(VolumeMultiplier), VolumeMultiplier); PortfolioRecalcInterval = storage.GetValue(nameof(PortfolioRecalcInterval), PortfolioRecalcInterval); ConvertTime = storage.GetValue(nameof(ConvertTime), ConvertTime); PriceLimitOffset = storage.GetValue(nameof(PriceLimitOffset), PriceLimitOffset); IncreaseDepthVolume = storage.GetValue(nameof(IncreaseDepthVolume), IncreaseDepthVolume); if (storage.Contains(nameof(TimeZone))) { TimeZone = storage.GetValue <TimeZoneInfo>(nameof(TimeZone)); } }
/// <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> /// Load settings. /// </summary> /// <param name="storage">Settings storage.</param> public virtual void Load(SettingsStorage storage) { FlushInterval = storage.GetValue <TimeSpan>(nameof(FlushInterval)); //MaxMessageCount = storage.GetValue<int>(nameof(MaxMessageCount)); Listeners.AddRange(storage.GetValue <IEnumerable <SettingsStorage> >(nameof(Listeners)).Select(s => s.LoadEntire <ILogListener>())); if (storage.Contains(nameof(LocalTimeZone))) { LocalTimeZone = storage.GetValue <TimeZoneInfo>(nameof(LocalTimeZone)); } }
public override void Load(SettingsStorage storage) { try { if (_root.Connector == null) { throw new ArgumentNullException(nameof(_root.Connector)); } if (!storage.Contains("UnderlyingAsset")) { throw new ArgumentException("UnderlyingAsset not found."); } var id = storage.GetValue <string>("UnderlyingAsset"); UnderlyingAsset = _root.Connector.Securities.FirstOrDefault(s => s.Id == id); if (UnderlyingAsset == null) { throw new ArgumentNullException(nameof(UnderlyingAsset)); } var optionIds = storage.GetValue <string[]>("Options"); if (optionIds.Any()) { throw new ArgumentException(string.Format("Options for {0} not found", id)); } optionIds.ForEach(o => { var option = _root.Connector.Securities.FirstOrDefault(s => s.Id == o); if (option == null) { this.AddWarningLog(string.Format("Option {0} not found", o)); return; } Options.Add(option); }); } catch (Exception ex) { this.AddError(ex); } }
public override void Load(SettingsStorage storage) { try { this.AddWarningLog(string.Format("{0}", "Загрузка основных настроек")); if (_isConfigLoad) { return; } if (!storage.Contains("Configuration")) { throw new ArgumentNullException(nameof(storage)); } if (Config == null) { Config = new Configuration(); } Config.Load(storage); UpdateConfig(Config); if (Connector == null) { throw new ArgumentNullException("Не удалоcь создать коннектор!"); } SessionState = DateTimeOffset.Now.SessionState(Config.IsDemo); if (Config.ConnectOnRun) { Connect(); } _isConfigLoad = true; } catch (Exception ex) { this.AddErrorLog(string.Format("{0} / {1}", ex.Message, ex.StackTrace)); OnNewStatusMessage(ex.Message); } }
/// <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")); }