/// <summary> /// Creates a new <see cref="IBrokerage"/> instance /// </summary> /// <param name="job">The job packet to create the brokerage for</param> /// <param name="algorithm">The algorithm instance</param> /// <returns>A new brokerage instance</returns> public override IBrokerage CreateBrokerage(LiveNodePacket job, IAlgorithm algorithm) { var errors = new List <string>(); // read values from the brokerage data var server = Read <string>(job.BrokerageData, "fxcm-server", errors); var terminal = Read <string>(job.BrokerageData, "fxcm-terminal", errors); var userName = Read <string>(job.BrokerageData, "fxcm-user-name", errors); var password = Read <string>(job.BrokerageData, "fxcm-password", errors); var accountId = Read <string>(job.BrokerageData, "fxcm-account-id", errors); if (errors.Count != 0) { // if we had errors then we can't create the instance throw new Exception(string.Join(Environment.NewLine, errors)); } var brokerage = new FxcmBrokerage( algorithm.Transactions, algorithm.Portfolio, Composer.Instance.GetExportedValueByTypeName <IDataAggregator>(Config.Get("data-aggregator", "QuantConnect.Lean.Engine.DataFeeds.AggregationManager")), server, terminal, userName, password, accountId); Composer.Instance.AddPart <IDataQueueHandler>(brokerage); return(brokerage); }
/// <summary> /// Creates a new <see cref="IBrokerage"/> instance /// </summary> /// <param name="job">The job packet to create the brokerage for</param> /// <param name="algorithm">The algorithm instance</param> /// <returns>A new brokerage instance</returns> public override IBrokerage CreateBrokerage(LiveNodePacket job, IAlgorithm algorithm) { var errors = new List <string>(); // read values from the brokerage data var server = Read <string>(job.BrokerageData, "fxcm-server", errors); var terminal = Read <string>(job.BrokerageData, "fxcm-terminal", errors); var userName = Read <string>(job.BrokerageData, "fxcm-user-name", errors); var password = Read <string>(job.BrokerageData, "fxcm-password", errors); var accountId = Read <string>(job.BrokerageData, "fxcm-account-id", errors); if (errors.Count != 0) { // if we had errors then we can't create the instance throw new Exception(string.Join(Environment.NewLine, errors)); } var brokerage = new FxcmBrokerage(algorithm.Transactions, algorithm.Portfolio, server, terminal, userName, password, accountId); Composer.Instance.AddPart <IDataQueueHandler>(brokerage); Composer.Instance.AddPart <IHistoryProvider>(brokerage); return(brokerage); }
/// <summary> /// Creates a new <see cref="IBrokerage"/> instance /// </summary> /// <param name="job">The job packet to create the brokerage for</param> /// <param name="algorithm">The algorithm instance</param> /// <returns>A new brokerage instance</returns> public override IBrokerage CreateBrokerage(LiveNodePacket job, IAlgorithm algorithm) { var errors = new List<string>(); // read values from the brokerage data var server = Read<string>(job.BrokerageData, "fxcm-server", errors); var terminal = Read<string>(job.BrokerageData, "fxcm-terminal", errors); var userName = Read<string>(job.BrokerageData, "fxcm-user-name", errors); var password = Read<string>(job.BrokerageData, "fxcm-password", errors); var accountId = Read<string>(job.BrokerageData, "fxcm-account-id", errors); if (errors.Count != 0) { // if we had errors then we can't create the instance throw new Exception(string.Join(Environment.NewLine, errors)); } var brokerage = new FxcmBrokerage(algorithm.Transactions, algorithm.Portfolio, server, terminal, userName, password, accountId); Composer.Instance.AddPart<IDataQueueHandler>(brokerage); Composer.Instance.AddPart<IHistoryProvider>(brokerage); return brokerage; }