Пример #1
0
        // ************************************************************
        // CONSTRUCTORS
        // ************************************************************
        // public SimulationParameters() { }

        public SimulationParameters(DateTime startDate, DateTime endDate, Period rebalancingPeriod, Period rampUpRebalPeriod, Calendar calendar,
                                    DayCounter dayCounter, BusinessDayConvention businessDayConvention, int maxNumberInstruments, bool shortsAllowed, InitializationMethod initMethod)
        {
            // Dates
            _startDate = startDate;
            _endDate   = endDate;

            // Calendar & Conventions
            _calendar   = calendar;
            _dayCounter = dayCounter;
            _bdc        = businessDayConvention;

            // Rebalancing
            _rebalPeriod       = rebalancingPeriod;
            _rampUpRebalPeriod = rampUpRebalPeriod;

            // Portfolio composition
            _MaxNumberInstruments = maxNumberInstruments;
            _shortsAllowed        = shortsAllowed;
            _initMethod           = initMethod;
        }
Пример #2
0
        /// <summary>
        /// Enters credentials on the device control panel and initiates the authentication process.
        /// Applies the specified parameters before submitting the authentication request.
        /// </summary>
        /// <param name="parameters">Additional configuration parameters presented on the Auth screen.</param>
        public void Authenticate(Dictionary <string, object> parameters)
        {
            StringBuilder     providerDescription = new StringBuilder(Provider.GetDescription());
            IAppAuthenticator appAuthenticator    = null;

            RecordEvent(DeviceWorkflowMarker.AuthenticationBegin);

            if (InitializationMethod != AuthenticationInitMethod.Badge)
            {
                AuthenticationProvider deviceDefaultProvider = GetDefaultProvider();

                if (Provider == AuthenticationProvider.Auto)
                {
                    // Use the device default
                    Provider = deviceDefaultProvider;
                    providerDescription.Append(" - ");
                    providerDescription.Append(Provider.GetDescription());
                }

                RecordInfo(DeviceWorkflowMarker.AuthType, providerDescription.ToString());

                if (Provider != deviceDefaultProvider)
                {
                    // Set the device provider to the requested provider
                    SetDeviceProvider(Provider);
                }

                //At this point this.Provider should be correctly set, so we should use it from now on.
                appAuthenticator = GetAppAuthenticator(Provider);
            }
            else
            {
                providerDescription.Insert(0, " - ");
                providerDescription.Insert(0, InitializationMethod.GetDescription());
                RecordInfo(DeviceWorkflowMarker.AuthType, providerDescription.ToString());
                appAuthenticator = GetAppAuthenticator(AuthenticationProvider.Card);
            }

            if (Provider == AuthenticationProvider.Card || InitializationMethod.Equals(AuthenticationInitMethod.Badge))
            {
                RecordEvent(DeviceWorkflowMarker.DeviceButtonPress, InitializationMethod.GetDescription());
                appAuthenticator.ApplyParameters(null);
            }
            else if (parameters?.Count > 0)
            {
                appAuthenticator.ApplyParameters(parameters);
            }

            RecordEvent(DeviceWorkflowMarker.EnterCredentialsBegin);
            appAuthenticator.EnterCredentials();
            RecordEvent(DeviceWorkflowMarker.EnterCredentialsEnd);

            if (Provider != AuthenticationProvider.Card)
            {
                appAuthenticator.SubmitAuthentication();
                if (!appAuthenticator.ValidateAuthentication())
                {
                    throw new DeviceWorkflowException($"{Credential.UserName} login failed. {appAuthenticator.ErrorMessage}");
                }
            }

            RecordEvent(DeviceWorkflowMarker.AuthenticationEnd);
        }
Пример #3
0
 public InitializationAttribute(InitializationMethod method)
 {
     InitializationMethod = method;
 }