Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixConfiguration"/> class.
        /// </summary>
        /// <param name="broker">The FIX brokerage name.</param>
        /// <param name="accountType">The FIX account type.</param>
        /// <param name="accountCurrency">The FIX account currency.</param>
        /// <param name="configPath">The FIX configuration file path.</param>
        /// <param name="credentials">The FIX credentials.</param>
        /// <param name="sendAccountTag">The option flag to send account tags with messages.</param>
        /// <param name="connectWeeklyTime">The time to connect FIX sessions.</param>
        /// <param name="disconnectWeeklyTime">The time to disconnect FIX sessions.</param>
        public FixConfiguration(
            Brokerage broker,
            AccountType accountType,
            Currency accountCurrency,
            string configPath,
            FixCredentials credentials,
            bool sendAccountTag,
            WeeklyTime connectWeeklyTime,
            WeeklyTime disconnectWeeklyTime)
        {
            Condition.NotEmptyOrWhiteSpace(configPath, nameof(configPath));

            this.AccountId            = new AccountId(broker, credentials.AccountNumber, accountType);
            this.Broker               = broker;
            this.AccountType          = accountType;
            this.AccountCurrency      = accountCurrency;
            this.ConfigPath           = configPath;
            this.Credentials          = credentials;
            this.SendAccountTag       = sendAccountTag;
            this.ConnectWeeklyTime    = connectWeeklyTime;
            this.DisconnectWeeklyTime = disconnectWeeklyTime;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FixComponent"/> class.
        /// </summary>
        /// <param name="container">The componentry container.</param>
        /// <param name="messagingAdapter">The messaging adapter.</param>
        /// <param name="config">The FIX configuration.</param>
        /// <param name="messageHandler">The FIX message handler.</param>
        /// <param name="messageRouter">The FIX message router.</param>
        protected FixComponent(
            IComponentryContainer container,
            IMessageBusAdapter messagingAdapter,
            FixConfiguration config,
            IFixMessageHandler messageHandler,
            IFixMessageRouter messageRouter)
        {
            this.clock            = container.Clock;
            this.guidFactory      = container.GuidFactory;
            this.Logger           = container.LoggerFactory.CreateLogger(this.GetType().Name);
            this.messagingAdapter = messagingAdapter;

            this.FixMessageHandler = messageHandler;
            this.FixMessageRouter  = messageRouter;

            this.AccountId     = new AccountId(config.Broker, config.Credentials.AccountNumber, config.AccountType);
            this.Brokerage     = this.AccountId.Broker;
            this.AccountNumber = this.AccountId.AccountNumber;

            this.credentials    = config.Credentials;
            this.configPath     = config.ConfigPath;
            this.sendAccountTag = config.SendAccountTag;
            this.accountField   = new Account(this.AccountNumber.Value);
        }