本文整理汇总了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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例5: CreateInstance
public static ISecurityProvider CreateInstance()
{
if (_instance == null)
_instance = new MiniSecurity();
return _instance;
}
示例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);
}
示例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;
}
示例8: MembershipProviderManagementService
public MembershipProviderManagementService(IPersonRepository personRepository,
ISecurityProvider securityProvider)
{
Check.Require(personRepository != null, "userRepository may not be null");
_personRepository = personRepository;
_securityProvider = securityProvider;
}
示例9: SetSecurityProvider
public void SetSecurityProvider(ISecurityProvider provider)
{
if (_securityProvider != null) return;
lock (_locker)
{
if (_securityProvider != null) return;
_securityProvider = provider;
}
}
示例10: UserController
public UserController(
ISecurityProvider securityProvider,
ICommercialRepository repositoryCommerce,
IMailProvider mailProvider)
{
_securityProvider = securityProvider;
_repositoryCommerce = repositoryCommerce;
_mailProvider = mailProvider;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}