当前位置: 首页>>代码示例>>C#>>正文


C# ISecurityProvider类代码示例

本文整理汇总了C#中ISecurityProvider的典型用法代码示例。如果您正苦于以下问题:C# ISecurityProvider类的具体用法?C# ISecurityProvider怎么用?C# ISecurityProvider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ISecurityProvider类属于命名空间,在下文中一共展示了ISecurityProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateProvider

		private void UpdateProvider(ISecurityProvider provider)
		{
			if (_securityProvider == provider)
				return;

			if (_securityProvider != null)
			{
				_securityProvider.Added -= AddSecurities;
				_securityProvider.Removed -= RemoveSecurities;
				_securityProvider.Cleared -= ClearSecurities;

				SecurityTextBox.ItemsSource = Enumerable.Empty<Security>();
				_itemsSource = null;
			}

			_securityProvider = provider;

			if (_securityProvider == null)
				return;

			var itemsSource = new ObservableCollectionEx<Security>();

			_itemsSource = new ThreadSafeObservableCollection<Security>(itemsSource);
			_itemsSource.AddRange(_securityProvider.LookupAll());

			_securityProvider.Added += AddSecurities;
			_securityProvider.Removed += RemoveSecurities;
			_securityProvider.Cleared += ClearSecurities;

			SecurityTextBox.ItemsSource = itemsSource;
		}
开发者ID:qiujoe,项目名称:StockSharp,代码行数:31,代码来源:SecurityEditor.xaml.cs

示例2: GetUnderlyingAsset

		/// <summary>
		/// To get the underlying asset by the derivative.
		/// </summary>
		/// <param name="derivative">The derivative.</param>
		/// <param name="provider">The provider of information about instruments.</param>
		/// <returns>Underlying asset.</returns>
		public static Security GetUnderlyingAsset(this Security derivative, ISecurityProvider provider)
		{
			if (derivative == null)
				throw new ArgumentNullException("derivative");

			if (provider == null)
				throw new ArgumentNullException("provider");

			if (derivative.Type == SecurityTypes.Option)
			{
				derivative.CheckOption();

				return _underlyingSecurities.SafeAdd(derivative, key =>
				{
					var underlyingSecurity = provider.LookupById(key.UnderlyingSecurityId);

					if (underlyingSecurity == null)
						throw new InvalidOperationException(LocalizedStrings.Str704Params.Put(key.UnderlyingSecurityId));

					return underlyingSecurity;
				});
			}
			else
			{
				return provider.LookupById(derivative.UnderlyingSecurityId);
			}
		}
开发者ID:kknet,项目名称:StockSharp,代码行数:33,代码来源:DerivativesHelper.cs

示例3: AccountManager

        public AccountManager(
            ISecurityProvider securityProvider,
            IAccountRepository accountRepository,
            IAccountValidator accountValidator,
            ITimeSource timeSource,
            int accountSessionCollectionCapacity,
            ISessionRepository sessionRepository,
            IActionRightResolver actionRightResolver/*,
            Func<TBizAccountRegistrationData, TBizAccount> accountRegistrationDataToAccount*/)
        {
            // todo1[ak] check args
            _securityProvider = securityProvider;
            _accountRepository = accountRepository;
            _accountValidator = accountValidator;
            _timeSource = timeSource;

            _sessionManager = new SessionManager(
                _securityProvider,
                _timeSource,
                accountSessionCollectionCapacity,
                sessionRepository);

            _actionRightResolver = actionRightResolver;
            //_accountRegistrationDataToAccount = accountRegistrationDataToAccount;
        }
开发者ID:taucode,项目名称:taucode,代码行数:25,代码来源:AccountManager.cs

示例4: SecurityIdentity

        /// <summary>
        /// Initializes a new instance of the <see cref="SecurityIdentity"/> class.
        /// </summary>
        /// <param name="provider">An <see cref="ISecurityProvider"/> of the user.</param>
        /// <exception cref="ArgumentNullException">Value specified for <paramref name="provider"/> is null.</exception>
        public SecurityIdentity(ISecurityProvider provider)
        {
            if ((object)provider == null)
                throw new ArgumentNullException(nameof(provider));

            m_provider = provider;
        }
开发者ID:GridProtectionAlliance,项目名称:gsf,代码行数:12,代码来源:SecurityIdentity.cs

示例5: CreateInstance

        public static ISecurityProvider CreateInstance()
        {
            if (_instance == null)
                _instance = new MiniSecurity();

            return _instance;
        }
开发者ID:yslib,项目名称:minimvc,代码行数:7,代码来源:MiniSecurity.cs

示例6: CreateBrokerage

        /// <summary>
        ///     Creates the brokerage under test and connects it
        /// </summary>
        /// <returns>A connected brokerage instance</returns>
        protected override IBrokerage CreateBrokerage(IOrderProvider orderProvider, ISecurityProvider securityProvider)
        {
            var environment = Config.Get("oanda-environment").ConvertTo<Environment>();
            var accessToken = Config.Get("oanda-access-token");
            var accountId = Config.Get("oanda-account-id");

            return new OandaBrokerage(orderProvider, securityProvider, environment, accessToken, accountId);
        }
开发者ID:AlexCatarino,项目名称:Lean,代码行数:12,代码来源:OandaBrokerageTests.cs

示例7: BlackScholes

		/// <summary>
		/// Initializes a new instance of the <see cref="BlackScholes"/>.
		/// </summary>
		/// <param name="option">Options contract.</param>
		/// <param name="securityProvider">The provider of information about instruments.</param>
		/// <param name="dataProvider">The market data provider.</param>
		public BlackScholes(Security option, ISecurityProvider securityProvider, IMarketDataProvider dataProvider)
			: this(securityProvider, dataProvider)
		{
			if (option == null)
				throw new ArgumentNullException(nameof(option));

			Option = option;
		}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:14,代码来源:BlackScholes.cs

示例8: MembershipProviderManagementService

        public MembershipProviderManagementService(IPersonRepository personRepository,
                                                   ISecurityProvider securityProvider)
        {
            Check.Require(personRepository != null, "userRepository may not be null");

            _personRepository = personRepository;
            _securityProvider = securityProvider;
        }
开发者ID:ryantornberg,项目名称:wrms,代码行数:8,代码来源:MembershipProviderService.cs

示例9: SetSecurityProvider

 public void SetSecurityProvider(ISecurityProvider provider)
 {
     if (_securityProvider != null) return;
     lock (_locker)
     {
         if (_securityProvider != null) return;
         _securityProvider = provider;
     }
 }
开发者ID:Markeli,项目名称:BeardlyTeam,代码行数:9,代码来源:SecurityController.cs

示例10: UserController

 public UserController(
     ISecurityProvider securityProvider,
     ICommercialRepository repositoryCommerce,
     IMailProvider mailProvider)
 {
     _securityProvider = securityProvider;
     _repositoryCommerce = repositoryCommerce;
     _mailProvider = mailProvider;
 }
开发者ID:igorquintaes,项目名称:TibiaCommunity,代码行数:9,代码来源:UserController.cs

示例11: CreateBrokerage

        /// <summary>
        /// Creates the brokerage under test
        /// </summary>
        /// <returns>A connected brokerage instance</returns>
        protected override IBrokerage CreateBrokerage(IOrderProvider orderProvider, ISecurityProvider securityProvider)
        {
            var server = Config.Get("fxcm-server");
            var terminal = Config.Get("fxcm-terminal");
            var userName = Config.Get("fxcm-user-name");
            var password = Config.Get("fxcm-password");
            var accountId = Config.Get("fxcm-account-id");

            return new FxcmBrokerage(orderProvider, securityProvider, server, terminal, userName, password, accountId);
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:14,代码来源:FxcmBrokerageTests.cs

示例12: Synthetic

		/// <summary>
		/// Initializes a new instance of the <see cref="Synthetic"/>.
		/// </summary>
		/// <param name="security">The instrument (the option or the underlying asset).</param>
		/// <param name="provider">The provider of information about instruments.</param>
		public Synthetic(Security security, ISecurityProvider provider)
		{
			if (security == null)
				throw new ArgumentNullException(nameof(security));

			if (provider == null)
				throw new ArgumentNullException(nameof(provider));

			_security = security;
			_provider = provider;
		}
开发者ID:vikewoods,项目名称:StockSharp,代码行数:16,代码来源:Synthetic.cs

示例13: FxcmBrokerage

 /// <summary>
 /// Creates a new instance of the <see cref="FxcmBrokerage"/> class
 /// </summary>
 /// <param name="orderProvider">The order provider</param>
 /// <param name="securityProvider">The holdings provider</param>
 /// <param name="server">The url of the server</param>
 /// <param name="terminal">The terminal name</param>
 /// <param name="userName">The user name (login id)</param>
 /// <param name="password">The user password</param>
 /// <param name="accountId">The account id</param>
 public FxcmBrokerage(IOrderProvider orderProvider, ISecurityProvider securityProvider, string server, string terminal, string userName, string password, string accountId)
     : base("FXCM Brokerage")
 {
     _orderProvider = orderProvider;
     _securityProvider = securityProvider;
     _server = server;
     _terminal = terminal;
     _userName = userName;
     _password = password;
     _accountId = accountId;
 }
开发者ID:skyfyl,项目名称:Lean,代码行数:21,代码来源:FxcmBrokerage.cs

示例14: OandaBrokerage

        /// <summary>
        /// Initializes a new instance of the <see cref="OandaBrokerage"/> class.
        /// </summary>
        /// <param name="orderProvider">The order provider.</param>
        /// <param name="securityProvider">The holdings provider.</param>
        /// <param name="environment">The Oanda environment (Trade or Practice)</param>
        /// <param name="accessToken">The Oanda access token (can be the user's personal access token or the access token obtained with OAuth by QC on behalf of the user)</param>
        /// <param name="accountId">The account identifier.</param>
        public OandaBrokerage(IOrderProvider orderProvider, ISecurityProvider securityProvider, Environment environment, string accessToken, int accountId)
            : base("Oanda Brokerage")
        {
            _orderProvider = orderProvider;
            _securityProvider = securityProvider;

            if (environment != Environment.Trade && environment != Environment.Practice)
                throw new NotSupportedException("Oanda Environment not supported: " + environment);

            _environment = environment;
            _accessToken = accessToken;
            _accountId = accountId;
        }
开发者ID:skyfyl,项目名称:Lean,代码行数:21,代码来源:OandaBrokerage.cs

示例15: FxcmBrokerage

        /// <summary>
        /// Creates a new instance of the <see cref="FxcmBrokerage"/> class
        /// </summary>
        /// <param name="orderProvider">The order provider</param>
        /// <param name="securityProvider">The holdings provider</param>
        /// <param name="server">The url of the server</param>
        /// <param name="terminal">The terminal name</param>
        /// <param name="userName">The user name (login id)</param>
        /// <param name="password">The user password</param>
        /// <param name="accountId">The account id</param>
        public FxcmBrokerage(IOrderProvider orderProvider, ISecurityProvider securityProvider, string server, string terminal, string userName, string password, string accountId)
            : base("FXCM Brokerage")
        {
            _orderProvider = orderProvider;
            _securityProvider = securityProvider;
            _server = server;
            _terminal = terminal;
            _userName = userName;
            _password = password;
            _accountId = accountId;

            HistoryResponseTimeout = 5000;
            MaximumHistoryRetryAttempts = 1;
        }
开发者ID:AlexCatarino,项目名称:Lean,代码行数:24,代码来源:FxcmBrokerage.cs


注:本文中的ISecurityProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。