示例#1
0
文件: Account.cs 项目: qadmium/ibapi
        public Account(string name, IConnection connection, IApiObjectsFactory factory, IExecutionStorageInternal executionStorage,
            IPositionsStorageInternal positionsesStorageInternal, IOrdersStorageInternal ordersStorageInternal,
            IIdsDispenser idsDispenser, CancellationTokenSource internalCancelationTokenSource,
            AccountCurrenciesFields accountCurrenciesFields)
        {
            CodeContract.Requires(!string.IsNullOrEmpty(name));
            CodeContract.Requires(connection != null);
            CodeContract.Requires(factory != null);
            CodeContract.Requires(executionStorage != null);
            CodeContract.Requires(positionsesStorageInternal != null);
            CodeContract.Requires(ordersStorageInternal != null);
            CodeContract.Requires(accountCurrenciesFields != null);
            CodeContract.Requires(idsDispenser != null);

            this.AccountName = name;
            this.AccountId = name;

            this.factory = factory;
            this.executionStorage = executionStorage;
            this.positionsesStorage = positionsesStorageInternal;
            this.ordersStorage = ordersStorageInternal;
            this.accountCurrenciesFields = accountCurrenciesFields;
            this.idsDispenser = idsDispenser;
            this.internalCancelationTokenSource = internalCancelationTokenSource;

            this.subscription =
                connection.Subscribe((AccountValueMessage message) => message.AccountName == this.AccountName,
                    this.OnAccountValueMessage);
        }
示例#2
0
 public IAccountInternal CreateAccount(string accountName, IExecutionStorageInternal executionStorage,
     IPositionsStorageInternal positionsStorage, IOrdersStorageInternal ordersStorage,
     AccountCurrenciesFields accountCurrenciesFields)
 {
     return new Account(accountName, this.connection, this, executionStorage, positionsStorage, ordersStorage,
         this.idsDispenser, this.internalCancellationTokenSource,
         accountCurrenciesFields);
 }